[Error: Wrapped error: User not authenticated]
const res = await Keychain.setGenericPassword(${APP_NAME}-USER, password, { accessControl: ACCESS_CONTROL.BIOMETRY_ANY, accessible: ACCESSIBLE.WHEN_UNLOCKED, storage: STORAGE_TYPE.AES_GCM, })
When I verify through biometric authentication, an error occurs in android , ios is normal;
"react-native": "0.73.7", "react-native-keychain": "^9.2.2",
Hey @jibo001,
I faced a similar issue when modifying the keychain during development, Here is a guide I made:
Altering Keychain Options Without Resetting Existing Keychains
If you modify react-native-keychain options (e.g.,
accessControl,accessibleorauthenticationPrompt) on an already existing keychain entry without resetting or deleting the old keychains, it may cause issues when attempting to access them.
Is there any more information you can provide?
When using biometrics on Android you also need to add the permission to your AndroidManifesst.xml
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
@Bowlerr it my first time install this package , and i added biometric permission in AndroidManifest.xml , my Device is Honor v2 , but in xiaomi15pro can run;
RSA is running normally. Is it safe enough to use it to store user password?
@jibo001 out of curiosity, is it just the setting that gives you this error? Does resetting the keychain before setting still get this error?
@Bowlerr yes , i try resetGenericPassword before setGenericPassword , but error same.
await Keychain.resetGenericPassword() await Keychain.setGenericPassword(${APP_NAME}-USER, password, { accessControl: ACCESS_CONTROL.BIOMETRY_CURRENT_SET, accessible: ACCESSIBLE.WHEN_UNLOCKED, storage: STORAGE_TYPE.AES_GCM, })
LOG [Error: Wrapped error: User not authenticated]
i try setting validityDuration to 30 in CipherStorageKeystoreAesGcm.kt but invalid
@jibo001 do you know if biometrics work on that device for other apps other than the lock screen?
Like banking apps for example, trying to figure out if it's a bug with the device
@Bowlerr This is not an issue with mobile biometric verification. i use react-native-biometrics work good, and when i use STORAGE_TYPE.RSA storage,getGenericPassword is normal when i use biometrics.
@jibo001 sorry I'm unsure what a solution to this issue will be from my experience using the package. Hopefully an active maintenancer can be more helpful.
I'll see if I can get access to a Honor V2 tomorrow and confirm this issue for you too
The only time I an recreate the error: Wrapped error: User not authenticated is an edge-case that is triggered when android users adds a fingerprint when biometrics keychain is enabled and set.
Doesn't trigger on removal just additions.
Hey @jibo001, I can't reproduce the issue. Could you create example repository with steps to reproduce it?
I am facing this issue too. My device is a Samsung Galaxy A23 5G, react-native version: 0.79.2 and react-native-keychain: 10.0.0.
I can properly set the password but when trying to retrieve it I receive this very same error.
Here is an example of the code that I am using and it is failing:
Setting the password
await Keychain.setGenericPassword( 'username', 'password', { service: 'testing', storage: STORAGE_TYPE.RSA, accessControl: ACCESS_CONTROL.BIOMETRY_CURRENT_SET, accessible: ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY, }, );
Getting the password
await Keychain.getGenericPassword({ service: 'testing' });