Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-local-authentication

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-local-authentication

Local authentication for react native, supports iOS only.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-local-authentication

Local authentication for react native, supports iOS only. See iOS Local Authentication Document

Install

npm i --save react-native-local-authentication
react-native link react-native-local-authentication

Usage

setLocalizedFallbackTitle(title)

Set fallback button title.

setLocalizedCancelTitle(title)

Set cancel button title.

canEvaluate(policy)

Determines if a particular policy can be evaluated.

Parameters
  • policy

The policy to evaluate.

see LAPolicy

Response

Successful

see LABiometryType

  • none: No biometry type is supported.
  • touchID: The device supports Touch ID.
  • faceID: The device supports Face ID.

Failed

  • code: see LAError
  • message: error message

evaluate(policy, localizedReason)

parameters
  • policy

Policy for which the preflight check should be run.

  • localizedReason

Policy for which the preflight check should be run.

Response

Successful

return true

Failed

  • code: see LAError
  • message: error message

invalidate()

Invalidates the context.

LAError

error code

Example

import RNLocalAuthentication, { LAError, LABiometryType } from 'react-native-local-authentication';

async _evaluate() {
  try {
    const biometryType = await RNLocalAuthentication.canEvaluate();
    if (biometryType && (biometryType === LABiometryType.touchID || LABiometryType.faceID)) {
      const result = await RNLocalAuthentication.evaluate(1, biometryType === LABiometryType.touchID ? 'Evaluate Touch ID' : 'Evaluate Face ID');
      console.log('evaluate', result ? 'evaluate successful' : 'evaluate failed');
      Alert.alert('evaluate', result ? 'successful' : 'failed');
    } else {
      Alert.alert('Can not evaluate', biometryType);
    }
  } catch (e) {
    console.log('evaluate', e.code, e.message, e);
    if (parseInt(e.code) === LAError.LAErrorTouchIDNotAvailable) {
      Alert.alert('Error', 'device does not support touch ID or face ID');
    } else {
      Alert.alert('Error', e.message);
    }
  }
};

Keywords

FAQs

Package last updated on 01 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc