File tree Expand file tree Collapse file tree 3 files changed +3
-4
lines changed
lib/src/main/java/at/bitfire/cert4android
sample-app/src/main/java/at/bitfire/cert4android/demo Expand file tree Collapse file tree 3 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ import javax.net.ssl.X509TrustManager
2424@SuppressLint(" CustomX509TrustManager" )
2525class CustomCertManager @JvmOverloads constructor(
2626 context : Context ,
27- private val scope : CoroutineScope ,
2827 val trustSystemCerts : Boolean = true ,
28+ private val scope : CoroutineScope ,
2929 private val getUserDecision : suspend (X509Certificate ) -> Boolean
3030): X509TrustManager {
3131
Original file line number Diff line number Diff line change @@ -67,12 +67,11 @@ class UserDecisionRegistry private constructor(
6767 }
6868 }
6969
70- if (requestDecision) {
70+ if (requestDecision)
7171 scope.launch {
7272 val userDecision = getUserDecision(cert) // Suspends until user decision is made
7373 onUserDecision(cert, userDecision)
7474 }
75- }
7675 }
7776
7877 fun onUserDecision (cert : X509Certificate , trusted : Boolean ) {
Original file line number Diff line number Diff line change @@ -205,8 +205,8 @@ class MainActivity : ComponentActivity() {
205205 // set cert4android TrustManager and HostnameVerifier
206206 val certMgr = CustomCertManager (
207207 getApplication(),
208- viewModelScope,
209208 trustSystemCerts = trustSystemCerts,
209+ viewModelScope,
210210 getUserDecision = { cert ->
211211 // Reset user decision
212212 userDecision = CompletableDeferred ()
You can’t perform that action at this time.
0 commit comments