JavaScript library for generating OTP How to use yarn add otp-jslib import { totp } from "otp-jslib"; const secret = "secret"; const otpLength = 6; const id = "email@example.com"; const ttl = 300; // seconds const otp = totp(secret, otpLength, id, ttl); console.log(otp);