react-native-totp-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

react-native-totp-utils

A full-featured Time-Based One-Time Password (TOTP) library for React Native, providing functions for generating and validating OTP codes.

Features

  • [X] New Architecture Support
  • [X] Written in C++
  • [X] Generate Secret Key
  • [X] Generate OTP
  • [X] Validate OTP
  • [X] JSI Implementation

Installation

Using npm:

npm install react-native-totp-utils

Using yarn:

yarn add react-native-totp-utils

Usage

import {
  generateOTP,
  generateSecretKey,
  validateOTP,
  formatSecretKey,
  formatOTP,
} from 'react-native-totp-utils';

// ...

const secretKey = generateSecretKey(); // ABCDABCDABCD

const otp = generateOTP(secretKey); // 123456

const isValid = validateOTP(secretKey, otp); // true

const formattedSecretKey = formatSecretKey(secretKey); // ABCD-ABCD-ABCD-ABCD

const formattedOTP = formatOTP(otp); // 123 456

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Package Sidebar

Install

npm i react-native-totp-utils

Weekly Downloads

17

Version

1.0.5

License

MIT

Unpacked Size

74.2 kB

Total Files

41

Last publish

Collaborators

  • 4cc3ss