1.0.1 • Published 11 months ago

totper v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

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}`);
1.0.1

11 months ago

1.0.0

11 months ago