UNPKG

react-native-instantpay-device-auth

Version:

React Native module for biometric functionality for Touch ID, Face ID, Passcode and other biometrics. Supports both iOS and Android.

82 lines (48 loc) 2.39 kB
# react-native-instantpay-device-auth React Native module for biometric functionality for Touch ID, Face ID, Passcode and other biometrics. Supports both iOS and Android. ## Installation ```sh npm install react-native-instantpay-device-auth Install pods $ pod-install ``` ## Additional configuration FOR IOS • Open Project in Xcode and then select Targets. • In Targets click on Build Phases. • Inside Build Phases expand Link Binary With Libraries. • Click on Add (+) icon. • Search LocalAuthentication.framework and add it. • Add Key - "NSFaceIDUsageDescription" and the Value - "Reason for using the authentication" in your project in Info.plist file. ## Usage ```js import { openBiometricAuthenticatePrompt } from 'react-native-instantpay-device-auth'; // ... let titleData = { title: "Title", subTitle: "Sub Title", } const result = await openBiometricAuthenticatePrompt(titleData); // OR const result = await openBiometricAuthenticatePrompt(); /* If you want to pass title and subtitle in Biometric Promt you can make object with key and values and stringify the titleData object and pass it in openBiometricAuthenticatePrompt(JSON.stringify(titleData)) method. If you do not want to pass title and subtitle then pass an empty object in openBiometricAuthenticatePrompt(JSON.stringify({})) then it will take default value for title and subtitle. Default value of title - "Unlock" Default value of subTitle - "Enter phone screen lock pattern, PIN, password or fingerprint" response = {"actCode": "", "data": "", "message": "Authentication Success", "status": "Success"} openBiometricAuthenticatePrompt() methods checks first that Biometric Authencation enrolled or not. If it is enrolled then it opens Biometric Prompt. */ ``` ## Response Data Response: {"actCode": "", "data": "", "message": "Authentication Success", "status": "Success"} message - Biometric message, Authentication Success, Authentication Failed, Biometrics available or not enrolled etc. status - It will show that biometric authentication success or failed. ## Note If there is no biometric enrolled than it will return Success with a message that Biometric features not enrolled. ## Contributing See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. ## License MIT --- Made with [Instantpay]