1.0.2 • Published 6 months ago
@pradeep21108/gen-otp v1.0.2
gen-otp
A simple utility function to generate numeric OTPs (One-Time Passwords) of length 4, 6, or 8.
🚀 Installation
npm install @pradeep21108/gen-otp
const genOtp = require('@pradeep21108/gen-otp');
const otp4 = genOtp(4); // e.g., '1234'
const otp6 = genOtp(6); // e.g., '654321'
const otp8 = genOtp(8); // e.g., '98765432'
console.log(otp6); // Outputs a 6-digit OTP
function genOtp(length = 6) => string
genOtp(5); // ❌ Error: Length must be 4, 6, or 8