Generate Random Secure Password is a library that generates secure passwords according to user's given options.
To install this library, you can use npm or yarn:
npm install generate-random-secure-password
or
yarn add generate-random-secure-password
After installing the library, you can import it into your project as follows:
const passwordGenerator = require('generate-random-secure-password');
Once imported, you can use the passwordGenerator
object to generate secure passwords with the following function:
passwordGenerator.generate(options);
The options
parameter is an object that contains the following properties:
length
: the length of the password (default is8
)numbers
: whether to include numbers in the password (default isfalse
)symbols
: whether to include symbols in the password (default isfalse
)lowercase
: whether to include lowercase letters in the password (default istrue
)uppercase
: whether to include uppercase letters in the password (default istrue
)excludeSimilarCharacters
: wheter to exclude similar characters in the password (default isfalse
)
Here is an example usage:
const passwordGenerator = require('generate-random-secure-password');
const options = {
length: 16,
numbers: true,
symbols: true,
uppercase: true,
lowercase: true
};
const password = passwordGenerator.generate(options);
console.log(password); // Example output: "iL9%Zp6#G4@oE2vJ"
If you want to develop or contribute to this project, you can clone the repository and run the following commands:
npm install # or yarn install
npm run build # or yarn build
npm run test # or yarn test
This will install the necessary dependencies, build the project, and run the tests.
This library is licensed under the MIT license. See LICENSE for more information.