npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@carlossts/rtn-local-authentication

v1.0.3

Published

Local authentication with Turbo Modules

Downloads

3

Readme

rtn-local-authentication

rtn-local-authentication is a local authentication library for React Native, built using Turbo Modules. It provides an interface for biometric and PIN authentication on Android devices.

Features

  • Support for fingerprint, PIN, and pattern authentication on Android.
  • Fully compatible with React Native's Turbo Module system.
  • Simple API to integrate local authentication into your React Native application.

Installation

Prerequisites

Ensure your React Native project is properly configured to use Turbo Modules. For more details, follow the official React Native Turbo Modules documentation.

If your version of react-native does not support turbo-modules, I recommend https://github.com/tradle/react-native-local-auth

Install the package

npm install @carlossts/rtn-local-authentication
or
yarn add @carlossts/rtn-local-authentication

UI

authenticate method

fingerprintOrPin PIN fingerprintOrPattern pattern

isDeviceSecure method

isDeviceSecure

API Reference

Methods

authenticate(map: { reason?: string; description?: string }): Promise<string>()

Local device authentication process (using password, PIN, pattern or fingerprint), verifying that the device is protected by some security method, such as a password or biometrics.

Observation: If the device does not have local authentication, return success with the code WITHOUT_AUTHENTICATION.

Options

| Option | Description | | --------------------- | ------------------------------------------------- | | reason | Action title | | description | Action description |

Usage

import React, { useCallback, useEffect } from 'react';
import { Alert, View } from 'react-native';
import {RNTLocalAuthentication} from '@carlossts/rtn-local-authentication';

const App = () => {
  const authenticationLocal = useCallback(async () => {
    try {
      await RNTLocalAuthentication.authenticate({
        reason: 'Please authenticate yourself',
        description: 'Enter your password or fingerprint',
      });
    } catch (error) {
      Alert.alert('Authentication Failed', error.message);
    }
  }, []);

  useEffect(() => {
    authenticationLocal();
  }, [authenticationLocal]);

  return <View />;
};

export default App;

ErrorCode

| Code | Description | | --------------------- | ------------------------------------------------- | | E_AUTH_CANCELLED | User canceled the authentication | | E_ONE_REQ_AT_A_TIME | Authentication already in progress | | E_FAILED_TO_SHOW_AUTH | Failed to create authentication intent |

isDeviceSecure(): Promise<boolean>

Checks if the device has some type of authentication.

Usage

import React, { useCallback, useEffect } from 'react';
import { Alert, View } from 'react-native';
import {RNTLocalAuthentication} from '@carlossts/rtn-local-authentication';

const App = () => {
  const isDeviceSecure = useCallback(async () => {
    try {
     const result = await RNTLocalAuthentication?.isDeviceSecure();
    Alert.alert('Is it a secure device ?', result ? 'Yes' : 'No');
    } catch (error) {
      Alert.alert('isDeviceSecure Failed', error.message);
    }
  }, []);

  useEffect(() => {
    isDeviceSecure();
  }, [isDeviceSecure]);

  return <View />;
};

export default App;

License

MIT