Skip to content

Commit 1194d66

Browse files
Merge pull request #1 from mohammadumar-dev/develop
Initial release: Production-ready Passkeys CLI password manager
2 parents 37fe40f + a25fb10 commit 1194d66

File tree

13 files changed

+1165
-178
lines changed

13 files changed

+1165
-178
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DATABASE_URL=postgres://postgres:12345@localhost:5432/cli

.gitignore

Lines changed: 14 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# Byte-compiled / optimized / DLL files
1+
# Python
22
__pycache__/
3-
*.py[codz]
3+
*.py[cod]
44
*$py.class
5-
6-
# C extensions
75
*.so
8-
9-
# Distribution / packaging
106
.Python
117
build/
128
develop-eggs/
@@ -20,188 +16,29 @@ parts/
2016
sdist/
2117
var/
2218
wheels/
23-
share/python-wheels/
2419
*.egg-info/
2520
.installed.cfg
2621
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
47-
coverage.xml
48-
*.cover
49-
*.py.cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
103-
# poetry
104-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105-
# This is especially recommended for binary packages to ensure reproducibility, and is more
106-
# commonly ignored for libraries.
107-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
#poetry.toml
11022

111-
# pdm
112-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113-
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114-
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115-
#pdm.lock
116-
#pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# pixi
121-
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
123-
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124-
# in the .venv directory. It is recommended not to include this directory in version control.
125-
.pixi
126-
127-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128-
__pypackages__/
129-
130-
# Celery stuff
131-
celerybeat-schedule
132-
celerybeat.pid
133-
134-
# SageMath parsed files
135-
*.sage.py
136-
137-
# Environments
23+
# Environment
13824
.env
139-
.envrc
14025
.venv
14126
env/
14227
venv/
14328
ENV/
14429
env.bak/
14530
venv.bak/
14631

147-
# Spyder project settings
148-
.spyderproject
149-
.spyproject
150-
151-
# Rope project settings
152-
.ropeproject
153-
154-
# mkdocs documentation
155-
/site
156-
157-
# mypy
158-
.mypy_cache/
159-
.dmypy.json
160-
dmypy.json
161-
162-
# Pyre type checker
163-
.pyre/
32+
# IDE
33+
.vscode/
34+
.idea/
35+
*.swp
36+
*.swo
37+
*~
16438

165-
# pytype static type analyzer
166-
.pytype/
39+
# OS
40+
.DS_Store
41+
Thumbs.db
16742

168-
# Cython debug symbols
169-
cython_debug/
170-
171-
# PyCharm
172-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174-
# and can be added to the global gitignore or merged into this file. For a more nuclear
175-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176-
#.idea/
177-
178-
# Abstra
179-
# Abstra is an AI-powered process automation framework.
180-
# Ignore directories containing user credentials, local state, and settings.
181-
# Learn more at https://abstra.io/docs
182-
.abstra/
183-
184-
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186-
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188-
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
190-
191-
# Ruff stuff:
192-
.ruff_cache/
193-
194-
# PyPI configuration file
195-
.pypirc
196-
197-
# Cursor
198-
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199-
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200-
# refer to https://docs.cursor.com/context/ignore-files
201-
.cursorignore
202-
.cursorindexingignore
203-
204-
# Marimo
205-
marimo/_static/
206-
marimo/_lsp/
207-
__marimo__/
43+
# Logs
44+
*.log

README.md

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,125 @@
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

Comments
 (0)