authpass / biometric_storage

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

platformexception even if `canAuthenticate` returns `success` #114

Closed flumm closed 4 months ago

flumm commented 5 months ago

I have a situation here (and at least at one user) where BiometricStorage.canAuthenticate() returns success but when actually writing to a storage we get the following exception:

I/flutter ( 8748): PlatformException(Unexpected Error, java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use, java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use
I/flutter ( 8748): java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use
I/flutter ( 8748):      at android.security.keystore2.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:262)
I/flutter ( 8748):      at android.security.keystore2.AndroidKeyStoreKeyGeneratorSpi$AES.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:63)
I/flutter ( 8748):      at javax.crypto.KeyGenerator.init(KeyGenerator.java:519)
I/flutter ( 8748):      at javax.crypto.KeyGenerator.init(KeyGenerator.java:502)
I/flutter ( 8748):      at design.codeux.biometric_storage.CryptographyManagerImpl.getOrCreateSecretKey(CryptographyManager.kt:179)
I/flutter ( 8748):      at design.codeux.biometric_storag
I/flutter ( 8748): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
I/flutter ( 8748): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)

i could locally only reproduce it when there is no lock screen mechanism set, but the user says he has a fingerprint set up (maybe there is some combination of settings that does not correctly detect this?)

hpoul commented 4 months ago

closing, probably the same as #104