Skip to content

Instantly share code, notes, and snippets.

@janstuemmel
Last active December 21, 2022 00:28
Show Gist options
  • Save janstuemmel/52609dfd535ae0e83894678f6cad5db1 to your computer and use it in GitHub Desktop.
Save janstuemmel/52609dfd535ae0e83894678f6cad5db1 to your computer and use it in GitHub Desktop.
When does a 2fa (totp) token expire...
const period = 30;
const epoch = Math.floor(Date.now() / 1000.0);
const expires = (Math.ceil(epoch / period) * period) - epoch;
console.log(expires);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment