ourpassgen-cli
v1.0.4
Published
A CLI tool to generate secure random passwords and copy them to clipboard
Maintainers
Readme
OurPassGen CLI
A secure, customizable password generator CLI tool that generates random passwords and automatically copies them to your clipboard.
Features
- 🔐 Cryptographically secure password generation using Node.js crypto module
- 📋 Automatic clipboard copying for instant use
- ⚙️ Highly customizable with various options and presets
- 🚀 Easy to use with simple commands and sensible defaults
- 🎯 Multiple presets for different use cases (simple, strong, PIN)
- 🔧 Flexible character sets with inclusion/exclusion options
Installation
Global Installation
npm install -g ourpassgen-cliUsing npx (No Installation Required)
npx ourpassgen-cliUsage
Basic Usage
Generate a default 16-character password and copy to clipboard:
ourpassgen
# or
npx ourpassgen-cliCommand Options
ourpassgen [options] [command]Options
-l, --length <number>- Password length (default: 16)--no-lowercase- Exclude lowercase letters--no-uppercase- Exclude uppercase letters--no-numbers- Exclude numbers--no-symbols- Exclude symbols (!@#$%^&*()_+-=[]{}|;:,.<>?)-x, --exclude-ambiguous- Exclude ambiguous characters (il1Lo0O)--no-copy- Don't copy to clipboard, just display-h, --help- Display help information-V, --version- Display version number
Examples
# Generate a 12-character password (includes symbols by default)
ourpassgen -l 12
# Generate a password without symbols
ourpassgen --no-symbols
# Generate a password without ambiguous characters
ourpassgen -x
# Generate a password and display it (don't copy to clipboard)
ourpassgen --no-copy
# Generate a password with only lowercase and numbers
ourpassgen --no-uppercase --no-symbolsPreset Commands
Simple Password
Generate a simple password with letters, numbers, and symbols (no ambiguous characters):
ourpassgen simple
ourpassgen simple -l 10 # Custom length
ourpassgen simple --no-clipboard # Don't copy to clipboardStrong Password
Generate a strong password with all character types (default: 20 characters):
ourpassgen strong
ourpassgen strong -l 24 # Custom length (default: 20)
ourpassgen strong --no-clipboard # Don't copy to clipboardPIN Generation
Generate a numeric PIN (default: 6 digits):
ourpassgen pin
ourpassgen pin -l 4 # 4-digit PIN
ourpassgen pin -l 8 # 8-digit PIN
ourpassgen pin --no-clipboard # Don't copy to clipboardLibrary Usage
You can also use this package as a library in your Node.js or React/Next.js applications.
Installation
npm install ourpassgen-cliBasic Usage
import { generatePassword } from 'ourpassgen-cli';
// Generate a default password (16 chars, letters/numbers/symbols)
const password = generatePassword({ length: 16 });
console.log(password);Advanced Usage
import { generatePassword } from 'ourpassgen-cli';
const password = generatePassword({
length: 24,
includeLowercase: true,
includeUppercase: true,
includeNumbers: true,
includeSymbols: true,
excludeAmbiguous: true // Exclude 'i', 'l', '1', 'L', 'o', '0', 'O'
});It uses crypto.randomBytes in Node.js and window.crypto.getRandomValues in browsers to ensuring cryptographically secure generation in both environments.
Character Sets
- Lowercase:
abcdefghijklmnopqrstuvwxyz - Uppercase:
ABCDEFGHIJKLMNOPQRSTUVWXYZ - Numbers:
0123456789 - Symbols:
!@#$%^&*()_+-=[]{}|;:,.<>? - Ambiguous:
il1Lo0O(excluded when using-xflag)
Security
This tool uses Node.js's built-in crypto.getRandomValues() function to ensure cryptographically secure random number generation. This makes the generated passwords suitable for security-sensitive applications.
Requirements
- Node.js 14.0.0 or higher
Development
Local Development
- Clone the repository
- Install dependencies:
npm install - Link for local testing:
npm link - Test the CLI:
ourpassgen --help
Project Structure
ourpassgen-cli/
├── bin/
│ └── passgen.js # Main CLI script
├── package.json # Package configuration
└── README.md # DocumentationLicense
MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Changelog
v1.0.0
- Initial release
- Basic password generation with customizable options
- Clipboard integration
- Preset commands (simple, strong, pin)
- Comprehensive CLI interface
