UNPKG

1.29 kBTypeScriptView Raw
1export interface GenerateOptions {
2 /**
3 * Length of the generated password.
4 * @default 10
5 */
6 length?: number;
7 /**
8 * Should the password include numbers
9 * @default false
10 */
11 numbers?: boolean;
12 /**
13 * Should the password include symbols, or symbols to include
14 * @default false
15 */
16 symbols?: boolean | string;
17 /**
18 * Should the password include lowercase characters
19 * @default true
20 */
21 lowercase?: boolean;
22 /**
23 * Should the password include uppercase characters
24 * @default true
25 */
26 uppercase?: boolean;
27 /**
28 * Should exclude visually similar characters like 'i' and 'I'
29 * @default false
30 */
31 excludeSimilarCharacters?: boolean;
32 /**
33 * List of characters to be excluded from the password
34 * @default ""
35 */
36 exclude?: string;
37 /**
38 * Password should include at least one character from each pool
39 * @default false
40 */
41 strict?: boolean;
42}
43
44/**
45 * Generate one password with the given options.
46 */
47export function generate(options?: GenerateOptions): string;
48/**
49 * Bulk generate multiple passwords at once, with the same options for all.
50 */
51export function generateMultiple(count: number, options?: GenerateOptions): string[];