mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
[LinkNewDevice] Fix second and next attempts to unlock using biometric failures.
`cipher.doFinal` cannot be called several times.
This commit is contained in:
committed by
Benoit Marty
parent
33979b6574
commit
4485c8a4c0
+5
-2
@@ -59,7 +59,7 @@ class DefaultBiometricAuthentication(
|
|||||||
private var cryptoObject: CryptoObject? = null
|
private var cryptoObject: CryptoObject? = null
|
||||||
|
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
if (cryptoObject != null) return
|
Timber.d("Setup biometric authentication")
|
||||||
try {
|
try {
|
||||||
val secretKey = ensureKey()
|
val secretKey = ensureKey()
|
||||||
val cipher = encryptionDecryptionService.createEncryptionCipher(secretKey)
|
val cipher = encryptionDecryptionService.createEncryptionCipher(secretKey)
|
||||||
@@ -126,6 +126,9 @@ private class AuthenticationCallback(
|
|||||||
if (this == null) return false
|
if (this == null) return false
|
||||||
return runCatchingExceptions {
|
return runCatchingExceptions {
|
||||||
doFinal("biometric_challenge".toByteArray())
|
doFinal("biometric_challenge".toByteArray())
|
||||||
}.isSuccess
|
}.onFailure {
|
||||||
|
Timber.e(it, "Failed to validate cipher")
|
||||||
|
}
|
||||||
|
.isSuccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user