1.0.1 • Published 9 months ago
totp_generator_hexadecimal v1.0.1
totp_generator_hexadecimal
Generates totp keys from hexadecimal strings I wrote this because I don't like base32 encoding, since node doesn't support it by default. Also node now has the crypto.createHmac() function which most existing packages don't use
Usage
import { GenerateTotpValue } from "totp_generator_hexadecimal";
const key = "ABC";
const totp = await GenerateTotpValue(key);
console.log(totp);
Usage With options
import { GenerateTotpValue, TotpOptions} from "totp_generator_hexadecimal";
const options = new TotpOptions({algorithm : "SHA256", interval : 60, digits : 4 });
const key = "ABC";
const totp = await GenerateTotpValue(key,options);
console.log(totp);
Supported options
TotpOptions implements the following 1. interval : number Default is 30 2. digits : number Default is 6 3. algorithm : string Default is SHA1
Supported Digest Algorithms
Depends on node crypto.createHmac() Run openssl list -digest-algorithms in your terminal to see supported algorithms
Source Code and License
See github