One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.
One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.
One Time Password library for Node.js, Deno, Bun and browsers.
It supports the generation and validation of HMAC-Based One-Time Passwords (HOTP) as specified in RFC 4226 and Time-Based One-Time Passwords (TOTP) as specified in RFC 6238. Frequently used in Multi-Factor Authentication (MFA) / Two-Factor Authentication (2FA) systems.
[!TIP] You can try the library with the demo application available at otpauth.molinero.dev.
If you wish to interact with the library in your browser console, the following snippet can be used:
const OTPAuth = await import("otpauth");
This section presents an overview of the most common usage patterns, along with some security recommendations.
…import * as OTPAuth from "jsr:@hectorm/otpauth";
// Same as above.<script type="importmap">
{
"imports": { "otpauth": "https://cdn.jsdelivr.net/npm/otpauth@%VERSION%/dist/otpauth.esm.min.js" },
"integrity": { "https://cdn.jsdelivr.net/npm/otpauth@%VERSION%/dist/otpauth.esm.min.js": "%HASH%" }
}
</script>
<script type="module">
import * as OTPAuth from "otpauth";
// Same as above.
</script><script
src="https://cdn.jsdelivr.net/npm/otpauth@%VERSION%/dist/otpauth.umd.min.js"
integrity="%HASH%"
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script>
// Same as above.
</script>For additional information, please refer to the documentation page at hectorm.github.io/otpauth/.
No open issues yet, or sync has not completed.