0.2.0 • Published 12 days ago

generate-one-time-password v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

Generate One Time Password(OTP)

A lightweight npm package for generating either 4 or 6 digits one-time passwords (OTP) for authentication and verification purposes.

Installation

$ npm install generate-one-time-password --save

or

$ yarn add generate-one-time-password

Usage

import { generateOTP } from "generate-one-time-password";

const otp = generateOTP(6);
console.log(otp); // 490605

const otpcode = generateOTP(4);
console.log(otpcode); // 3075

API Reference

Generate a random OTP number with either 4 or 6 digits.

Function ArgumentsDefault ValueTypeDescription
4 or 66OptionalThe number of digits in a one-time password (OTP). If no option is specified, the OTP will be 6 digits long.

License

MIT License

Authors