[LinkNewDevice] Fix second and next attempts to unlock using biometric failures.

`cipher.doFinal` cannot be called several times.
This commit is contained in:
Benoit Marty
2026-08-07 15:35:09 +02:00
committed by Benoit Marty
parent 33979b6574
commit 4485c8a4c0
@@ -59,7 +59,7 @@ class DefaultBiometricAuthentication(
private var cryptoObject: CryptoObject? = null
override suspend fun setup() {
if (cryptoObject != null) return
Timber.d("Setup biometric authentication")
try {
val secretKey = ensureKey()
val cipher = encryptionDecryptionService.createEncryptionCipher(secretKey)
@@ -126,6 +126,9 @@ private class AuthenticationCallback(
if (this == null) return false
return runCatchingExceptions {
doFinal("biometric_challenge".toByteArray())
}.isSuccess
}.onFailure {
Timber.e(it, "Failed to validate cipher")
}
.isSuccess
}
}