react-native-otplib
v1.0.0
Published
A React Native library for handling OTP (One-Time Password) functionality with CryptoJS implementation
Maintainers
Readme
react-native-otplib
A React Native library for handling OTP (One-Time Password) functionality, supporting both TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password).
Installation
npm install react-native-otplib
# or
yarn add react-native-otplibUsage
import { generateTOTP, verifyTOTP } from 'react-native-otplib';
// Generate a TOTP token
const token = generateTOTP('your-secret-key');
// Verify a TOTP token
const isValid = verifyTOTP('your-secret-key', 'user-input-token');Features
- TOTP (Time-based One-Time Password) generation and verification
- HOTP (HMAC-based One-Time Password) generation and verification
- Customizable token length and time window
- TypeScript support
- React Native compatible
License
MIT
