Skip to content

Commit

Permalink
attempted fix for #23
Browse files Browse the repository at this point in the history
  • Loading branch information
4f77616973 committed Dec 27, 2022
1 parent 5eb48d8 commit 7924002
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL
import androidx.biometric.BiometricManager.BIOMETRIC_SUCCESS
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat
import androidx.core.hardware.fingerprint.FingerprintManagerCompat
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
import cash.z.ecc.android.bip39.Mnemonics
Expand Down Expand Up @@ -529,7 +530,11 @@ class CryptoUtilities(
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // Ask for authentication when loading keys, must be larger than 0
setUserAuthenticationParameters(DEFAULT_AUTHENTICATION_DELAY, KeyProperties.AUTH_DEVICE_CREDENTIAL or KeyProperties.AUTH_BIOMETRIC_STRONG)
if (FingerprintManagerCompat.from(context).isHardwareDetected && FingerprintManagerCompat.from(context).hasEnrolledFingerprints()) {
setUserAuthenticationParameters(DEFAULT_AUTHENTICATION_DELAY, KeyProperties.AUTH_DEVICE_CREDENTIAL or KeyProperties.AUTH_BIOMETRIC_STRONG)
} else {
setUserAuthenticationParameters(DEFAULT_AUTHENTICATION_DELAY, KeyProperties.AUTH_DEVICE_CREDENTIAL)
}
} else {
setUserAuthenticationValidityDurationSeconds(DEFAULT_AUTHENTICATION_DELAY)
}
Expand Down

0 comments on commit 7924002

Please sign in to comment.