Describe the bug
Certain devices are not been able to sign data using biometric authentication, failing with the following error
Failed to generate signature: android.security.KeyStoreException: Key user not authenticated (internal Keystore code: -26 message: system/security/keystore2/src/operation.rs:852: KeystoreOperation::finish
Caused by:
0: system/security/keystore2/src/operation.rs:433: Finish failed for uid 10495
1: Error::Km(r#KEY_USER_NOT_AUTHENTICATED)) (public error code: 2 internal Keystore code: -26)
While investigating, I found some issues that might relate to this behavior:
It looks like the access to the cryptoObject in the onAuthenticationSucceeded callback in verifyKeySignature might be the origin of the failure.
To Reproduce
Create keys and sign data using this values:
const keyAlias = "testing";
const data = "challenge";
const { publicKey: newPublicKey } = await createKeys(
keyAlias,
"ec256",
BiometricStrength.Weak,
allowCredentials,
);
const { signature, success, error, errorCode } = await signWithOptions({
keyAlias,
data,
promptTitle: "Use your fingerprint to continue",
promptSubtitle: "Press the fingerprint sensor.",
cancelButtonText: "Cancel",
biometricStrength: BiometricStrength.Weak,
disableDeviceFallback: false,
});
Expected behavior
As with many of our users, all devices should be able to perform the cryptographic operations and sign the data.
Smartphones detected:
- Motorola Edge 50 Neo, Android 16
- Motorola Moto G23, Android 14
- Motorola Edge 40 Neo, Android 16
- Xiaomi 14 Ultra, Android 15
- Xiaomi 14, Android 16
- Xiaomi Redmi Note 14 Pro+ 5G, Android 16
All running the version 0.14.0 of the package
Describe the bug
Certain devices are not been able to sign data using biometric authentication, failing with the following error
While investigating, I found some issues that might relate to this behavior:
It looks like the access to the
cryptoObjectin theonAuthenticationSucceededcallback inverifyKeySignaturemight be the origin of the failure.To Reproduce
Create keys and sign data using this values:
Expected behavior
As with many of our users, all devices should be able to perform the cryptographic operations and sign the data.
Smartphones detected:
All running the version 0.14.0 of the package