Install
npm i --save react-native-touch-id
or
yarn add react-native-touch-id
Usage
In your AndroidManifest.xml:
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
In your Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you quick and secure access to your account.</string>
example
TouchID.isSupported(optionalConfigObject)
.then(biometryType => {
// Success code
if (biometryType === 'FaceID') {
console.log('FaceID is supported.');
} else {
console.log('TouchID is supported.');
}
TouchID.authenticate('to demo this react-native component')
.then((success: any) => {
console.log('Authenticated Successfully', success);
})
.catch((error: any) => {
console.log('Authentication Failed', error);
});
})
.catch(error => {
// Failure code
console.log(error);
});