otp-generator-random
v1.0.0
Published
A lightweight npm package to generate random One-Time Passwords (OTPs) of a specified length.
Downloads
10
Maintainers
Readme
otp-generator-random
A lightweight npm package to generate random One-Time Passwords (OTPs) of a specified length.
Installation
You can install otp-generator-random
using npm or yarn:
npm install otp-generator-random
or
yarn add otp-generator-random
Usage
const generateOTP = require("otp-generator-random");
// Generate a 6-digit OTP
const otp = generateOTP(6);
console.log("Generated OTP:", otp);
API
generateOTP(size: number): string
Generates a random OTP of the specified size
.
size
: The length of the OTP to generate.
Returns the generated OTP as a string.
Example
const generateOTP = require("otp-generator-random");
const otp = generateOTP(8);
console.log("Generated OTP:", otp);