Skip to content

Commit 9b35e90

Browse files
sraptis-scyvkanellopoulos
authored andcommitted
Fingerprint unlock fix
1 parent fcfdec4 commit 9b35e90

3 files changed

Lines changed: 39 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The library supports the following features:
5454
| **Remote Presentation** | OpenID for Verifiable Presentations 1.0 | |
5555
| | ClientID scheme | ✅ preregistered <br /> ✅ x509_san_dns<br /> ✅ x509_hash <br /> ✅ redirect_uri |
5656
| | DCQL | ✅ support for credential_sets <br />❌ support for claim_sets <br /> ❌ multiple credentials in CredentialQuery ignored |
57+
| | Transaction data ||
5758

5859
The library is written in Kotlin and is compatible with Java. It is distributed as a Maven package
5960
and can be included in any Android project that uses Android 8 (API level 26) or higher.

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/ProcessResponse.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import eu.europa.ec.eudi.wallet.internal.d
2424
import eu.europa.ec.eudi.wallet.issue.openid4vci.IssueEvent.Companion.failure
2525
import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Companion.TAG
2626
import eu.europa.ec.eudi.wallet.logging.Logger
27+
import kotlinx.coroutines.runBlocking
2728
import kotlinx.coroutines.suspendCancellableCoroutine
2829
import kotlin.coroutines.resume
2930

@@ -60,10 +61,14 @@ internal class ProcessResponse(
6061
signingAlgorithm = e.signingAlgorithm,
6162
keysRequireAuth = e.keysAndSecureAreas,
6263
resume = { keyUnlockData ->
63-
cont.resume(keyUnlockData)
64+
runBlocking {
65+
cont.resume(keyUnlockData)
66+
}
6467
},
6568
cancel = {
66-
cont.cancel(IllegalStateException("Canceled"))
69+
runBlocking {
70+
cont.cancel(IllegalStateException("Canceled"))
71+
}
6772
}
6873
)
6974
)

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/SubmitRequest.kt

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import eu.europa.ec.eudi.openid4vci.SubmissionOutcome
2828
import eu.europa.ec.eudi.wallet.document.UnsignedDocument
2929
import eu.europa.ec.eudi.wallet.document.credential.ProofOfPossessionSigner
3030
import eu.europa.ec.eudi.wallet.provider.WalletAttestationsProvider
31+
import kotlinx.coroutines.runBlocking
3132
import org.multipaz.securearea.KeyUnlockData
3233

3334
internal class SubmitRequest(
@@ -204,32 +205,36 @@ internal class SubmitRequest(
204205
val keyIndex = 0
205206
val proofsSpecification = ProofsSpecification.JwtProofs.WithKeyAttestation(
206207
proofSignerProvider = { nonce ->
207-
try {
208-
val factory = KeyAttestationSigner.Factory(
209-
signers, keyIndex, walletAttestationsProvider, keyUnlockData
210-
)
211-
factory(nonce).getOrThrow().also { proofSigner = it }
212-
} catch (e: Throwable) {
213-
214-
val isUserAuthRequired = proofSigner.keyLockedException != null
215-
if (isUserAuthRequired) {
216-
val keysAndSecureAreas = mapOf(
217-
proofSigner.signer.let { it.keyAlias to it.secureArea }
218-
)
219-
throw UserAuthRequiredException(
220-
signingAlgorithm = proofSigner.signer.getKeyInfo().algorithm,
221-
keysAndSecureAreas = keysAndSecureAreas,
222-
resume = { keyUnlockData -> unlockResume(keyUnlockData) },
223-
cause = e
224-
)
225-
} else {
226-
throw e
227-
}
228-
}
208+
val factory = KeyAttestationSigner.Factory(
209+
signers, keyIndex, walletAttestationsProvider, keyUnlockData
210+
)
211+
factory(nonce).getOrThrow().also { proofSigner = it }
229212
},
230213
keyIndex = keyIndex,
231214
)
232-
return with(issuer) { request(payload, proofsSpecification) }.getOrThrow()
215+
try {
216+
return with(issuer) { request(payload, proofsSpecification) }.getOrThrow()
217+
} catch (e: Throwable) {
218+
219+
val isUserAuthRequired = proofSigner.keyLockedException != null
220+
if (isUserAuthRequired) {
221+
val keysAndSecureAreas = mapOf(
222+
proofSigner.signer.let { it.keyAlias to it.secureArea }
223+
)
224+
throw UserAuthRequiredException(
225+
signingAlgorithm = proofSigner.signer.getKeyInfo().algorithm,
226+
keysAndSecureAreas = keysAndSecureAreas,
227+
resume = { keyUnlockData ->
228+
runBlocking {
229+
unlockResume(keyUnlockData)
230+
}
231+
},
232+
cause = e
233+
)
234+
} else {
235+
throw e
236+
}
237+
}
233238

234239
}
235240

@@ -256,7 +261,9 @@ internal class SubmitRequest(
256261
throw UserAuthRequiredException(
257262
signingAlgorithm = proofSigner.algorithm,
258263
keysAndSecureAreas = keysAndSecureAreas,
259-
resume = { keyUnlockData -> unlockResume(keyUnlockData) },
264+
resume = { keyUnlockData -> runBlocking {
265+
unlockResume(keyUnlockData)
266+
} },
260267
cause = e
261268
)
262269
} else {

0 commit comments

Comments
 (0)