|
1 | | -# passkeys-cli |
| 1 | +# Passkeys CLI - Production-Ready Password Manager |
| 2 | + |
| 3 | +A secure, production-level command-line password manager with encryption, validation, and enhanced user experience. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 🔐 **Secure Encryption**: AES-GCM encryption with Scrypt key derivation |
| 8 | +- ✅ **Input Validation**: Comprehensive validation for all user inputs |
| 9 | +- 🔑 **Password Confirmation**: Mandatory password confirmation for create/update operations |
| 10 | +- 🎨 **Enhanced CLI**: Beautiful, colorized terminal interface |
| 11 | +- 🛡️ **Production-Ready**: Robust error handling and transaction management |
| 12 | +- 🔒 **Master Password**: Argon2 hashed master password protection |
| 13 | +- 📊 **Formatted Output**: Clean, readable table displays |
| 14 | +- 🎲 **Password Generator**: Cryptographically secure password generation |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +1. **Install dependencies:** |
| 19 | + ```bash |
| 20 | + pip install -r requirements.txt |
| 21 | + ``` |
| 22 | + |
| 23 | +2. **Set up environment variables:** |
| 24 | + Create a `.env` file in the project root: |
| 25 | + ```env |
| 26 | + DATABASE_URL=your_postgresql_connection_string |
| 27 | + ``` |
| 28 | + |
| 29 | +3. **Set up database schema:** |
| 30 | + ```sql |
| 31 | + CREATE TABLE master_key ( |
| 32 | + id INT PRIMARY KEY, |
| 33 | + password_hash TEXT NOT NULL, |
| 34 | + salt BYTEA NOT NULL |
| 35 | + ); |
| 36 | + |
| 37 | + CREATE TABLE vault ( |
| 38 | + id UUID PRIMARY KEY, |
| 39 | + service TEXT NOT NULL, |
| 40 | + username TEXT NOT NULL, |
| 41 | + secret BYTEA NOT NULL, |
| 42 | + created_at TIMESTAMP DEFAULT now(), |
| 43 | + updated_at TIMESTAMP DEFAULT now() |
| 44 | + ); |
| 45 | + ``` |
| 46 | + |
| 47 | +## Usage |
| 48 | + |
| 49 | +Run the application: |
| 50 | +```bash |
| 51 | +python main.py |
| 52 | +``` |
| 53 | + |
| 54 | +### Menu Options |
| 55 | + |
| 56 | +1. **View passkeys** - List all stored passkeys with formatted table display |
| 57 | +2. **Create passkey** - Add a new passkey (requires password confirmation) |
| 58 | +3. **Update passkey** - Update an existing passkey (requires password confirmation) |
| 59 | +4. **Delete passkey** - Remove a passkey (requires confirmation) |
| 60 | +5. **Generate password** - Generate a secure random password |
| 61 | +6. **Exit** - Exit the application |
| 62 | + |
| 63 | +## Production Features |
| 64 | + |
| 65 | +### Input Validation |
| 66 | +- Service names: 2-100 characters, alphanumeric + special chars |
| 67 | +- Usernames: 1-255 characters |
| 68 | +- Passwords: Minimum 8 characters, maximum 1000 characters |
| 69 | +- Entry IDs: Valid UUID format validation |
| 70 | + |
| 71 | +### Security |
| 72 | +- AES-GCM encryption for all secrets |
| 73 | +- Scrypt key derivation (n=2^14, r=8, p=1) |
| 74 | +- Argon2 password hashing for master password |
| 75 | +- Secure random password generation |
| 76 | +- Input sanitization and validation |
| 77 | + |
| 78 | +### Error Handling |
| 79 | +- Comprehensive exception handling |
| 80 | +- Clear, user-friendly error messages |
| 81 | +- Database transaction rollback on errors |
| 82 | +- Graceful handling of invalid inputs |
| 83 | + |
| 84 | +### User Experience |
| 85 | +- Colorized terminal output |
| 86 | +- Formatted tables and menus |
| 87 | +- Clear success/error/warning messages |
| 88 | +- Password confirmation for critical operations |
| 89 | +- Confirmation prompts for destructive actions |
| 90 | + |
| 91 | +## Project Structure |
| 92 | + |
| 93 | +``` |
| 94 | +passkeys/ |
| 95 | +├── main.py # CLI entry point with enhanced UI |
| 96 | +├── auth.py # Master password logic with validation |
| 97 | +├── crypto.py # Encryption/decryption utilities |
| 98 | +├── db.py # Database connection management |
| 99 | +├── vault.py # CRUD operations with validation |
| 100 | +├── generator.py # Secure password generation |
| 101 | +├── validation.py # Input validation utilities |
| 102 | +├── ui.py # Enhanced CLI UI components |
| 103 | +├── config.py # Environment configuration |
| 104 | +├── requirements.txt # Python dependencies |
| 105 | +└── README.md # This file |
| 106 | +``` |
| 107 | + |
| 108 | +## Security Best Practices |
| 109 | + |
| 110 | +1. **Master Password**: Choose a strong master password (minimum 8 characters) |
| 111 | +2. **Database Security**: Use secure database credentials and connection strings |
| 112 | +3. **Environment Variables**: Never commit `.env` files to version control |
| 113 | +4. **Backup**: Regularly backup your database |
| 114 | +5. **Access Control**: Restrict file permissions on sensitive files |
| 115 | + |
| 116 | +## Error Codes |
| 117 | + |
| 118 | +- `INVALID_ENTRY_ID`: Entry ID format is invalid |
| 119 | +- `ENTRY_NOT_FOUND`: Requested entry does not exist |
| 120 | +- `MASTER_PASSWORD_MISMATCH`: Master password verification failed |
| 121 | +- `MASTER_NOT_SET`: Master password has not been configured |
| 122 | + |
| 123 | +## License |
| 124 | + |
| 125 | +This project is provided as-is for educational and personal use. |
0 commit comments