totper
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

totper

Module for generating TOTP Codes and other things related to TOTP

Usage

const secretKey = generateRandomTOTPSecretKey();
console.log(`Generated TOTP Secret Key: ${secretKey}`);

const totpCode = generateTOTPCode(secretKey);
console.log(`Generated TOTP Code: ${totpCode}`);

const isValid = verifyTOTPCode(secretKey, totpCode);
console.log(`Is Valid TOTP Code? ${isValid}`);

You can also specify amount of digits (default = 6) and provide custom time step (default = 30) in seconds

let digits = 10;
let timeStep = 20;
const totpCode = generateTOTPCode(secretKey, digits, timeStep);
console.log(`Generated TOTP Code: ${totpCode}`);

Package Sidebar

Install

npm i totper

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

25.5 kB

Total Files

8

Last publish

Collaborators

  • kamil-koziol