Generate-otp npm package to generate OTP of customizable length. Installation npm install generate-otp Usage const generateOtp = require('generate-otp') const otp = generateOtp.generate(4) Arguments length(optional) - length of OTP. Default value is 6.