Coder Social home page Coder Social logo

react-native-biometrics's Introduction

react-native-biometrics

React native biometrics is a simple bridge to native iOS and Android keystore management. It allows you to create public private key pairs that are stored in native keystores and protected by biometric authentication. Those keys can then be retrieved later, after proper authentication, and used to create a cryptographic signature.

React Native Compatibility

react-native-biometrics version Required React Native Version
>= 3.0.0 >= 0.60
<= 1.7.0 <= 0.59.x

Getting started

using either Yarn:

yarn add react-native-biometrics

or npm:

$ npm install react-native-biometrics --save

Install pods

$ npx pod-install

Link / Autolinking

On React Native 0.60+ the CLI autolink feature links the module while building the app.

Additional configuration

iOS

This package requires an iOS target SDK version of iOS 10 or higher

Ensure that you have the NSFaceIDUsageDescription entry set in your react native iOS project, or Face ID will not work properly. This description will be presented to the user the first time a biometrics action is taken, and the user will be asked if they want to allow the app to use Face ID. If the user declines the usage of face id for the app, the isSensorAvailable function will indicate biometrics is unavailable until the face id permission is specifically allowed for the app by the user.

Android

This package requires a compiled SDK version of 29 (Android 10.0) or higher

Usage

This package is designed to make server authentication using biometrics easier. Here is an image from https://android-developers.googleblog.com/2015/10/new-in-android-samples-authenticating.html illustrating the basic use case:

react-native-biometrics

When a user enrolls in biometrics, a key pair is generated. The private key is stored securely on the device and the public key is sent to a server for registration. When the user wishes to authenticate, the user is prompted for biometrics, which unlocks the securely stored private key. Then a cryptographic signature is generated and sent to the server for verification. The server then verifies the signature. If the verification was successful, the server returns an appropriate response and authorizes the user.

Biometry Types

TouchID (iOS only)

A constant for the touch id sensor type, evaluates to 'TouchID'

Example

import ReactNativeBiometrics, { BiometryTypes } from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

const { biometryType } = await rnBiometrics.isSensorAvailable()

if (biometryType === BiometryTypes.TouchID) {
  //do something fingerprint specific
}

FaceID (iOS only)

A constant for the face id sensor type, evaluates to 'FaceID'

Example

import ReactNativeBiometrics, { BiometryTypes } from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

const { biometryType } = await rnBiometrics.isSensorAvailable()

if (biometryType === BiometryTypes.FaceID) {
  //do something face id specific
}

Biometrics (Android only)

A constant for generic Biometrics, evaluates to 'Biometrics'

Example

import ReactNativeBiometrics, { BiometryTypes } from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

const { biometryType } = await rnBiometrics.isSensorAvailable()

if (biometryType === BiometryTypes.Biometrics) {
  //do something face id specific
}

Class

Constructor

Options Object

Parameter Type Description iOS Android
allowDeviceCredentials boolean Boolean that will enable the ability for the device passcode to be used instead of biometric information. On iOS, the prompt will only be shown after biometrics has failed twice. On Android, the prompt will be shown on the biometric prompt and does not require the user to attempt to use biometrics information first. Note: This feature is not supported on Android versions prior to API 30.

Example

import ReactNativeBiometrics from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics({ allowDeviceCredentials: true })

// Perform operations as normal
// All prompts will allow for fallback to the device's credentials for authentication

isSensorAvailable()

Detects what type of biometric sensor is available. Returns a Promise that resolves to an object with details about biometrics availability

Result Object

Property Type Description
available bool A boolean indicating if biometrics is available or not
biometryType string A string indicating what type of biometrics is available. TouchID, FaceID, Biometrics, or undefined if biometrics is not available.
error string An error message indicating why biometrics may not be available. undefined if there is no error.

Example

import ReactNativeBiometrics, { BiometryTypes } from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

