pagecrypt
Version:
Easily add client-side password-protection to your Single Page Applications, static websites and HTML files.
19 lines (18 loc) • 923 B
TypeScript
/**
* Encrypt an HTML string with a given password.
* The resulting page can be viewed and decrypted by opening the output HTML file in a browser, and entering the correct password.
*
* @param {string} inputHTML The HTML string to encrypt.
* @param {string} password The password used to encrypt + decrypt the content.
* @param {number} iterations The number of iterations to derive the key from the password.
* @returns A promise that will resolve with the encrypted HTML content
*/
export declare function encryptHTML(inputHTML: string, password: string, iterations?: number): Promise<string>;
/**
* Generate a random password of a given length.
*
* @param {number} length The password length.
* @param {string} characters The set of characters to pick from. Max length 255 characters.
* @returns A random password.
*/
export declare function generatePassword(length?: number, characters?: string): string;