Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Fix biometric reSetup loop
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed Mar 2, 2024
1 parent 0fb4f2e commit 78554b3
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ fun VaultScreen(
if (checkIfBiometricAvailable(context)) {
showBiometricPromptForSetup(
context as MainActivity,
KeyStore.initForEncryption(
KeyAlias.BiometricAesKey,
deviceAuthentication = true
),
cipher =
KeyStore.initForEncryption(
KeyAlias.BiometricAesKey,
deviceAuthentication = true
),
onAuthenticationSucceeded = { cipher ->
scope.launch(Dispatchers.IO) {
val encryptedData = KeyStore.encrypt(cipher, viewModel.vault.aesKey)
Expand All @@ -125,17 +126,15 @@ fun VaultScreen(
)
)
}

navController.navigate(
screen = Screen.Vault,
disableBack = true
)
},
onAuthenticationFailed = {
navController.navigate(
screen = Screen.Vault,
disableBack = true
)
scope.launch(Dispatchers.IO) {
viewModel.credentialRepository.update(
credentials.copy(
biometricReSetup = false
)
)
}
}
)
} else {
Expand Down

0 comments on commit 78554b3

Please sign in to comment.