rnBiometrics.isSensorAvailable()
  .then((resultObject) => {
    const { available, biometryType } = resultObject

    if (available && biometryType === BiometryTypes.TouchID) {
      console.log('TouchID is supported')
    } else if (available && biometryType === BiometryTypes.FaceID) {
      console.log('FaceID is supported')
    } else if (available && biometryType === BiometryTypes.Biometrics) {
      console.log('Biometrics is supported')
    } else {
      console.log('Biometrics not supported')
    }
  })

createKeys()

Generates a public private RSA 2048 key pair that will be stored in the device keystore. Returns a Promise that resolves to an object providing details about the keys.

Result Object

Property Type Description
publicKey string A base64 encoded string representing the public key

Example

import ReactNativeBiometrics from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

rnBiometrics.createKeys()
  .then((resultObject) => {
    const { publicKey } = resultObject
    console.log(publicKey)
    sendPublicKeyToServer(publicKey)
  })

biometricKeysExist()

Detects if keys have already been generated and exist in the keystore. Returns a Promise that resolves to an object indicating details about the keys.

Result Object

Property Type Description
keysExist bool A boolean indicating if keys exist in the keystore

Example

import ReactNativeBiometrics from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()
rnBiometrics.biometricKeysExist()
  .then((resultObject) => {
    const { keysExist } = resultObject

    if (keysExist) {
      console.log('Keys exist')
    } else {
      console.log('Keys do not exist or were deleted')
    }
  })

deleteKeys()

Deletes the generated keys from the device keystore. Returns a Promise that resolves to an object indicating details about the deletion.

Result Object

Property Type Description
keysDeleted bool A boolean indicating if keys were deleted from the keystore

Example

import ReactNativeBiometrics from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

rnBiometrics.deleteKeys()
  .then((resultObject) => {
    const { keysDeleted } = resultObject

    if (keysDeleted) {
      console.log('Successful deletion')
    } else {
      console.log('Unsuccessful deletion because there were no keys to delete')
    }
  })

createSignature(options)

Prompts the user for their fingerprint or face id in order to retrieve the private key from the keystore, then uses the private key to generate a RSA PKCS#1v1.5 SHA 256 signature. Returns a Promise that resolves to an object with details about the signature.

**NOTE: No biometric prompt is displayed in iOS simulators when attempting to retrieve keys for signature generation, it only occurs on actual devices.

Options Object

Parameter Type Description iOS Android
promptMessage string Message that will be displayed in the fingerprint or face id prompt
payload string String of data to be signed by the RSA signature
cancelButtonText string Text to be displayed for the cancel button on biometric prompts, defaults to Cancel

Result Object

Property Type Description
success bool A boolean indicating if the process was successful, false if the users cancels the biometrics prompt
signature string A base64 encoded string representing the signature. undefined if the process was not successful.
error string An error message indicating reasons why signature creation failed. undefined if there is no error.

Example

import ReactNativeBiometrics from 'react-native-biometrics'

let epochTimeSeconds = Math.round((new Date()).getTime() / 1000).toString()
let payload = epochTimeSeconds + 'some message'

const rnBiometrics = new ReactNativeBiometrics()

rnBiometrics.createSignature({
    promptMessage: 'Sign in',
    payload: payload
  })
  .then((resultObject) => {
    const { success, signature } = resultObject

    if (success) {
      console.log(signature)
      verifySignatureWithServer(signature, payload)
    }
  })

simplePrompt(options)

Prompts the user for their fingerprint or face id. Returns a Promise that resolves if the user provides a valid biometrics or cancel the prompt, otherwise the promise rejects.

**NOTE: This only validates a user's biometrics. This should not be used to log a user in or authenticate with a server, instead use createSignature. It should only be used to gate certain user actions within an app.

Options Object

