UNPKG

otpgeneratorpro

Version:

An advanced OTP generator with customizable features.

84 lines (58 loc) 2.2 kB
# Advanced OTP Generator An advanced OTP generator package with customizable options. ## Installation ```bash npm install otpgeneratorpro const { generateOtp } = require('otpgeneratorpro'); // Generate a simple OTP with default settings const otp = generateOtp(); console.log(`Generated OTP: ${otp}`); ##Custom OTP Length Generate an OTP of a specified length (e.g., 8 characters): const { generateOtp } = require('otpgeneratorpro'); // Generate an OTP of length 8 const otp = generateOtp(8); console.log(`Generated OTP of Length 8: ${otp}`); ##Custom OTP Options Generate an OTP with custom options (e.g., including only digits and lowercase alphabets): const { generateOtp } = require('otpgeneratorpro'); // Generate an OTP with custom options const otp = generateOtp(6, { digits: true, lowerCaseAlphabets: true, upperCaseAlphabets: false, specialChars: false }); console.log(`Generated Custom OTP: ${otp}`); ## demonstrating const { generateOtp } = require('otpgeneratorpro'); // Generate a simple OTP with default settings const defaultOtp = generateOtp(); console.log(`Generated Default OTP: ${defaultOtp}`); // Generate an OTP of length 8 const length8Otp = generateOtp(8); console.log(`Generated OTP of Length 8: ${length8Otp}`); // Generate an OTP with only digits const digitsOnlyOtp = generateOtp(6, { digits: true, lowerCaseAlphabets: false, upperCaseAlphabets: false, specialChars: false }); console.log(`Generated Digits Only OTP: ${digitsOnlyOtp}`); // Generate an OTP with digits and lowercase alphabets const digitsAndLowercaseOtp = generateOtp(8, { digits: true, lowerCaseAlphabets: true, upperCaseAlphabets: false, specialChars: false }); console.log(`Generated Digits and Lowercase Alphabets OTP: ${digitsAndLowercaseOtp}`); // Generate an OTP with all character types but of length 12 const fullFeatureOtp = generateOtp(12, { digits: true, lowerCaseAlphabets: true, upperCaseAlphabets: true, specialChars: true }); console.log(`Generated Full Feature OTP of Length 12: ${fullFeatureOtp}`);