prscX / react-native-local-authenticate

React Native: Local Authentication
Apache License 2.0
15 stars 1 forks source link
android ios react-native

PRs Welcome

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 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'

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

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

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
Prop Type Default Note
CancelAuthenticate `` true Used to cancel ongoing authentication
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: