1.0.0 • Published 2 years ago
safe-pass-gen v1.0.0
Safe Password Generator
Safe Password Generator is a secure password generation library, offering customizable options for strong, randomized passwords.
Installation
You can install the library via npm:
npm install safe-pass-genUsage
Using import
import { generatePassword } from 'safe-pass-gen';
const password = generatePassword(16, {
lowercase: true,
uppercase: true,
digits: true,
symbols: true,
excludeSimilars: true
});Using require
const { generatePassword } = require('safe-pass-gen');
const password = generatePassword(16, {
lowercase: true,
uppercase: true,
digits: true,
symbols: true,
excludeSimilars: true
});API
generatePassword(length: number, options: PasswordGeneratorOptions): string
Generates a random password based on the provided options :
length: Length of the generated password.options: An object specifying the password generation options.lowercase: Include lowercase letters (abcdefghijklmnopqrstuvwxyz). Default:falseuppercase: Include uppercase letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ). Default:falsedigits: Include digits (0123456789). Default:falsesymbols: Include special characters (!@#$%^&*()_-+=[]{}|:;"<>,.?/~). Default:falseexcludeSimilars: Exclude similar characters (0O1Il5S). Default:false
Throws an error if invalid length is specified.\
Throws an error if no character sets are selected (lowercase, uppercase, digits, symbols are all false).
License
This project is licensed under the MIT License
1.0.0
2 years ago