authpass / biometric_storage

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

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

Closed abdallah-odeh closed 6 months ago

abdallah-odeh commented 8 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 6 months 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.