SelfLender / react-native-biometrics

React Native module for iOS and Android biometrics
MIT License
639 stars 217 forks source link

Android keystrore error #284

Open Ritik5Prasad opened 2 months ago

Ritik5Prasad commented 2 months ago

export const loginWithBiometrics = async (userID: string) => { try { const isBiometricAvailable = await checkBiometrics(); if (!isBiometricAvailable) { throw new Error("Biometric not available"); } const { keysExist } = await rnBiometrics.biometricKeysExist();

if (!keysExist) {
  const { publicKey } = await rnBiometrics.createKeys();
  console.log("PUblicKey ", publicKey);
}

const { success, signature } = await rnBiometrics.createSignature({
  promptMessage: "Sign in",
  payload: userID,

});

if (!success) {
  throw new Error("Biometrics authentication failed!");
}

console.log(signature);
if (signature) {
  return true;
} else {
  return false;
}

} catch (error) { console.log("Error@@", JSON.stringify(error)); return false; } };

Error@@ {"nativeStackAndroid":[],"userInfo":null,"message":"Error creating signature","code":"Error creating signature: android.security.KeyStoreException: Key user not authenticated (internal Keystore code: -26 message: In KeystoreOperation::finish\n\nCaused by:\n 0: In finish: KeyMint::finish failed.\n 1: Error::Km(ErrorCode(-26))) (public error code: 2 internal Keystore code: -26)"}

amjadbouhouch commented 2 months ago

+1

rick427 commented 1 month ago

+1

VladosDosvidos commented 1 month ago

+1

jamalzkhan commented 1 month ago

+1