A React-Native module to enable biometric login and securely store a user's credentials using native apis. The user's credentials are encrypted and stored using Keychain on iOS and Encrypted Shared Preferences on Android.
npm install react-native-biometric-login --save
cd ios && pod install && cd ..
or
yarn add react-native-biometric-login
cd ios && pod install && cd ..
import {
BiometricIsAvailable,
BasicBiometricAuth,
LoginBiometricAuth,
SetUser,
UpdateUser,
GetUser,
DeleteUser,
} from 'react-native-biometric-login';
// ...
const result = await BiometricIsAvailable();
-
BiometricIsAvailable() - Checks if a biometric authentication method is available on the device. Returns: Promise that resolves with true or false
-
BasicBiometricAuth(title: string, description: string) - Opens a basic biometric login prompt. Returns: Promise that resolves with true if success or rejects with message if fail.
-
LoginBiometricAuth(title: string, description: string) - Opens a biometric login prompt that returns stored user credentials. Returns: Promise that resolves with object {success: true, username: "username", password: "password"} if success or rejects with message if fail.
-
SetUser(username: string, password: string) - Save the user's credentials. Returns: Promise that resolves with object {success: true, message: response_text} if success or rejects with message if fail.
-
UpdateUser(username: string, password: string) - Update the user's credentials. Returns: Promise that resolves with object {success: true, message: response_text} if success or rejects with message if fail.
-
GetUser() - Gets the user's credentials. Returns: Promise that resolves with object {success: true, username: "username", password: "password"} if success or rejects with message if fail.
-
DeleteUser() - Deletes the user's credentials. Returns: Promise that resolves with object {success: true, message: response_text} if success or rejects with message if fail.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT