react-native-kobiton-biometrics
v1.0.5
Published
React Native Kobiton Biometrics
Downloads
45
Readme
react-native-kobiton-biometrics
Overview
The react-native-kobiton-biometrics
package bridges the gap between Kobiton's Biometric Android SDK and React Native, simplifying the integration of biometric authentication into your projects. This package allows developers to easily work within the familiar node_modules
structure while utilizing the powerful features of Kobiton's Biometric SDK for Android.
This React Native package:
- Includes Biometric SDK for Android.
- Simplifies the integration process by allowing developers to work within the familiar
node_modules
structure. - Provides a clear and easy-to-use API.
Installation
To install the package, run:
npm install react-native-kobiton-biometrics
Android Setup
After installing, add the following line to your android/app/build.gradle
inside the repositories
block:
maven { url '../../node_modules/react-native-kobiton-biometrics/android/MavenLocal' }
If you're unsure about the maven path, navigate to the project directory and run:
cd node_modules/react-native-kobiton-biometrics/android
./gradlew setupKobitonBiometric
This will display the correct path to use in your build.gradle
Usage
import { KobitonFingerprintAuth, KobitonBiometric } from 'react-native-kobiton-biometrics';
If you are using 'react-native-touch-id':
Replace the instance of TouchId with KobitonFingerprintAuth:
KobitonFingerprintAuth.authenticate('Authenticate using fingerprint', optionalConfigObject)
.then(success => {
Alert.alert('Authenticated Successfully');
})
.catch(error => {
Alert.alert('Authentication Failed');
});
If you are using 'react-native-biometrics':
Replace the instance of new ReactNativeBiometrics() with KobitonBiometric:
KobitonBiometric.simplePrompt({
promptMessage: 'Confirm fingerprint'
})
.then(result => {
if (result.success) {
Alert.alert('Authenticated Successfully');
} else {
Alert.alert('Authentication Failed');
}
})
.catch(error => {
Alert.alert('Authentication Failed');
});