react-native-fingerprint-scanner
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "react-native-fingerprint-scanner", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "React Native Fingerprint Scanner for Android and iOS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
101
README.md
@@ -28,3 +28,3 @@ # React Native Fingerprint Scanner | ||
### Table of Contents | ||
## Table of Contents | ||
@@ -34,2 +34,3 @@ - [Installation](#installation) | ||
- [API](#api) | ||
- [License](#license) | ||
@@ -40,7 +41,7 @@ ## Installation | ||
### Automatically | ||
### Automatic Configuration | ||
`$ react-native link react-native-fingerprint-scanner` | ||
### Manually | ||
### Manual Configuration | ||
@@ -69,3 +70,3 @@ #### iOS | ||
### Extra Steps | ||
### Extra Configuration | ||
@@ -222,7 +223,87 @@ 1. Make sure the following versions are all correct in `android/app/build.gradle` | ||
| Method | Description | Example | | ||
|---|---|---| | ||
| `isSensorAvailable`</br>(ios, android) | Returns a `Promise`. | `FingerprintScanner.isSensorAvailable()` | | ||
| `authenticate`</br>(ios) | Returns a `Promise`. | `FingerprintScanner.authenticate({ description })` | | ||
| `authenticate`</br>(android) | Returns a `Promise`. | `FingerprintScanner.authenticate({ onAttempt })` | | ||
| `release`</br>(android only) | Stops Fingerprint Scanner listener and optimizes memory. | `FingerprintScanner.release()` | | ||
### `isSensorAvailable()`: (Android, iOS) | ||
Checks if Fingerprint Scanner is able to be used by now. | ||
- Returns a `Promise` | ||
```javascript | ||
componentDidMount() { | ||
FingerprintScanner | ||
.isSensorAvailable() | ||
.catch(error => this.setState({ errorMessage: error.message })); | ||
} | ||
``` | ||
### `authenticate({ description })`: (iOS) | ||
Starts Fingerprint authentication on iOS. | ||
- Returns a `Promise` | ||
- `description: String` - the string to explain the request for user authentication. | ||
```javascript | ||
componentDidMount() { | ||
FingerprintScanner | ||
.authenticate({ description: 'Scan your fingerprint on the device scanner to continue' }) | ||
.then(() => { | ||
this.props.handlePopupDismissed(); | ||
AlertIOS.alert('Authenticated successfully'); | ||
}) | ||
.catch((error) => { | ||
this.props.handlePopupDismissed(); | ||
AlertIOS.alert(error.message); | ||
}); | ||
} | ||
``` | ||
### `authenticate({ onAttempt })`: (Android) | ||
Starts Fingerprint authentication on Android. | ||
- Returns a `Promise` | ||
- `onAttempt: Function` - a callback function when users are trying to scan their fingerprint but failed. | ||
```javascript | ||
componentDidMount() { | ||
FingerprintScanner | ||
.authenticate({ onAttempt: this.handleAuthenticationAttempted }) | ||
.then(() => { | ||
this.props.handlePopupDismissed(); | ||
Alert.alert('Fingerprint Authentication', 'Authenticated successfully'); | ||
}) | ||
.catch((error) => { | ||
this.setState({ errorMessage: error.message }); | ||
this.description.shake(); | ||
}); | ||
} | ||
``` | ||
### `release()`: (Android) | ||
Stops fingerprint scanner listener and optimizes memory. | ||
- Returns a `Void` | ||
```javascript | ||
componentWillUnmount() { | ||
FingerprintScanner.release(); | ||
} | ||
``` | ||
### `Errors` | ||
| Name | Message | | ||
|---|---| | ||
| 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 | | ||
## License | ||
MIT | ||
Made with ♥ for [Jenius](https://www.jenius.com/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64814
305