Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 977 Bytes

README.md

File metadata and controls

37 lines (24 loc) · 977 Bytes

@deanrih/totp-ts

A Time-Based (RFC 6238) and HMAC-Based (RFC 4226) One-Time Password Algorithm Implementation in TypeScript. Used by Ordent project I maintain.

Installation

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

Usage

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.

Credits/Reference

IETF RFC Datatracker