Parameter Type Description iOS Android
promptMessage string Message that will be displayed in the biometrics prompt
fallbackPromptMessage string Message that will be shown when FaceID or TouchID has failed and a passcode has been set on the device.
cancelButtonText string Text to be displayed for the cancel button on biometric prompts, defaults to Cancel

Result Object

Property Type Description
success bool A boolean indicating if the biometric prompt succeeded, false if the users cancels the biometrics prompt
error string An error message indicating why the biometric prompt failed. undefined if there is no error.

Example

import ReactNativeBiometrics from 'react-native-biometrics'

const rnBiometrics = new ReactNativeBiometrics()

rnBiometrics.simplePrompt({promptMessage: 'Confirm fingerprint'})
  .then((resultObject) => {
    const { success } = resultObject

    if (success) {
      console.log('successful biometrics provided')
    } else {
      console.log('user cancelled biometric prompt')
    }
  })
  .catch(() => {
    console.log('biometrics failed')
  })

Troubleshooting

  • Because of this library's dependency on androidx.biometric:biometric:1.0.0 it can cause transitive dependency resolution to change on certain version of React Native and androidx.swiperefreshlayout may no longer be able to be resolved. This can be fixed by adding an explicit dependency on the library in your android/app/build.gradle:

    dependencies {
        implementation fileTree(dir: "libs", include: ["*.jar"])
        implementation "com.facebook.react:react-native:+"  // From node_modules
        implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" // temp fix
        ...
    }
    
  • There is a known issue on the iOS 13.x simulators where keys generated with access control flags cannot be queried and found properly. This results in key not found errors in biometricKeysExist and createSignature on those simulators. However, it works correctly on actual devices running iOS 13.

react-native-biometrics's People

Contributors

albertbuchard avatar dgasch512 avatar fguitton avatar gedu avatar jasonmerino avatar jayfunk avatar jinshin1013 avatar mitchiemt11 avatar modenl avatar nappypirate avatar saeedzhiany avatar sandrodahl avatar whitedogg13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-biometrics's Issues

null is not an object (evaluating 'ReactNativeBiometrics.isSensorAvailable')

import React, {Component} from 'react';
import {View, Text} from 'react-native';
import Biometrics from 'react-native-biometrics';

export default class App extends Component {

  componentDidMount = () => {
    console.log(Biometrics);
    Biometrics.isSensorAvailable().then(biometryType => {
      if (biometryType === Biometrics.TouchID) {
        console.log('TouchID is supported');
      } else if (biometryType === Biometrics.FaceID) {
        console.log('FaceID is supported');
      } else {
        console.log('Biometrics not supported');
      }
    });
  };

  render() {
    const text = 'Testing';
    return (
      <View style={{alignItems: 'center', justifyContent: 'center'}}>
        <Text> {text} </Text>
      </View>
    );
  }
}

TypeError: null is not an object

Hi,

After upgrading to version 2.1.2, I started getting the error "TypeError: null is not an object (evaluating 'bridge.isSensorAvailable')", how can i fix? For now, I made a downgrade and I'm using version 2.1.1.

Best regards,
Marcos Vaz.

iOS Crash

Hey,

I am getting a crash on iOS with an error Thread: signal SIGABRT. Basically a thread that runs the package crashes. My app works on android. I am running the package on react-native 0.59.8.

Here is my stack trace.

