Skip to content

otplibOne-Time Password Library

TypeScript-first library for HOTP and TOTP / Authenticator with multi-runtime and plugin support

otplib logootplib logo

Try It

TOTP

Generates a new token every 30 seconds based on the current time.

Setup

Client (Generate)

Resets in: 30s

Server (Verify)

HOTP

Generates a new token every time the counter is incremented.

Setup

Client (Generate)

Counter: 0
Click to increment the counter and generate the next OTP.

Server (Verify)

Expected Counter: 0
The server accepts any token from the current counter up to a window ahead (resync).

Released under the MIT License.