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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kruglyanski/react-native-secure-pin-code

v0.1.1

Published

Secure PIN code screen with biometric authentication for React Native (JS-only, New Architecture compatible)

Readme

React Native Secure PIN Code

A secure, customizable PIN code solution for React Native with optional biometric authentication and built-in lockout protection.

This library provides:

secure PIN storage

automatic lockout after failed attempts

optional Face ID / Touch ID authentication

a ready-to-use PIN screen

a small, stable, forward-compatible API

The library is designed to be safe by default and suitable for production use.

Installation

Install the package:

yarn add @kruglyanski/react-native-secure-pin-code

or

npm install @kruglyanski/react-native-secure-pin-code

Install required native dependencies:

yarn add react-native-keychain react-native-biometrics react-native-device-info

Then install iOS pods:

cd ios && pod install

@kruglyanski/react-native-secure-pin-code

A secure, customizable PIN code solution for React Native with biometric authentication support.

This library provides a ready-to-use PIN screen, secure storage, lockout protection, and biometric login, while allowing full control over UI customization.

Installation

Install the package:

yarn add @kruglyanski/react-native-secure-pin-code or npm install @kruglyanski/react-native-secure-pin-code

Install required native dependencies:

yarn add react-native-keychain react-native-biometrics react-native-device-info

Then install iOS pods:

cd ios && pod install


Features

  • Secure PIN storage using native keychain
  • Configurable PIN length (4–8 digits)
  • Lockout after multiple failed attempts
  • Biometric authentication (Face ID / Touch ID / Android Biometrics)
  • Fully customizable UI
  • Clean Provider + Hook API
  • Works with the New Architecture
  • Written in TypeScript

Important Usage Rule

⚠️ SecurePinProvider is required

Both:

  • useSecurePin
  • SecurePinScreen

MUST be rendered inside SecurePinProvider.

The hook and the screen will NOT work outside the provider.


SecurePinProvider

The provider is responsible for:

  • PIN storage
  • Attempt counting
  • Lock timers
  • Biometric authentication
  • Global PIN state

SecurePinProvider props

  • children
    Your application content.

  • maxAttempts (optional)
    Maximum number of allowed failed PIN attempts before lock.
    Default: 3

  • lockDurationSec (optional)
    Lock duration in seconds after exceeding max attempts.
    Default: 30

  • biometryPromptText (optional)
    Text shown in biometric authentication prompt.

  • biometryPromptCancelText (optional)
    Cancel button text in biometric prompt.

  • showBiometrics (optional)
    Enables biometric login availability.
    Default: true


useSecurePin Hook

The hook provides access to PIN state and actions.

Returned API description

  • hasPin
    Indicates whether a PIN is already set.
    true, false, or null while loading.

  • isLocked
    Whether PIN input is currently locked.

  • lockUntil
    Timestamp (ms) when the lock will be released, or null.

  • attemptsLeft
    Number of remaining attempts before lock.

  • setPin(pin)
    Saves a new PIN securely.

  • checkPin(pin)
    Verifies the entered PIN.

  • loginWithBiometrics()
    Attempts biometric authentication.

  • deletePin()
    Removes the stored PIN.


SecurePinScreen

A fully controlled UI component that handles:

  • PIN creation
  • PIN confirmation
  • PIN verification
  • Lock state UI
  • Error and status messages

SecurePinScreen props

Behavior

  • pinLength
    Length of the PIN.
    Supported values: 4–8

  • onSuccess
    Called when PIN is successfully created or verified.

  • onPressForgetPin
    Required callback for "Forgot PIN" action.

  • allowFontScaling
    Enables or disables font scaling.
    Default: true


Text customization

  • titleSet
    Title shown when creating a PIN.

  • titleEnter
    Title shown when entering a PIN.

  • enterMessage
    Message shown on PIN entry screen.

  • createMessage
    Message shown on PIN creation screen.

  • confirmMessage
    Message shown on PIN confirmation screen.

  • doNotMatchMessage
    Message shown when PINs do not match.

  • lockedMessage
    Message shown when input is locked.

  • wrongPinMessage
    Function returning message when PIN is incorrect.
    Receives attemptsLeft.

  • textDescriptionLockedPage
    Main lock screen description.

  • textSubDescriptionLockedPage
    Secondary lock screen description.

  • exitButtonText
    Text for exit / logout button on lock screen.


Style customization

  • containerStyle
  • titleStyle
  • subtitleStyle
  • lockTextStyle
  • keyPadStyle
  • keyStyle
  • keyTextStyle

All style props accept standard React Native style objects.


UI customization

  • eraseComponent
    Custom component for the erase (backspace) button.

Dependencies

This library relies on the following native dependencies:

  • react-native-keychain
  • react-native-biometrics
  • react-native-device-info

They must be installed and properly linked in your project.


Platform Support

  • iOS
  • Android

Supports the New Architecture.


License

MIT © Roman Kruglyanski