Skip to content
/ totp Public

Time-Based One-Time Password (TOTP) generation

License

Notifications You must be signed in to change notification settings

v19-io/totp

Repository files navigation

@v19/totp

A simple implementation of the Time-Based One-Time Password Algorithm (TOTP) as specified in RFC 6238.

Usage

import { generateSecret, generateUri } from "@v19/totp";

const secret = await generateSecret();
const uri = generateUri(secret, "[email protected]", "My Service");
// => otpauth://totp/My%20Service:user%40myservice.com?secret=JBSWY3DPEHPK3PXP&issuer
const code = await totp(secret);