Skip to content

Function: generateTotp() ​

ts
function generateTotp(secret, options?): string;

Generates the current RFC 6238 time-based one-time password (HMAC-SHA1) for a base32 secret, the same code an authenticator app shows. Uses node:crypto only.

Parameters ​

ParameterType
secretstring
options?TotpOptions

Returns ​

string

MIT License. Not affiliated with, endorsed or sponsored by Meta or Instagram.