generatePassword
Generates a random password of the given length.
Returns: Promise<any>
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
length | number | optional | - | The desired password length. |
shouldHash | boolean | optional | - | Unused as of v3 (password hashing was removed); retained for signature compatibility. |
Usage
Example: Generate Random Password
const randomPassword = nfsfu234FormValidation.generatePassword();
randomPassword.then(password => {
console.log("Generated Password: ", password); // Example output: "A!3d7fhJ"
});Example: Custom Length
const randomPassword = nfsfu234FormValidation.generatePassword(16);
randomPassword.then(password => {
console.log("Generated Password: ", password);
});Last updated on