Skip to content

A lightweight npm package for generating secure 6-digit one-time passwords (OTP) for authentication and verification purposes.

License

Notifications You must be signed in to change notification settings

kavingovind/generate-one-time-password

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate One Time Password(OTP)

A lightweight npm package for generating one-time passwords (OTP) with adjustable lengths between 4 and 12 digits, ideal for authentication and verification.

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();
console.log(otp); // 490605

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

const otpcode = generateOTP(8);
console.log(otpcode); // 24837554

API Reference

Generate a random OTP number with a length between 4 and 12 digits.

Function Arguments Default Value Type Description
4 - 12 6 Optional The 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

About

A lightweight npm package for generating secure 6-digit one-time passwords (OTP) for authentication and verification purposes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published