Passbird is an npm library for generating and validating passwords.
To install Passbird globally on your system, run:
npm install -g passbird
To install Passbird in an specific context, run:
npm install passbird
To use Passbird, start by running:
passbird start
You will be asked to choose the type of password you want to generate:
$ passbird start
? Want to generate a default or memorable password or want to validate a password? (Use arrow keys)
❯ Default
Memorable
Validate
If you choose the "Default" option, you will be asked the following questions:
? What type of password do you want to generate? Default
? How long do you want the password to be? 10
? Include uppercase letters? Yes
? Include numbers? Yes
? Include symbols? Yes
After answering these questions, Passbird will generate a random password for you, like this: :v/rz!p6SR
If you choose the "Memorable" option, you will be asked the following questions:
? What type of password do you want to generate? Memorable
? Include uppercase letters? Yes
? Include numbers? Yes
? Include symbols? Yes
Please, enter the words separated by commas: Andrés, Lina
After answering these questions, Passbird will generate a memorable password for you, like this: AndrésdLina16M.. If you're not satisfied with the password, you can choose to generate a new one:
Are you satisfied with the password? (y/n) n
Please, enter the words separated by commas:
This section of the code introduces a feature that validates any given password against the Have I Been Pwned (HIBP) API.
$ passbird start
? Want to generate a default or memorable password or want to validate a password? Validate
? Insert password to validate: Loi
Warn:
Password has been exposed in previous data breaches.
If you want to use an specific function (default, memorable or validate password), run:
node default.js <length> <includeUppercase> <includeNumbers> <includeSymbols>
The command will be something like:
node default.js 10 true true true
If you want to import it and use it in your project:
import { generatDefaultePassword } from '../node_modules/passbird/src/index.js';
// Define arguments
let length = 10;
let includeUppercase = 'true';
let includeNumbers = 'true';
let includeSymbols = 'true';
// Call the function
let password = generatDefaultePassword(length, includeUppercase, includeNumbers, includeSymbols);
node memorable.js <includeUppercase> <includeNumbers> <includeSymbols>
The command will be something like:
node memorable.js true true true
Then, you will be ask for write the words you want to use.
If you want to import it and use it in your project:
import { generateMemorablePassword } from '../node_modules/passbird/src/index.js';
// Define arguments
let includeUppercase = 'true';
let includeNumbers = 'true';
let includeSymbols = 'true';
// Call the function
generateMemorablePassword(includeUppercase, includeNumbers, includeSymbols);
node validate.js <password>
The command will be something like:
node validate.js password123
If you want to import it and use it in your project:
import { validatePassword } from '../node_modules/passbird/src/index.js';
// Define the password
let password = 'password123';
// Call the function
validatePassword(password);
Note that default.js and memorable.js return the variable "password", so you can use it in your project but validate.js returns a message if the password is breached or not.
We welcome contributions to Passbird! If you're interested in improving this library, there are many ways you can contribute:
- Submit bug reports and feature requests on our GitHub issues page.
- Review and improve our documentation.
- Review and refactor our existing code.
- Add new features and enhancements.
To get started, please fork the Passbird repository, make your changes, and submit a pull request. We look forward to collaborating with you!
Passbird is licensed under the MIT License. See the LICENSE file for more details.