otp-cache
Version:
Additional one time password security, increase the security of your application, Easy to use and fast performance, the bundle size is quite small and light.
15 lines (12 loc) • 447 B
JavaScript
const OTP = require("../index");
const PASSWORD="no-secret";
OTP.OtpGenerate({digits:6,type_code:"alphanumeric",secret:PASSWORD,payload:{user:"john doe"}}).then(async(OtpToken)=>{
let OTPStatus=await OTP.OtpVerify({otp_code:OtpToken,secret:PASSWORD})
if(OTPStatus){
console.log(`OTP Verified`,OTPStatus);
}else{
console.log(`OTP Unverified`);
}
}).catch((err)=>{
console.error(err.message);
});