Android: adds Credentials to BiometryType#231
Android: adds Credentials to BiometryType#231jensdev wants to merge 11 commits intoSelfLender:masterfrom
Conversation
|
@jayfunk Could you have a look at this? |
jayfunk
left a comment
There was a problem hiding this comment.
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.
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.
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. |
Co-authored-by: Tyler Cook <cook.tylerj@gmail.com>
|
Thank you for reviewing @jayfunk. With regards to the |
|
@jayfunk do you have time for another review? |

allowDeviceCredentialstoisSensorAvailableandsimplePromptCredentialsBiometryType 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.PackageManagerto check if it isFingerprint