A Time-Based (RFC 6238) and HMAC-Based (RFC 4226) One-Time Password Algorithm Implementation in TypeScript. Used by Ordent project I maintain.
NOTE: The package/library hasn't been actually published yet, these commands are placeholder
# Bun
bun add @deanrih/totp-ts
# pnpm
pnpm add @deanrih/totp-ts
# npm
npm install @deanrih/totp-ts
NOTE: The package/library hasn't been actually published yet, this example is a placeholder
import { generateTOTP } from "@deanrih/totp-ts";
const code = generateTOTP("secret-key");
console.log(`Your One-Time Password: [${code}]`);
Checkout the example folder.
IETF RFC Datatracker