react-native-fingerprint-scanner
Advanced tools
Comparing version
{ | ||
"name": "react-native-fingerprint-scanner", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "React Native Fingerprint Scanner for Android and iOS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -233,3 +233,3 @@ # React Native Fingerprint Scanner | ||
### `authenticate({ description })`: (iOS) | ||
### `authenticate({ description, fallbackEnabled })`: (iOS) | ||
Starts Fingerprint authentication on iOS. | ||
@@ -239,2 +239,3 @@ | ||
- `description: String` - the string to explain the request for user authentication. | ||
- `fallbackEnabled: Boolean` - display the fallback button (e.g. Enter Password). | ||
@@ -292,12 +293,12 @@ ```javascript | ||
|---|---| | ||
| LAErrorAuthenticationNotMatch | No match | | ||
| LAErrorAuthenticationFailed | Authentication was not successful because the user failed to provide valid credentials | | ||
| LAErrorUserCancel | Authentication was canceled by the user - e.g. the user tapped Cancel in the dialog | | ||
| LAErrorUserFallback | Authentication was canceled because the user tapped the fallback button (Enter Password) | | ||
| LAErrorSystemCancel | Authentication was canceled by system - e.g. if another application came to foreground while the authentication dialog was up | | ||
| LAErrorPasscodeNotSet | Authentication could not start because the passcode is not set on the device | | ||
| LAErrorFingerprintScannerNotAvailable | Authentication could not start because Fingerprint Scanner is not available on the device | | ||
| LAErrorFingerprintScannerNotEnrolled | Authentication could not start because Fingerprint Scanner has no enrolled fingers | | ||
| RCTFingerprintScannerUnknownError | Could not authenticate for an unknown reason | | ||
| RCTFingerprintScannerNotSupported | Device does not support Fingerprint Scanner | | ||
| AuthenticationNotMatch | No match | | ||
| AuthenticationFailed | Authentication was not successful because the user failed to provide valid credentials | | ||
| UserCancel | Authentication was canceled by the user - e.g. the user tapped Cancel in the dialog | | ||
| UserFallback | Authentication was canceled because the user tapped the fallback button (Enter Password) | | ||
| SystemCancel | Authentication was canceled by system - e.g. if another application came to foreground while the authentication dialog was up | | ||
| PasscodeNotSet | Authentication could not start because the passcode is not set on the device | | ||
| FingerprintScannerNotAvailable | Authentication could not start because Fingerprint Scanner is not available on the device | | ||
| FingerprintScannerNotEnrolled | Authentication could not start because Fingerprint Scanner has no enrolled fingers | | ||
| FingerprintScannerUnknownError | Could not authenticate for an unknown reason | | ||
| FingerprintScannerNotSupported | Device does not support Fingerprint Scanner | | ||
@@ -304,0 +305,0 @@ ## License |
@@ -9,3 +9,3 @@ import { DeviceEventEmitter, NativeModules } from 'react-native'; | ||
DeviceEventEmitter.addListener('FINGERPRINT_SCANNER_AUTHENTICATION', (message) => { | ||
if (message === 'LAErrorAuthenticationNotMatch' && typeof onAttempt === 'function') { | ||
if (message === 'AuthenticationNotMatch' && typeof onAttempt === 'function') { | ||
onAttempt(createError(message)); | ||
@@ -12,0 +12,0 @@ } |
@@ -6,6 +6,5 @@ import { NativeModules } from 'react-native'; | ||
export default ({ description }) => { | ||
const authReason = description || ' '; | ||
export default ({ description = ' ', fallbackEnabled = true }) => { | ||
return new Promise((resolve, reject) => { | ||
ReactNativeFingerprintScanner.authenticate(authReason, error => { | ||
ReactNativeFingerprintScanner.authenticate(description, fallbackEnabled, error => { | ||
if (error) return reject(createError(error.message)); | ||
@@ -12,0 +11,0 @@ resolve(true); |
const ERRORS = { | ||
LAErrorAuthenticationNotMatch: 'No match.', | ||
LAErrorAuthenticationFailed: 'Authentication was not successful because the user failed to provide valid credentials.', | ||
LAErrorUserCancel: 'Authentication was canceled by the user - e.g. the user tapped Cancel in the dialog.', | ||
LAErrorUserFallback: 'Authentication was canceled because the user tapped the fallback button (Enter Password).', | ||
LAErrorSystemCancel: 'Authentication was canceled by system - e.g. if another application came to foreground while the authentication dialog was up.', | ||
LAErrorPasscodeNotSet: 'Authentication could not start because the passcode is not set on the device.', | ||
LAErrorFingerprintScannerNotAvailable: 'Authentication could not start because Fingerprint Scanner is not available on the device.', | ||
LAErrorFingerprintScannerNotEnrolled: 'Authentication could not start because Fingerprint Scanner has no enrolled fingers.', | ||
RCTFingerprintScannerUnknownError: 'Could not authenticate for an unknown reason.', | ||
RCTFingerprintScannerNotSupported: 'Device does not support Fingerprint Scanner.', | ||
AuthenticationNotMatch: 'No match.', | ||
AuthenticationFailed: 'Authentication was not successful because the user failed to provide valid credentials.', | ||
UserCancel: 'Authentication was canceled by the user - e.g. the user tapped Cancel in the dialog.', | ||
UserFallback: 'Authentication was canceled because the user tapped the fallback button (Enter Password).', | ||
SystemCancel: 'Authentication was canceled by system - e.g. if another application came to foreground while the authentication dialog was up.', | ||
PasscodeNotSet: 'Authentication could not start because the passcode is not set on the device.', | ||
FingerprintScannerNotAvailable: 'Authentication could not start because Fingerprint Scanner is not available on the device.', | ||
FingerprintScannerNotEnrolled: 'Authentication could not start because Fingerprint Scanner has no enrolled fingers.', | ||
FingerprintScannerUnknownError: 'Could not authenticate for an unknown reason.', | ||
FingerprintScannerNotSupported: 'Device does not support Fingerprint Scanner.', | ||
}; | ||
@@ -13,0 +13,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
40822
0.1%305
0.33%217
-0.46%