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

Android: adds Credentials to BiometryType #231

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

jensdev
Copy link

@jensdev jensdev commented Nov 16, 2022

@jensdev jensdev closed this Nov 16, 2022
@jensdev jensdev reopened this Nov 16, 2022
@jensdev jensdev marked this pull request as ready for review November 17, 2022 14:13
@jensdev
Copy link
Author

jensdev commented Nov 30, 2022

@jayfunk Could you have a look at this?

@jayfunk jayfunk self-assigned this Dec 2, 2022
Copy link
Member

@jayfunk jayfunk left a 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

Comment on lines 82 to 95
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;
}
Copy link
Member

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.

Copy link
Author

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.

@jayfunk
Copy link
Member

jayfunk commented Dec 13, 2022

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

Here is a screenshot of the emulator doing the device credential only prompt.
Screen Shot 2022-12-13 at 16 43 56

@jensdev
Copy link
Author

jensdev commented Dec 15, 2022

Thank you for reviewing @jayfunk. With regards to the java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use I've not used the function to create keys. I am only using the isSensorAvailable and simplePrompt

@jensdev jensdev reopened this Dec 15, 2022
@jensdev jensdev requested a review from jayfunk March 3, 2023 09:57
@jensdev
Copy link
Author

jensdev commented Mar 3, 2023

@jayfunk do you have time for another review?

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

Successfully merging this pull request may close these issues.

2 participants