NiklasMerz / cordova-plugin-fingerprint-aio

Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support
https://www.npmjs.com/package/cordova-plugin-fingerprint-aio
MIT License
323 stars 188 forks source link

When using loadBiometricSecret instead of secreat getting 'biometric_success' when using Pin (Android) #378

Open Kawinesh opened 3 years ago

Kawinesh commented 3 years ago

Bug report

Description

I am using the backupJSONObjectToStorage function to store my secret and when i try to get the secret using loadBiometricSecret function and trying to use Pin instead of Fingerprint i am getting 'biometric_success' in the success callback of loadBiometricSecret instead of the secret.

Expected would be get the secret in the success callback.

Plugin version: 4.0.2 Cordova : 9.0.0 Cordova Android : ^9.0.0 Device: One Plus 7 (Android 11)

MatiasProietti commented 2 years ago

I can confirm this bug happens to me as well.

Plugin: ^5.0.0 Capacitor: ^3.3.2 Device: Samsung A32 (Android 11)

jdpsah93 commented 1 year ago

I am also facing the same issue @Kawinesh . loadBiometricSecret and registerBiometricSecret is not working properly with PIN authentication. I think we should not give option to use PIN to perform any operation with these two methods. I suspect setting and getting secret from keyChain works only with biometric(fingerprint/touchId) authentication. However we can allow to use PIN if user just calls show method as it just authenticates identity and it doesn't deal with any secret operation.

If we add the below highlighted line in If condition then it will stop giving option to use pin If the operation is apart from justAuthenticate

@NiklasMerz please let me know if this solution is fine then I will raise the PR for this change.

NOTE: after doing this changes I have tested and I am able to achieve as expected.

PIN issue