Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launchFingerprintEnrollment without hasEnrolledFingerprints #96

Open
Flo354 opened this issue Apr 6, 2018 · 3 comments
Open

launchFingerprintEnrollment without hasEnrolledFingerprints #96

Flo354 opened this issue Apr 6, 2018 · 3 comments
Labels

Comments

@Flo354
Copy link

Flo354 commented Apr 6, 2018

Hi,

I am using the release 3.0.0-RC-1 and I have a question.
You just deprecated some methods including "hasEnrolledFingerprints". If I don't use "hasEnrolledFingerprints", how can I know if I need to use the method "launchFingerprintEnrollment" on Android P?

I tried to test "rxFingerprint.encrypt(KEY_NAME, stringToEncrypt)"... but the exception returned is of no use.

java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use
at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:254)
at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi$AES.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:54)
at javax.crypto.KeyGenerator.init(KeyGenerator.java:519)
at javax.crypto.KeyGenerator.init(KeyGenerator.java:502)
at com.mtramin.rxfingerprint.AesCipherProvider.createKey(AesCipherProvider.java:62)
at com.mtramin.rxfingerprint.AesCipherProvider.findOrCreateKey(AesCipherProvider.java:52)
at com.mtramin.rxfingerprint.AesCipherProvider.cipherForEncryption(AesCipherProvider.java:71)
at com.mtramin.rxfingerprint.CipherProvider.getCipherForEncryption(CipherProvider.java:89)
at com.mtramin.rxfingerprint.FingerprintDialogAesEncryptionObservable.initCryptoObject(FingerprintDialogAesEncryptionObservable.java:89)
at com.mtramin.rxfingerprint.FingerprintDialogObservable.subscribe(FingerprintDialogObservable.java:70)

I was surprised to see that in your code, the method "isAvailable" does not checks for enrollments for Android P. Is it normal?

Thanks,

@Mauin
Copy link
Owner

Mauin commented Apr 7, 2018

I also realized this shortly after I released RC-1. So this is a good question. The methods for hasEnrolledFingerprints and isHardwareAvailable were deprecated because they are part of FingerprintManager, which is also deprecated in Android P in favor of the FingerprintDialog implementation which doesn't have such methods.

Instead it seems like FingerprintDialog will emit error callbacks with FINGERPRINT_ERROR_HW_NOT_PRESENT or FINGERPRINT_ERROR_NO_FINGERPRINTS to indicate that this is the case.

I think this is another reason why the suggestion in #93 and #89 make sense. Especially in the context for Android P and these new errors it makes sense providing them to users so that it is possible to detect the issues and launch the fingerprint setup screen if necessary. Possibly also with helper methods for isHwNotPresent and hasNoFingerprintsRegistered on the FingerprintAuthenticationException.

@Mauin Mauin added the 3.x label Apr 7, 2018
@Flo354
Copy link
Author

Flo354 commented Apr 9, 2018

Also, would it be possible to have a result when the user comes back from the enrollment activity?
This way, we could have more pertinent actions according to the result.

For instance:

  1. the user cancelled the action, we can do that
  2. the user successfully registered, we do that
    ...

@Mauin
Copy link
Owner

Mauin commented Apr 10, 2018

I haven't personally played around with this Intent yet, I just saw that it exists and decided it would make sense in RxFingerprint. If we can start the Intent with a result and then forward these result items to the caller I think it's definitely something we can consider adding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants