Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
rn-biometric-authentication
Advanced tools
Readme
React native biometric Auth is a bridge to Android/iOS for biometric authentication.
npm i rn-biometric-authentication
On React Native 0.60+ the CLI autolink feature links the module while building the app.
This package requires an iOS target SDK version of iOS 10 or higher
Ensure that you have the NSFaceIDUsageDescription
entry set in your react native iOS project, or Face ID will not work properly. This description will be will be presented to the user the first time a biometrics action is taken, and the user will be asked if they want to allow the app to use Face ID. If the user declines the usage of face id for the app, the isSensorAvailable
function will indicate biometrics is unavailable until the face id permission is specifically allowed for the app by the user.
This package requires a compiled SDK version of 29 (Android 10.0) or higher
Detects what type of biometric sensor is available. Returns a Promise
that resolves to an object with details about biometrics availability
Result Object
Property | Type | Description |
---|---|---|
available | bool | A boolean indicating if biometrics is available or not |
biometryType | string | A string indicating what type of biometrics is available. TouchID (iOS), FaceID (iOS), Biometrics (Android), or undefined if biometrics is not available. |
error | string | An error message indicating why biometrics may not be available. undefined if there is no error. |
Example
import ReactNativeBiometricAuth from 'rn-biometric-authentication'
ReactNativeBiometricAuth.isSensorAvailable()
.then((resultObject) => {
const { available, biometryType } = resultObject
if (available && biometryType === ReactNativeBiometrics.TouchID) {
console.log('ReactNativeBiometricAuth', 'TouchID is supported')
} else if (available && biometryType === ReactNativeBiometrics.FaceID) {
console.log('ReactNativeBiometricAuth', 'FaceID is supported')
} else if (available && biometryType === ReactNativeBiometrics.Biometrics) {
console.log('ReactNativeBiometricAuth', 'Biometrics is supported')
} else {
console.log('ReactNativeBiometricAuth', 'Biometrics not supported')
}
})
Prompts the user for their fingerprint or face id. Returns a Promise
that resolves if the user provides a valid biometrics or cancel the prompt, otherwise the promise rejects.
Options Object
Parameter | Type | Description | iOS | Android |
---|---|---|---|---|
promptMessage | string | Message that will be displayed in the biometrics prompt | ✔ | ✔ |
cancelButtonText | string | Text to be displayed for the cancel button on biometric prompts, defaults to Cancel | ✖ | ✔ |
isDeviceAuthEnabled | boolean | Enable fallback to device credential for authentication. | ✖ | ✔ |
fallbackText | string | Fallback text to be displayed for passcode if TouchID or FaceID authentication failed. | ✔ | ✖ |
Result Object
Property | Type | Description |
---|---|---|
success | bool | A boolean indicating if the biometric prompt succeeded, false if the users cancels the biometrics prompt |
error | string | An error message indicating why the biometric prompt failed. undefined if there is no error. |
Example
import ReactNativeBiometricAuth from 'rn-biometric-authentication'
ReactNativeBiometricAuth.simplePrompt({promptMessage: 'Authenticate'})
.then((resultObject) => {
const { success } = resultObject
if (success) {
console.log('ReactNativeBiometricAuth', 'Success')
} else {
console.log('ReactNativeBiometricAuth', 'Cancelled')
}
})
.catch(() => {
console.log('ReactNativeBiometricAuth', 'Failed')
})
This library uses some code from react-native-biometrics. Added options to fallback to the device credentials for authentication. Removed some feature to make it simple to use for authentication purpose only.
FAQs
React Native library biometric authentication.
The npm package rn-biometric-authentication receives a total of 111 weekly downloads. As such, rn-biometric-authentication popularity was classified as not popular.
We found that rn-biometric-authentication demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.