Open Ainias opened 1 year ago
Hi @Ainias Can you share me this file ReactNativeBiometrics.java. I am also getting issue on android 9
Hi @aniket-holcim We had another issue, namely that on some Android 10 devices the library would authenticate with finger print only, but the devices did not have finger print. Therefore it would always throw an error.
We forked the library and added a function for the old keyguardAuthentication. Now whenever we get an error 'Hardware not present' we do an keyguardAuthentication
(We catch the error on the JS-side).
Our fork is available here: https://github.com/churchtools/react-native-biometrics
Our authentication-Code in JS is basically the following:
biometrics
.simplePrompt({ promptMessage: title + '\n\n' + reason })
.then(async ({ success, error }) => {
if (!success && !isIOS && error === 'Hardware not present') {
const { success: keyguardSuccess, error: keyguardError } = await biometrics.keyguardAuthentication({
promptMessage: title,
promptReason: reason
});
success = keyguardSuccess;
}
// Check for success and errors
}).catch(e => {
// Error handling of errors thrown
})
Hi! 👋
Firstly, thanks for your work on this project! 🙂
I've encountered a problem where the device credentials are not working when using simple prompt with android 10 and below. I checked the source code and found that it is not supported by the underlying library if used with strong biometrics. This is necessary if you use the crypto adapter. If you don't use it, weak biometrics is working correctly with device credentials.
As I only need the simplePrompt, I've created a patch to let it work with devices below android 10 and no finger print: Here is the diff that solved my problem:
Today I used patch-package to patch
react-native-biometrics@3.0.1
for the project I'm working on.This issue body was partially generated by patch-package.