@kiryano/etherealotp
Version:
A library for two-factor authentication using Twilio and Speakeasy.
20 lines (19 loc) • 664 B
TypeScript
import * as speakeasy from 'speakeasy';
/**
* Generates a secret key for TOTP.
* @returns A generated secret key
*/
export declare function generateSecret(): speakeasy.GeneratedSecret;
/**
* Generates a TOTP token based on the secret.
* @param secret The user's TOTP secret
* @returns The generated token as a string
*/
export declare function generateToken(secret: string): string;
/**
* Verifies a TOTP token against the user's secret.
* @param token The TOTP token to verify
* @param secret The user's TOTP secret
* @returns True if the token is valid, otherwise false
*/
export declare function verifyToken(token: string, secret: string): boolean;