-
Notifications
You must be signed in to change notification settings - Fork 236
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
Android: adds Credentials to BiometryType #231
base: master
Are you sure you want to change the base?
Conversation
@jayfunk Could you have a look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this does create a prompt, on my android 31 emulator, I am unable to actually create the private and public keys with just device credentials. I get this error:
java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use
Have you been able to get around this? I believe this is somewhat related investigative work I was doing on #225
WritableMap resultMap = new WritableNativeMap(); | ||
resultMap.putBoolean("available", false); | ||
|
||
switch (canAuthenticateCredentials) { | ||
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE: | ||
resultMap.putString("error", "BIOMETRIC_ERROR_NO_HARDWARE"); | ||
break; | ||
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE: | ||
resultMap.putString("error", "BIOMETRIC_ERROR_HW_UNAVAILABLE"); | ||
break; | ||
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED: | ||
resultMap.putString("error", "BIOMETRIC_ERROR_NONE_ENROLLED"); | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is a duplicate of the else block starting on line 101. You should extract these two pieces and re-use them instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've extracted this bit to a seperate function.
android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java
Outdated
Show resolved
Hide resolved
Here is a screenshot of the emulator doing the device credential only prompt. |
Thank you for reviewing @jayfunk. With regards to the |
@jayfunk do you have time for another review? |
allowDeviceCredentials
toisSensorAvailable
andsimplePrompt
Credentials
BiometryType to differentiate between https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG() and https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#DEVICE_CREDENTIAL()android.content.pm.PackageManager
to check if it isFingerprint