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

Unable to delete storage without biometric #34

Closed Androrier closed 3 years ago

Androrier commented 3 years ago

Hi there, I'm not sure if it's a bug or feature but when I create a secure storage like:

_customPrompt = await BiometricStorage().getStorage( '${baseName}_customPrompt', options: StorageFileInitOptions( authenticationValidityDurationSeconds: 30), androidPromptInfo: const AndroidPromptInfo( title: 'Custom title', subtitle: 'Custom subtitle', description: 'Custom description', negativeButton: 'Nope!', ));

I wish to write and read with the fingerprint ofcourse, but when I log out from my app, I wish to delete the token I saved, and then I call _customPrompt.delete(), but the fingerprint is not necessary, but it still pops up, which doesn't make any sense in that case. What should I do?

hpoul commented 3 years ago

Not sure if it's a bug, but it's the way it's implemented right now: https://github.com/authpass/biometric_storage/blob/49896a646cfc69ebfae7c41cab1046f57036ce64/android/src/main/kotlin/design/codeux/biometric_storage/BiometricStoragePlugin.kt#L197

It simply always asks for authentication when authentication is configured. I guess technically you would only need authentication for reading.. even writing would work without authentication.. (at least when creating a new key 🤔️)

Androrier commented 3 years ago

Hi @hpoul, thank you for your quick response. Currently I'm using biometric_storage: ^2.0.3 and it's asking me for biometric when reading, writing and deleting. You say that it's possible to ask for biometric only on reading? It this available right now? How do I achieve that?

Edit: From the Git blame I see that it's like that from yesterday? When will it be available? If so, you are awesome!

hpoul commented 3 years ago

i've removed the authentication prompt for delete.