otp-generation
v1.0.5
Published
#otp-generator
Downloads
40
Readme
otp-generation-package
#otp-generator
'otp-generator' is simple one time password generator and can be used as password generator.
Index
Install
npm install otp-generation
Usage
const otpGenerator = require('otp-generation')
otpGenerator.generate(6, { upperCaseAlphabets: false, specialChars: false });
generate(length, options)
Arguments
length
- length of password. Optional ifoptions
is optional. default length is 10.options
- optionaldigits
- Default:true
true value includes digits in OTPlowerCaseAlphabets
- Default:true
true value includes lowercase alphabets in OTPupperCaseAlphabets
- Default:true
true value includes uppercase alphabets in OTPspecialChars
- Default:true
true value includes special Characters in OTP
Tests
npm run test
Example Generate a 6-character OTP with uppercase alphabets, lowercase alphabets, and special characters:
let otp = otpGenerator.generate(6, {
upperCaseAlphabets: true,
specialChars: true,
lowerCaseAlphabets: true,
});
console.log(otp);
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.