react-native-local-authenticate
v1.0.1
Published
React Native: Locale Authenticate
Downloads
9
Readme
ReactNative: Local Authenticate [FaceID/TouchID] (Android/iOS)
If this project has helped you out, please support us with a star 🌟
This library is the replica of expo-local-authentication source. It can be used as standalone library in case someone does not wants to configure expo environment.
📖 Getting started
$ npm install react-native-local-authenticate --save
RN60 >= RNLA V1 >
RN60 above please use
react-native-local-authenticate
V1 and above
- iOS
iOS Prerequisite: Please make sure
CocoaPods
is installed on your system
- Add the following to your `Podfile` -> `ios/Podfile` and run pod update:
use_native_modules!
pod 'RNLocalAuthenticate', :path => '../node_modules/react-native-local-authenticate/ios'
- Android
Please add below permission to your app AndroidManifest
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
RN60 < RNLA V1 <
RN60 below please use
react-native-local-authenticate
V.0.*
$ react-native link react-native-local-authenticate
Android
- Please add below script in your
build.gradle
- Please add below script in your
buildscript {
repositories {
jcenter()
maven { url "https://maven.google.com" }
...
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
...
}
}
Note
- Android SDK 27 > is supported
💬 Usage
import { RNLocalAuthenticate } from 'react-native-local-authenticate'
RNLocalAuthenticate.HasHardware().then((hasHardware) => {
})
RNLocalAuthenticate.IsEnrolled().then((isEnrolled) => {
})
RNLocalAuthenticate.SupportedAuthenticationTypes().then((isEnrolled) => {
})
RNLocalAuthenticate.Authenticate('reason').then((isEnrolled) => {
})
💡 Props
- General(iOS & Android)
| Prop | Type | Default | Note |
| ---------------------- | ------------------- | ------- | ------------------------------------------------ |
| HasHardware:Promise
| bool
| | Used to check for hardware capability |
| IsEnrolled:Promise
| bool
| | Used to check enrolled for FaceID/TouchID |
| Authenticate
| bool
| | Used to authenticate user using FaceId/TouchID |
- Android
| Prop | Type | Default | Note |
| ------------------------ | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| CancelAuthenticate
| `` | true | Used to cancel ongoing authentication |
- iOS
| Prop | Type | Default | Note |
| ---------------------------- | ------------------- | ------------ | ---------------------------------------------------------- |
| SupportedAuthenticationTypes
| array
| | Used to check supported authentication types |
✨ Credits
🤔 How to contribute
Have an idea? Found a bug? Please raise to ISSUES. Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.
💫 Where is this library used?
If you are using this library in one of your projects, add it in this list below. ✨
📜 License
This library is provided under the Apache 2 License.
RNAppTour @ prscX
💖 Support my projects
I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
Starring and sharing the projects you like 🚀
If you're feeling especially charitable, please follow prscX on GitHub.
Thanks! ❤️ prscX.github.io </ Pranav >