authpass / biometric_storage

Flutter plugin to store data behind biometric authentication (ie. fingerprint)
https://pub.dev/packages/biometric_storage
MIT License
171 stars 101 forks source link

[Question] why cipher cannot be used if `authenticationValidityDurationSeconds` is not -1? #113

Closed abdallah-odeh closed 1 month ago

abdallah-odeh commented 2 months ago

You have this code block in your repo

 if (cipher == null || options.authenticationValidityDurationSeconds >= 0) {
  // if authenticationValidityDurationSeconds is not -1 we can't use a CryptoObject
  logger.debug { "Authenticating without cipher. ${options.authenticationValidityDurationSeconds}" }
  prompt.authenticate(promptBuilder.build())
} else {
  prompt.authenticate(promptBuilder.build(), BiometricPrompt.CryptoObject(cipher))
}

so why cipher is ignored if the duration is over zero?

hpoul commented 1 month ago

this is actually kind of documented in https://pub.dev/documentation/biometric_storage/latest/biometric_storage/StorageFileInitOptions/androidBiometricOnly.html

which references https://github.com/authpass/biometric_storage/issues/12#issuecomment-902508609 .. hope that answers that question.