webdev-power-kit
Version:
A powerful toolkit that simplifies access to browser features like clipboard, notifications, battery, vibration, and more — perfect for modern web developers.
25 lines (24 loc) • 863 B
TypeScript
/**
* @fileoverview
* A powerful and flexible OTP (One-Time Password) generator
* Supports digits, uppercase, lowercase, symbols, and custom length
*/
export interface OTPOptions {
/** Include digits like 0–9 (default: true) */
digits?: boolean;
/** Include lowercase letters like a–z */
lowerCase?: boolean;
/** Include uppercase letters like A–Z */
upperCase?: boolean;
/** Include symbols like @, #, $, %, etc. */
symbols?: boolean;
}
/**
* Generate a secure, random OTP using specified options.
* Uses crypto.getRandomValues() for cryptographically secure randomness.
*
* @param length - Total length of the OTP (e.g., 6)
* @param options - Character type options to include
* @returns A string containing the generated OTP
*/
export declare function generateOTP(length: number, options?: OTPOptions): string;