yeojz / otplib

:key: One Time Password (OTP) / 2FA for Node.js and Browser - Supports HOTP, TOTP and Google Authenticator

Home Page:https://otplib.yeojz.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how to generate next otp window?

hansyulian opened this issue · comments

Hi, just some question. is there a way maybe in the TOTPOptions to generate the next OTP? sometimes that we know that our OTP is expiring soon, i would like to create a program that let user know current and next otp so they can choose what to put in given the time window

ok nvm, i can close this issue since chatGPT teach me how to do it, but it's worth to share the result:
just totp.generate with epoch = new Date().getTime() + 30*1000; // 30 seconds