Skip to content

Instantly share code, notes, and snippets.

@ryanhs
Created March 12, 2020 09:11
Show Gist options
  • Save ryanhs/9c1ce91d79501d3bfb667e6cb766d2ce to your computer and use it in GitHub Desktop.
Save ryanhs/9c1ce91d79501d3bfb667e6cb766d2ce to your computer and use it in GitHub Desktop.
totp.js
const { totp } = require('otplib')
const secret = 'SOMESECRETCODE';
totp.options = { window: 0, step: 5 }
token = totp.generate(secret);
totp.verify({ token, secret });
@ryanhs
Copy link
Author

ryanhs commented Mar 12, 2020

to make it 60s window, past generation can be checked, change window to 60

totp.options = { window: 60, step: 5 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment