hieuvp / react-native-fingerprint-scanner

Provide Fingerprint, Touch ID, and Face ID Scanner for React Native (Compatible with both Android and iOS)
https://www.npmjs.com/package/react-native-fingerprint-scanner
871 stars 296 forks source link

Saving Fingerprint data into a database #174

Closed cardyy closed 2 years ago

cardyy commented 3 years ago

I have been going through the library and saw that it mainly authenticates fingerprints, i wanted to ask if there can be a way to save the fingerprint data into a database through a post request maybe . How can i capture the fingerprint information

mikehardy commented 3 years ago

Hi there! You should examine how the authentication and biometrics work on the platform. When I checked (since I was curious if it was possible to do something similar) it seemed to me that the platform (as in: the operating system, nothing available via APIs) captured the biometric data and stored it within the platform. The only thing information that is exposed via APIs that this module (or any app can use) are APIs that are effectively "hey Platform, can you request biometric auth from the user?" to which the platform replies with a successful authentication or not.

No biometric data is available to the app at any time as far as I saw

276259822 commented 2 years ago

evaluatedPolicyDomainState node_modules/react-native-fingerprint-scanner/ios/ReactNativeFingerprintScanner.m

if (success) {
                 // Authenticated Successfully
                 if (context.evaluatedPolicyDomainState) {
                   NSString *biometryData = [context.evaluatedPolicyDomainState base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
                   callback(@[[NSNull null], biometryData]);
                   return;
                 } else {
                   callback(@[[NSNull null]]);
                   return;
                 }
             }
mikehardy commented 2 years ago

@276259822 that is cool and I did not even know that was possible, however, it does not actually return the biometrics, which was the question. That said it does at least offer comparison, which is ...maybe interesting. I'm going to close this as a combo of "not really possible" along with "but looks like code above can get you there". I left notes on #163 proposing how to get it integrated if someone wants to propose a PR