(
0 CoreFoundation 0x0000000115ebc1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000114fe6735 objc_exception_throw + 48
2 CoreFoundation 0x0000000115ebc015 +[NSException raise:format:] + 197
3 LocalAuthentication 0x0000000117092a08 __50-[LAContext evaluatePolicy:localizedReason:reply:]_block_invoke + 113
4 LocalAuthentication 0x0000000117092c56 __50-[LAContext evaluatePolicy:localizedReason:reply:]_block_invoke.108 + 16
5 libsystem_trace.dylib 0x000000011774d742 _os_activity_initiate_impl + 53
6 LocalAuthentication 0x000000011709290b -[LAContext evaluatePolicy:localizedReason:reply:] + 307
7 RentProfile 0x000000010f0f560a __56-[ReactNativeBiometrics simplePrompt:resolver:rejecter:]_block_invoke + 182
8 libdispatch.dylib 0x0000000117454595 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x0000000117455602 _dispatch_client_callout + 8
10 libdispatch.dylib 0x0000000117458064 _dispatch_queue_override_invoke + 1028
11 libdispatch.dylib 0x000000011746600a _dispatch_root_queue_drain + 351
12 libdispatch.dylib 0x00000001174669af _dispatch_worker_thread2 + 130
13 libsystem_pthread.dylib 0x000000011783e6b3 _pthread_wqthread + 583
14 libsystem_pthread.dylib 0x000000011783e3fd start_wqthread + 13
)

Would appreciate some help with this.

Having trouble verifying signature with public key on the NodeJS side

I saw this post already:
#21

And their proposed solution was right here:
https://gist.github.com/lkdocs/6519372

I am using the node-rsa package right now to try to mimic what they are doing but I keep getting into this issue where it's like invalid ASN1 Error. Is there an example of this being done on the Node JS side?

I am getting that error on the first step of importKey:

