node-less-otp
Version:
A super lightweight library for generating and verifying one-time passwords (OTPs) without the database interaction and additional dependencies.
18 lines (17 loc) • 634 B
TypeScript
/**
* Validates the OTP template.
* @param {string} template - Template to validate.
* @returns {boolean} - True if the template is valid, false otherwise.
*/
export declare function validateTemplate(template: string): boolean;
/**
* Generates an OTP based on a template.
* @param {string} [template] - Template to generate OTP.
* @returns {string} - Generated OTP.
*/
export declare function generateOtp(template: string): string;
/**
* Generates a secure secret key with a random length.
* @returns {string} - A hexadecimal string representation of the generated key.
*/
export declare function generateSecret(): string;