@oslojs/otp
v1.1.0
Published
One-time passwords with HOTP and TOTP
Downloads
7,785
Readme
@oslojs/otp
Documentation: https://otp.oslojs.dev
A JavaScript library for generating and verifying OTPs by Oslo.
Supports HMAC-based one-time passwords (HOTP) and time-based one-time passwords (TOTP) as defined in RFC 4226 and RFC 6238.
- Runtime-agnostic
- No third-party dependencies
- Fully typed
import { generateTOTP, verifyTOTP } from "@oslojs/otp";
const totp = generateTOTP(key, 30, 6);
const valid = verifyTOTP(totp, key, 30, 6);
Installation
npm i @oslojs/otp