const pubKey = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAynY5oEuJ0/qv3KPZWJdcfUGIIBNWq30NnUS201XyV4B1aP7lTO+TrlDiWsWLon+JDd5H30/NS0dihQoxWXgco4l1xiRotgaDT9p1FlVeNm/z49Ybb0zOxMhDy950Y4TwjyP03PJAV7FqdHbJNlTnmoWpHW8JdzJP4DfzXAQdnq9SIG+fARo+2W+NxTYpH2meby1PdrBjEAiqc/nguJj4u/RC2Utol+cGEZoSfSjuVzHLEcNpjYGXRi/432GpCgWeSTbft+qv3ei/R1GrLya8P5k2426w6eI1OPR4p/Cw+PwRcM+J28NMgH5pPwRWkVletGuivIwxzXgdDgYlHlRGewIDAQAB`
const key = new NodeRSA();
const signer = key.importKey(pubKey, ‘pkcs1-public-pem’);

createSignature doesn't open prompt on iOS 13.1

I am calling "Biometrics.createSignature('Please authenticate to proceed.', payload)" in componentDidMount function but it doesn't open alert for biometric authentication but when I touch fingerprint button then it appears for authentication.
I have faced this issue in library version 1.6.0 and updated to 1.7.0 but still facing same.

App crashes on certain devices

Hello,

This package causes the app to crash on certain devices. I'll put the list below. Thanks 😄

Samsung Galaxy J4+ (SM-J415FN)
Samsung Galaxy J3 2017 (SM-J330FN)
Samsung A3 2015 (SM-A300FU)

What happen if Private key already exist ? + Multi account ?

Hello,
I'm wondering, if a user already created a keypair :

  Biometrics.createKeys('Confirm fingerprint in order to activate it')
          .then((publicKey) => {
            console.log(publicKey)
          })

The next time he do that, if the key already exist, how does your lib works ? Does it create a new_publicKey and keep the private one on the keychain ? Or does it modify both ?
Sorry for the small issues, not usefull, but I just would like to know...

Moreover, how does it works in case of multi account on the same device ?
Let's say, I'm connect with my account A, I'm activating touchID on my application, it's creating a first keypair. Then I loggout, and one of my friend's connecting to his account B, and activate touchID. How does the Biometrics will know which private key to use when creating a new signature with encrypted data...?

The public key stored doesn't match with signature

I am trying to use this biometrics but after I've created and stored the public key, it never matches with the signature generated afterward with the same finger. How can I verify the fingerPrint?

Test Code:

  registerFingerPrint = () => {
    Biometrics.isSensorAvailable()
    .then((biometryType) => {
      if (biometryType === Biometrics.TouchID) {
        Biometrics.createKeys('Confirm fingerprint')
        .then((publicKey) => {
          console.log("create", publicKey)
          this.setState({
            create: publicKey
          })
        })
      } 
    })
  }

  fingerPrintCheck = () => {
    Biometrics.createSignature('Sign in', payload)
    .then((signature) => {
      if (this.state.create === signature){
        console.log("success");
      }else {
        console.log('failure'); //always returns failure here
      }
    })
  }

  render() {
    return (
      <View style={styles.container}>

        <TouchableHighlight onPress={()=> this.registerFingerPrint()}>
          <Text style={{ marginBottom: 10}}>
            Register
          </Text>
        </TouchableHighlight>

        <TouchableHighlight onPress={()=> this.fingerPrintCheck()}>
          <Text>
            Authenticate with Biometrics
          </Text>
        </TouchableHighlight>
      </View>
    );
  }
}

deleteKeys() returned warning if not key set before

Hello just saw a warning.
It's actually not a issue, or bug report (maybe ?), it's just that I wanted to share it to the owner of this repository.
I'm doing a deleteKeys() as soon as the user logout on my app. It appears that deleteKeys() was returning this warning if no private key was set before.
See below :

Capture d’écran 2019-07-03 à 14 17 21

I just added a check to don't call this method if not needed on my code on my side.
Maybe, would be worth to add a check on the lib directly... ?

Thank you,

Error on android

Ok so to test this I made a brand new application and tried this lib and it works great.
Then I installed this into our app and then get this error.

Possible Unhandled Promise Rejection (id: 0):
06-15 17:55:38.323 13994 14660 W ReactNativeJS: Error: Error generating signature
06-15 17:55:38.323 13994 14660 W ReactNativeJS: createErrorFromErrorData@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2106:26
06-15 17:55:38.323 13994 14660 W ReactNativeJS: http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2058:51
06-15 17:55:38.323 13994 14660 W ReactNativeJS: __invokeCallback@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2625:23
06-15 17:55:38.323 13994 14660 W ReactNativeJS: http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2356:34
06-15 17:55:38.323 13994 14660 W ReactNativeJS: __guard@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2529:15
06-15 17:55:38.323 13994 14660 W ReactNativeJS: invokeCallbackAndReturnFlushedQueue@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2355:21
06-15 17:55:38.323 13994 14660 W ReactNativeJS: invokeCallbackAndReturnFlushedQueue@[native code]

[Question] What happens if user creates new fingerprint?

Sorry for posting questions here, but from what I understand in the README, this library creates a key pair and stores it on the phone, and just uses the fingerprint to access the private key, which could remain the same if the user changes the fingerprint, right?

nice work with the library btw, cheers 🍺

"Fingerprint not recognized" Problem

I can't set new biometric registry, I want to add new fingerprint but the input fingerprint only authorize the given fingerprint in the security. Which basically only allows the owner of the device to use it...

createSignature doesn't open prompt

So I am doing this in the code:

const result = await Biometrics.createSignature('Confirm Fingerprint', '');

I log the result and I get a signature coming back. However according to the docs when I call that function, I should get a prompt for fingerprint. And I don't get that. I don't see any errors either. It just automatically and successfully gives me the signature. Oddly enough, if I use the simplePrompt function and createKeys function, the prompt shows up.

I am testing this on the an iOS simulator. I also tried to copy the exact same code the example has in the docs and I still can't get this prompt to show up. What am I doing wrong?

Error displaying local biometric prompt on Sumsung

Couple Samsung users have

Error displaying local biometric prompt: must have com.samsung.android.bio.face.permission.USE_FACE or android.permission.USE_BIOMETRIC permission.

That happens when in Preferred biometric is selected Face recignition.

Any ideas how to fix it?

Properly Identify Failed Fingerprint vs Cancel

So I am using the library and when I click cancel on the fingerprint prompt or failed the fingerprint prompt, it gives the same error making them indistinguishable:

Could not confirm fingerprint

Maybe I am not looking hard enough, but is there a way for me to distinguish these errors. I want to show something on fingerprint failure, but nothing on cancel.

Not able to verify signature using public key in java

I am trying to verify biomatric signature using the code in java with public key not not able to verify .
Please help me to know which algorithm i should use.
Below are sample

PUBLIC KEY 001

MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRAOJkDdfryjDUIl11coCPok25bCW8K7GhrxHA9tC7GUmuWPZtAGN+Nf25E8SV8BZRRx7T0p26IShzwcP5mHYJczERy7s3DDqrsAnmf2YFAv7VYYibSGhmvVBPJCWbt5SsiP5WhskUOvc/96LRKt6N2ubaH/0UN59VtWIIy0FoZdi6lhyqbFFTV/IfTT1m7UspRz8MtXtS5bahurwLtYGw173rxQ2MXZWyGgVUv75lQ3KdPV59eTMXwwmzVTBvkA5pyq/yn+Kc3xzzEj8uafaUpl9y9yjfdAY+T+dRKsrEhEkmITcl1kj9G5nID1rSJCG9VVP+6dtwK6KqKeIYf9lwIDAQAB

CERTIFICATE 001

lO1qCyAL9cGgor3tgclwLQm8o7OBnvTM9rR3HlLyhCyclprDp1Z01nA7LmN1prClE5PjBGNSUKREssRv42lGmutTNkgDrzRG+sMPraVjw5eJUqEHTpp9E122pHpp1W1pCV6kQBtFXigZe9h5Vms/fUmieK9jkmzmJfJOv28KnDMmAGIFEyTmkZ0/PeVfOldmF6xsjsownZKiIVnw6ZZgEIUG6yTe2gA6Xh174uNP9HuDI2KgivhXWOoxyiE0U+Ri9lccXn40iKoVe5m+SD0TRFepSHf//GdXi0t7WtYMbTTG48ots7gfcctafoRE4PBn6jbg/R5RIkCrj7m+U9X3jw==

JIExsj8aLTRUM0OVfoBPaKR2h4oqtEDUo5NPy6EsAAYnsVvGHERCikl1ctTv2k3RHcgZUqmdcCfT2Uekxi3efblFLdB5Mvjl8Ju+RXRNZT5813GLahhtDjgiAM3W4pTxIAsRFbsNPY0O4NfKQXqDYcReI+7P+nR/QzmM5SIB2cc+k+nrcPpGA6gihyrY++se7itPz/ImG8fL6QdZdyD5i5gZAWVXhZTeEdLOOKGDIzPsxUBTIwJm4B+saBwj+sfa48w47ueLPDnU6ayGqsFE3mOZmV6L+EoTJT7R9WIKNFa3QGfxD/bew6zfWoms4qx/hI+TdxxgTfTOc/lRtVlrgg==

LJMTn1IwmyxyFfeNxOCcWrsCFwdJY8ANQ5iyzfgPn2Y1rs/e5xzO011867k5uBV25MvY+6WhF51QjdIxuRw8DzalXrsGRtN62rfYrQDqX/VErjaQEDG5YkV3tc/zhGbjhLJtUpvbwnXyHA+LI96MNQTEPXDwwNmEKMN7Ia8xIi/5fuNYbc0aLM6r9c63tD8u5l3K8tAkVByWHKcRfrYXL4sxL7hGQSOFtnCEDRPud9J9SNHpD4OcqpvzVKwFOHMHssKo3MCsAhVkTFkIohQoj5d812h1HWixxshilErIIQvuWhjBhkbbSrREk1FTYtlkh+nh0f8CqGSpy+sbxVYfUw==

iOS Fallback Option?

Possible to configure the fallback option "Enter Passcode" such as Enable or Disable?
If Enable, maybe a callback?

Android X support ?

I am actually not entirely sure whether all the libraries need to opt into using AndroidX to support [email protected] nor how hard it is for a library to support it. I haven't got a chance to upgrade the project to use [email protected] to test out things but could you have a look into updating the library to use AndroidX?

Readme - installation have wrong Android class

Open up android/app/src/main/java/[...]/MainActivity.java
Add import com.rnbiometrics.ReactNativeBiometricsPackage; to the imports at the top of the file
Add new ReactNativeBiometricsPackage() to the list returned by the getPackages() method
Append the following lines to android/settings.gradle:

it's not realling MainActivity.java the class where you should add the import and where getPackages is, but MainApplication

Not Detecting face Recognition sensor

I am trying to check if face recognition and fingerprint is available in a phone or not by the below code:

 Biometrics.isSensorAvailable()
        .then((biometryType) => {

                
                if (biometryType === Biometrics.TouchID) {
                    console.log('fingerprint')
                    this.setState({ finger: true })
                }

                if (biometryType === Biometrics.FaceID) {
                    console.log('face Recognition')
                  this.setState({ false: true })
              } 
            })

Its working fine in case of finger print but unable to detect face recognition sensor.
I have tested it in android (Samsung S10 Plus).

"react": "16.9.0",
"react-native": "0.61.2",
"react-native-biometrics": "^1.6.1"

Ts definitions

Would be nice to have TS definitions file so we can have autocomplete

How to use 2.0.0 in Typescript?

I use 2.0.0 version and not understand, how to import and use react-native-biometrics in Typescript?

Please, write a simple example, how import and use any function.

Thanks

App crashes on rooted phone

Hello,

I'm having issues with the package on rooted phones. The Biometrics.isSensorAvailable() function crashes the app as soon as the app starts. Can you look into it please ?

iOS13 random timeout when showing TouchID pop-up

After updating my iPhone to iOS13 the TouchID pop-up sometime rises after random timeout.
Sometime pop-up rises only after touching the TouchID sensor.
Timeout is random - from almost 0 to seconds.

Error detecting fingerprint availability - [Android]

Hello, I got this issues in my tracker related to this repository apparently.
Error detecting fingerprint availability it's only occurring on Android on devices which looks to doesn't have Fingerprints feature, most of them (more than 65% are Samsung devices).

But since I'm using the method isSensorAvailable it shouldn't throw an error, isn't it ?

Thanks for the help, or advices.

isBiometricKeyExists

please add some method to check if key was generated and stored before calling createSignature

Could not find aapt2-proto.jar

Hey I wanna record this issue, I already created a PR for this

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-biometrics'.

Could not resolve all artifacts for configuration ':react-native-biometrics:classpath'.
Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar

Only have to change the order of google() and jcenter() to make this work. I will be using my fork until you merge this

#29

Thanks

Not able to cancel in display fingerprint

Hi,

Thanks for your recent release, It works pretty well in most scenarios, however, I cant see the cancel button if the device has an in-display fingerprint (I am using OnePlus 6T). It seems to be after trying out version 2.1.1, i was able to cancel the in-display fingerprint in previous version [1.6.*].

could you please clarify if this was removed intentionally or more of a bug?

Thanks again.
Cheers.

Method to encrypt value using public key or private key (more flexible createSignature)

I know this is the package that is aimed to be used for sending the public key to the server. But this time, i just want to use this to encrypt and store many other things.

So i wish we can have the

publicKeyEncryptMessage(payload,publicKey)
privateKeyEncryptMessage(payload,promptMessage)
publicKeyDecryptMessage(encryptedPayload,publicKey)
privateKeyDecryptMessage(encryptedPayload,promptMessage)

since the algorithm to encrypt and decrypt is the same for RSA, then we can just simplify to

processPublicKey(payload,publicKey) 
processPrivateKey(payload, promptMessage) 

and all of them return the value after RSA process.

So we can have a library that use the biometrics for anything we want to make it secure and not only limited to the scenario that the public key must be stored in server.

Custom Dialog

Hello, I want to ask about how to custom prompt dialog view ? Thanks

Suggestion: Simple authenticate() method.

First things first, the lib looks awesome and the public/private keys are great, thank you for releasing it for the public!

Haven't tried it yet (still researching the subject), but I have a small suggestion which will make it much more versatile. A simple method authenticate() (similar to the one found in react-native-touch-id lib) would be very helpful. Thus, I'll be able to use the lib in many ways. I have use cases where just a simple "confirmation" is required, and being able not to contact the server for such wold be awesome.

Unable to run

Loading dependency graph, done.
error: bundling failed: Error: While trying to resolve module react-native-biometrics from file //Documents/GitHub//class/biometrics.js, the package /Documents/GitHub//node_modules/react-native-biometrics/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users//Documents/GitHub//node_modules/react-native-biometrics/build/cjs/index.js. Indeed, none of these files exist:

  • /Users//Documents/GitHub//node_modules/react-native-biometrics/build/cjs/index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  • /Users//Documents/GitHub//node_modules/react-native-biometrics/build/cjs/index.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
    at ResolutionRequest.resolveDependency (/Users//Documents/GitHub//node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:65:15)
    at DependencyGraph.resolveDependency (/Users//Documents/GitHub//node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
    at Object.resolve (/Users//Documents/GitHub//node_modules/metro/src/lib/transformHelpers.js:264:42)
    at dependencies.map.result (/Users//Documents/GitHub//node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31)
    at Array.map ()
    at resolveDependencies (/Users//Documents/GitHub//node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)
    at /Users//Documents/GitHub//node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33
    at Generator.next ()
    at asyncGeneratorStep (/Documents/GitHub//node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
    at _next (//Documents/GitHub//node_modules/metro/src/DeltaBundler/traverseDependencies.js:107:9)

Call back issue in createSignature.

after the verification of my fingerprint then cancel the dialog. It gives an error

The callback createSignature() exists in module ReactNativeBiometrics, but only one callback may be registered to a function in native module

SDK Target expiring soon

Google Play will soon require that apps target API level 26 or higher. This will be required for new apps in August 2018, and for updates to existing apps in November 2018

In the second half of 2018, Google Play will require that new apps and app updates target API level 26 or higher. This will be required for new apps in August 2018, and for updates to existing apps in November 2018. Configuring your app to target a recent API level ensures that users benefit from significant security and performance improvements, while still allowing your app to run on older Android versions (down to the minSdkVersion). This lint check starts warning you some months before these changes go into effect if your targetSdkVersion is 25 or lower. This is intended to give you a heads up to update your app, since depending on your current targetSdkVersion the work can be nontrivial. To update your targetSdkVersion, follow the steps from "Meeting Google Play requirements for target API level", https://developer.android.com/distribute/best-practices/develop/target-sdk.html Issue id: ExpiringTargetSdkVersion More info: https://support.google.com/googleplay/android-developer/answer/113469#targetsdk https://developer.android.com/distribute/best-practices/develop/target-sdk.html

[Question] How can i get public key without having to authenticate by fingerprint?

Ok, so i'm trying to figured out how to get public key and store it inside keystore without having to use biometric authentication. I just want to get it just when user's device is capable of biometrical authentication (has a fingerprint scanner or so) but without prompt for fingerprint. It's a case when i'd like to sent public key (at the begging - let's say at registration process) onto my server, and left choice for using biometric auth for user whenever he needs it (or have set it in settings menu).
Thanks

Btw. very useful lib, thank you!

Storing custom values

Hi

Is it correct, that this library is only for creating and storing public/private key pairs and doesn't support storing custom values like a hashed pin code? I was looking for something like react-native-keychain, but it turns out, it doesn't support Android biometrics.

Best regards
Jens

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.