ts-pwgen
Version:
A command line password generator in TypeScript
44 lines (43 loc) • 1.53 kB
TypeScript
import 'colors';
import { PasswordGeneratorOptions, GeneratedPassword } from './password_generator.interface';
export declare class PasswordGenerator {
options: PasswordGeneratorOptions;
constructor(options?: PasswordGeneratorOptions);
/**
* Checks if a password string contains at least one character from a string
* array.
*/
private containsFromCharset;
/**
* Count how many charsets are being used in the current configuration.
*/
countActiveCharsets(): number;
/**
* Returns the password length, taking all parts and potential delimiters into
* account.
*/
get passwordLength(): number;
/**
* Generate a cryptographically more secure random number than Math.random().
*/
random(): number;
/**
* Generates a password based on this.options. This method will recursively
* call itself if the password does not contain at least one character from
* each specified charset.
*/
generate(): GeneratedPassword;
/**
* Generates any positive amount of passwords using this.generate().
*/
generateMultiple(amount: number): GeneratedPassword[];
/**
* Interactively ask the user which password they would like if they ask for
* more than 1. Also copies it to the clipboard.
*/
interactive(amount: number, verbose?: boolean, noClipboard?: boolean): Promise<void>;
/**
* Log information about the security of the current password options.
*/
private logInformation;
}