otp-generator-module
v1.0.2
Published
A simple and flexible OTP (One-Time Password) generator module for JavaScript and TypeScript. Supports numeric, alphabetic, and special character combinations with customizable options.
Maintainers
Readme
🔐 OTP Generator Module
A simple and flexible OTP (One-Time Password) generator module for JavaScript and TypeScript. Supports numeric, alphabetic, and special character combinations with customizable options.
📦 Installation
npm install otp-generator-moduleUsage 🛠️
import { generateOTP } from 'otp-generator-module';
// 1️⃣ Default 4-digit numeric OTP
console.log(generateOTP()); // e.g., '3847'
// 2️⃣ 6-digit numeric OTP
console.log(generateOTP({ length: 6 }));
// 3️⃣ 6-digit with lowercase alphabets
console.log(generateOTP({ length: 6, alphabets: true }));
// 4️⃣ 6-digit with uppercase letters
console.log(generateOTP({ length: 6, upperCase: true }));
// 5️⃣ 6-digit with special characters
console.log(generateOTP({ length: 6, specialChars: true }));
// 6️⃣ 6-digit with alphabets + uppercase
console.log(generateOTP({ length: 6, alphabets: true, upperCase: true }));
// 7️⃣ 6-digit with alphabets + special characters
console.log(generateOTP({ length: 6, alphabets: true, specialChars: true }));
// 8️⃣ 6-digit with uppercase + special characters
console.log(generateOTP({ length: 6, upperCase: true, specialChars: true }));
// 9️⃣ 6-digit with alphabets + uppercase + special characters
console.log(generateOTP({ length: 6, alphabets: true, upperCase: true, specialChars: true }));License 📜
MIT License.
