| Crates.io | pwkit |
| lib.rs | pwkit |
| version | 0.1.0 |
| created_at | 2025-10-14 16:25:49.902998+00 |
| updated_at | 2025-10-14 16:25:49.902998+00 |
| description | A secure CLI password generator with template support for environment files |
| homepage | |
| repository | https://github.com/kon0n0/pwkit |
| max_upload_size | |
| id | 1882680 |
| size | 46,826 |
A secure password toolkit with customizable options and template support.
English | ๆฅๆฌ่ช
cargo install --path .
Generate a single password (default: 20 characters with numbers):
pwkit
Generate with custom length:
pwkit --length 32
Generate with symbols:
pwkit --symbols --length 24
Generate multiple passwords:
pwkit --batch 5
The template mode is perfect for generating environment files with multiple passwords while ensuring that related credentials share the same password.
Use placeholders in your template files:
{{PWGEN}} # Anonymous password (20 chars, default settings)
{{PWGEN:name}} # Named password (reused for same name)
{{PWGEN:name:32}} # Custom length (32 chars)
{{PWGEN:name:32:symbols}} # With symbols
Important: Placeholders with the same name will use the same password!
Create a template file template.env:
# Database Configuration
DB_PASSWORD={{PWGEN:db_password}}
DB_USERNAME=admin
# Application Settings
APP_SECRET={{PWGEN:app_secret:32:symbols}}
API_KEY={{PWGEN:api_key:64}}
# Multiple services using same password
SERVICE_A_PASSWORD={{PWGEN:shared_pass}}
SERVICE_B_PASSWORD={{PWGEN:shared_pass}}
SERVICE_C_PASSWORD={{PWGEN:shared_pass}}
Generate the environment file:
# Output to stdout
pwkit --template template.env
# Save to file
pwkit --template template.env --env-output .env
Template file aap.env.template:
# Database
postgresql_admin_password={{PWGEN:db_password}}
# AAP Gateway
gateway_admin_password={{PWGEN:admin_password}}
gateway_pg_password={{PWGEN:db_password}}
# AAP Controller
controller_admin_password={{PWGEN:admin_password}}
controller_pg_password={{PWGEN:db_password}}
# EDA Controller
eda_admin_password={{PWGEN:admin_password}}
eda_pg_password={{PWGEN:db_password}}
Generate:
pwkit --template aap.env.template --env-output aap.env
This ensures:
Generate a password and display it as a QR code:
pwkit --qrcode --length 16
pwkit --batch 10 --output passwords.txt
You can set default options that apply to all placeholders:
# All passwords will include symbols by default
pwkit --template template.env --symbols
# Custom default length
pwkit --template template.env --length 32
Options:
-l, --length <LENGTH> Length of the generated password [default: 20]
-n, --numbers Include numbers in the password
-s, --symbols Include symbols in the password
-q, --qrcode Display password as QR code
-b, --batch <BATCH> Number of passwords to generate [default: 1]
-o, --output <OUTPUT> Output passwords to file
-t, --template <FILE> Generate from template file
-e, --env-output <FILE> Output file for template mode
-h, --help Print help
-V, --version Print version
| Syntax | Description | Example |
|---|---|---|
{{PWGEN}} |
Anonymous password, default settings | Each occurrence generates unique password |
{{PWGEN:name}} |
Named password | Same name = same password |
{{PWGEN:name:LENGTH}} |
Custom length | {{PWGEN:api:64}} |
{{PWGEN:name:LENGTH:symbols}} |
With symbols | {{PWGEN:secure:32:symbols}} |
symbols, symbol, s - Include symbolsnosymbols, ns - Exclude symbolsnumbers, number, n - Include numbersnonumbers, nn - Exclude numbers$ pwkit
rx2lmH5m7UEon4DTGmoa
โ
First password copied to clipboard!
$ pwkit -s -b 3 -l 16
]Fc_&8BtSikMg]}m
9O&F]nlg^{>PlY8#
xrDHJU9MNvlZ(&4)
โ
First password copied to clipboard!
$ pwkit --template myapp.env.template --env-output .env
๐ Reading template from: myapp.env.template
๐ Found 7 password placeholder(s)
โจ Generated password for 'db_password': 20 chars
โจ Generated password for 'admin_password': 20 chars
โ
Environment file generated: .env
!@#$%^&*()-_=+[]{};:,.<>?rand crateMIT
Contributions are welcome! Please feel free to submit a Pull Request.