psamvault 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- psamvault-0.1.0/.gitignore +127 -0
- psamvault-0.1.0/PKG-INFO +268 -0
- psamvault-0.1.0/README.md +242 -0
- psamvault-0.1.0/api_client.py +345 -0
- psamvault-0.1.0/command/__init__.py +0 -0
- psamvault-0.1.0/command/auth_commands.py +346 -0
- psamvault-0.1.0/command/recovery_commands.py +297 -0
- psamvault-0.1.0/command/vault_commands.py +388 -0
- psamvault-0.1.0/config.py +99 -0
- psamvault-0.1.0/crypto.py +280 -0
- psamvault-0.1.0/main.py +55 -0
- psamvault-0.1.0/pyproject.toml +49 -0
- psamvault-0.1.0/session.py +123 -0
- psamvault-0.1.0/spinner.py +70 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# Python
|
|
3
|
+
# =============================================================================
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
*.pyo
|
|
8
|
+
*.pyd
|
|
9
|
+
*.so
|
|
10
|
+
*.egg
|
|
11
|
+
*.egg-info/
|
|
12
|
+
dist/
|
|
13
|
+
build/
|
|
14
|
+
eggs/
|
|
15
|
+
parts/
|
|
16
|
+
var/
|
|
17
|
+
sdist/
|
|
18
|
+
develop-eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
wheels/
|
|
22
|
+
|
|
23
|
+
# =============================================================================
|
|
24
|
+
# Virtual environment
|
|
25
|
+
# =============================================================================
|
|
26
|
+
cli_venv/
|
|
27
|
+
.venv/
|
|
28
|
+
venv/
|
|
29
|
+
env/
|
|
30
|
+
ENV/
|
|
31
|
+
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# Environment variables — never commit secrets
|
|
34
|
+
# =============================================================================
|
|
35
|
+
.env
|
|
36
|
+
.env.local
|
|
37
|
+
*.env
|
|
38
|
+
.env.bak
|
|
39
|
+
|
|
40
|
+
# =============================================================================
|
|
41
|
+
# psamvault session file — contains access token, refresh token, kdf_salt
|
|
42
|
+
# This file lives at ~/.psamvault/session.json on the user's machine.
|
|
43
|
+
# If it ever ends up inside the project folder, never commit it.
|
|
44
|
+
# =============================================================================
|
|
45
|
+
.psamvault/
|
|
46
|
+
session.json
|
|
47
|
+
*.session.json
|
|
48
|
+
|
|
49
|
+
# =============================================================================
|
|
50
|
+
# Packaging and distribution
|
|
51
|
+
# If you ever publish psamvault to PyPI, these get generated automatically
|
|
52
|
+
# =============================================================================
|
|
53
|
+
dist/
|
|
54
|
+
build/
|
|
55
|
+
*.egg-info/
|
|
56
|
+
MANIFEST
|
|
57
|
+
|
|
58
|
+
# =============================================================================
|
|
59
|
+
# IDE and editors
|
|
60
|
+
# =============================================================================
|
|
61
|
+
|
|
62
|
+
# VSCode
|
|
63
|
+
.vscode/
|
|
64
|
+
*.code-workspace
|
|
65
|
+
|
|
66
|
+
# PyCharm / JetBrains
|
|
67
|
+
.idea/
|
|
68
|
+
*.iml
|
|
69
|
+
*.iws
|
|
70
|
+
*.ipr
|
|
71
|
+
|
|
72
|
+
# Vim / Neovim
|
|
73
|
+
*.swp
|
|
74
|
+
*.swo
|
|
75
|
+
*~
|
|
76
|
+
|
|
77
|
+
# Emacs
|
|
78
|
+
\#*\#
|
|
79
|
+
.\#*
|
|
80
|
+
|
|
81
|
+
# =============================================================================
|
|
82
|
+
# OS generated files
|
|
83
|
+
# =============================================================================
|
|
84
|
+
|
|
85
|
+
# Windows
|
|
86
|
+
Thumbs.db
|
|
87
|
+
ehthumbs.db
|
|
88
|
+
Desktop.ini
|
|
89
|
+
$RECYCLE.BIN/
|
|
90
|
+
*.lnk
|
|
91
|
+
|
|
92
|
+
# macOS
|
|
93
|
+
.DS_Store
|
|
94
|
+
.AppleDouble
|
|
95
|
+
.LSOverride
|
|
96
|
+
._*
|
|
97
|
+
.Spotlight-V100
|
|
98
|
+
.Trashes
|
|
99
|
+
|
|
100
|
+
# Linux
|
|
101
|
+
*~
|
|
102
|
+
|
|
103
|
+
# =============================================================================
|
|
104
|
+
# Testing
|
|
105
|
+
# =============================================================================
|
|
106
|
+
.pytest_cache/
|
|
107
|
+
.coverage
|
|
108
|
+
coverage.xml
|
|
109
|
+
htmlcov/
|
|
110
|
+
.tox/
|
|
111
|
+
.nox/
|
|
112
|
+
nosetests.xml
|
|
113
|
+
test-results/
|
|
114
|
+
|
|
115
|
+
# =============================================================================
|
|
116
|
+
# Type checking
|
|
117
|
+
# =============================================================================
|
|
118
|
+
.mypy_cache/
|
|
119
|
+
.dmypy.json
|
|
120
|
+
dmypy.json
|
|
121
|
+
.pytype/
|
|
122
|
+
|
|
123
|
+
# =============================================================================
|
|
124
|
+
# Logs
|
|
125
|
+
# =============================================================================
|
|
126
|
+
*.log
|
|
127
|
+
logs/
|
psamvault-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: psamvault
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A secure command-line password vault.
|
|
5
|
+
Project-URL: Homepage, https://github.com/psam-717/psamvault-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/psam-717/psamvault-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/psam-717/psamvault-cli/issues
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: cli,encryption,password,security,vault
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Security :: Cryptography
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: cryptography>=42.0.0
|
|
22
|
+
Requires-Dist: httpx>=0.27.0
|
|
23
|
+
Requires-Dist: pyperclip>=1.9.0
|
|
24
|
+
Requires-Dist: typer>=0.12.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# psamvault
|
|
28
|
+
|
|
29
|
+
A secure command-line password vault for the terminal.
|
|
30
|
+
|
|
31
|
+
Your credentials are **encrypted locally** before being sent to the server — the server never sees your plaintext passwords or your encryption key.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
login password
|
|
39
|
+
│
|
|
40
|
+
▼
|
|
41
|
+
HMAC-SHA256 + pepper → master password
|
|
42
|
+
│
|
|
43
|
+
▼
|
|
44
|
+
PBKDF2 (600k rounds) + kdf_salt → login key
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
decrypt VEK (AES-256-GCM)
|
|
48
|
+
│
|
|
49
|
+
▼
|
|
50
|
+
VEK encrypts every vault entry
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **Pepper** — unique per device, stored in `~/.psamvault/config.env`. Never sent to the server.
|
|
54
|
+
- **VEK (Vault Encryption Key)** — a random 32-byte key generated at signup. Stored encrypted on the server; decrypted locally at login.
|
|
55
|
+
- **kdf_salt** — stored on the server, tied to your account. Ensures two users with the same password get different keys.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install psamvault
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or install from source:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/psam-717/psamvault-cli
|
|
69
|
+
cd psamvault-cli/cli
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Workflow
|
|
76
|
+
|
|
77
|
+
### 1. Configure
|
|
78
|
+
|
|
79
|
+
Run this **once** after installing. It generates your pepper and saves the API URL.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
psamvault configure
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
psamvault setup
|
|
87
|
+
|
|
88
|
+
Press Enter to accept the default value shown in brackets.
|
|
89
|
+
|
|
90
|
+
API URL [https://psam-vault-backend.onrender.com]:
|
|
91
|
+
Generating a secure pepper for your vault...
|
|
92
|
+
Configuration saved to ~/.psamvault/config.env
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> ⚠️ **Back up `~/.psamvault/config.env`** — it contains your pepper. Losing it means losing access to your vault.
|
|
96
|
+
|
|
97
|
+
To review your current config:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
psamvault config-show
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### 2. Sign up
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
psamvault signup
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Creates your account. Your VEK is generated locally, encrypted with your login key, and only the encrypted copy is sent to the server.
|
|
112
|
+
|
|
113
|
+
Password requirements:
|
|
114
|
+
- At least 8 characters
|
|
115
|
+
- At least one uppercase letter
|
|
116
|
+
- At least one digit
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### 3. Log in
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
psamvault login
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Decrypts your VEK locally using your login password and saves it to a local session file (`~/.psamvault/session.json`). All vault commands use this session — you won't be prompted for your password again until the session expires.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 4. Check who's logged in
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
psamvault whoami
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Vault commands
|
|
139
|
+
|
|
140
|
+
### Add a credential
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
psamvault add github.com --user me@example.com --pass mysecret
|
|
144
|
+
psamvault add github.com --user me@example.com --pass mysecret --notes "2FA enabled"
|
|
145
|
+
psamvault add github.com --user me@example.com # prompts for password
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Retrieve a credential
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
psamvault get github.com
|
|
152
|
+
psamvault get github.com --copy # copies password to clipboard, clears after 30s
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### List all entries
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
psamvault list
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Shows site name, username hint, and last-updated date. Does not decrypt entries.
|
|
162
|
+
|
|
163
|
+
### Update a credential
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
psamvault update github.com --pass mynewpassword
|
|
167
|
+
psamvault update github.com --user newuser@example.com --pass newpass
|
|
168
|
+
psamvault update github.com --notes "2FA disabled"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Delete a credential
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
psamvault delete github.com
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Permanent — prompts for confirmation first.
|
|
178
|
+
|
|
179
|
+
### Generate a secure password
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
psamvault generate # 20-char password with symbols
|
|
183
|
+
psamvault generate --length 32
|
|
184
|
+
psamvault generate --length 16 --no-symbols
|
|
185
|
+
psamvault generate --length 20 --no-digits
|
|
186
|
+
psamvault generate --save github.com --user me@example.com # generate and save
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Uses Python's `secrets` module (cryptographically secure).
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Recovery commands
|
|
194
|
+
|
|
195
|
+
### Generate recovery codes
|
|
196
|
+
|
|
197
|
+
Run this while logged in to protect your account against a forgotten password.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
psamvault generate-codes
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Generates **8 one-time recovery codes**. Each code encrypts your VEK — store them somewhere safe. Running this replaces all existing codes.
|
|
204
|
+
|
|
205
|
+
### Check remaining codes
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
psamvault remaining-codes
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Recover your account (forgotten password)
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
psamvault recover
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Use one of your saved recovery codes to reset your login password without losing your vault data. The VEK is recovered and re-wrapped with your new login key — no vault re-encryption needed.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Log out
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
psamvault logout
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Revokes the refresh token on the server and deletes the local session file. Your encrypted vault data remains safely on the server.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Command groups
|
|
232
|
+
|
|
233
|
+
All commands are available at the root level and also under grouped sub-commands:
|
|
234
|
+
|
|
235
|
+
| Root shorthand | Grouped form |
|
|
236
|
+
|---|---|
|
|
237
|
+
| `psamvault login` | `psamvault auth login` |
|
|
238
|
+
| `psamvault add` | `psamvault vault add` |
|
|
239
|
+
| `psamvault generate-codes` | `psamvault recovery generate-codes` |
|
|
240
|
+
|
|
241
|
+
Run any group without a subcommand to see its full command table:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
psamvault auth
|
|
245
|
+
psamvault vault
|
|
246
|
+
psamvault recovery
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Configuration files
|
|
252
|
+
|
|
253
|
+
| File | Purpose |
|
|
254
|
+
|---|---|
|
|
255
|
+
| `~/.psamvault/config.env` | API URL and pepper — **back this up** |
|
|
256
|
+
| `~/.psamvault/session.json` | Active session tokens and decrypted VEK |
|
|
257
|
+
|
|
258
|
+
Both files are restricted to owner read/write only (`chmod 600`).
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Security notes
|
|
263
|
+
|
|
264
|
+
- Your **login password** is never stored or transmitted in plaintext
|
|
265
|
+
- Your **VEK** is stored locally only during an active session
|
|
266
|
+
- The server stores only **encrypted blobs** — it cannot decrypt your vault
|
|
267
|
+
- **AES-256-GCM** is used for all encryption (authenticated — detects tampering)
|
|
268
|
+
- **PBKDF2-HMAC-SHA256** with 600,000 iterations for key derivation (NIST recommended minimum)
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# psamvault
|
|
2
|
+
|
|
3
|
+
A secure command-line password vault for the terminal.
|
|
4
|
+
|
|
5
|
+
Your credentials are **encrypted locally** before being sent to the server — the server never sees your plaintext passwords or your encryption key.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## How it works
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
login password
|
|
13
|
+
│
|
|
14
|
+
▼
|
|
15
|
+
HMAC-SHA256 + pepper → master password
|
|
16
|
+
│
|
|
17
|
+
▼
|
|
18
|
+
PBKDF2 (600k rounds) + kdf_salt → login key
|
|
19
|
+
│
|
|
20
|
+
▼
|
|
21
|
+
decrypt VEK (AES-256-GCM)
|
|
22
|
+
│
|
|
23
|
+
▼
|
|
24
|
+
VEK encrypts every vault entry
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **Pepper** — unique per device, stored in `~/.psamvault/config.env`. Never sent to the server.
|
|
28
|
+
- **VEK (Vault Encryption Key)** — a random 32-byte key generated at signup. Stored encrypted on the server; decrypted locally at login.
|
|
29
|
+
- **kdf_salt** — stored on the server, tied to your account. Ensures two users with the same password get different keys.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install psamvault
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or install from source:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/psam-717/psamvault-cli
|
|
43
|
+
cd psamvault-cli/cli
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
### 1. Configure
|
|
52
|
+
|
|
53
|
+
Run this **once** after installing. It generates your pepper and saves the API URL.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
psamvault configure
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
psamvault setup
|
|
61
|
+
|
|
62
|
+
Press Enter to accept the default value shown in brackets.
|
|
63
|
+
|
|
64
|
+
API URL [https://psam-vault-backend.onrender.com]:
|
|
65
|
+
Generating a secure pepper for your vault...
|
|
66
|
+
Configuration saved to ~/.psamvault/config.env
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
> ⚠️ **Back up `~/.psamvault/config.env`** — it contains your pepper. Losing it means losing access to your vault.
|
|
70
|
+
|
|
71
|
+
To review your current config:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
psamvault config-show
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 2. Sign up
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
psamvault signup
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Creates your account. Your VEK is generated locally, encrypted with your login key, and only the encrypted copy is sent to the server.
|
|
86
|
+
|
|
87
|
+
Password requirements:
|
|
88
|
+
- At least 8 characters
|
|
89
|
+
- At least one uppercase letter
|
|
90
|
+
- At least one digit
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 3. Log in
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
psamvault login
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Decrypts your VEK locally using your login password and saves it to a local session file (`~/.psamvault/session.json`). All vault commands use this session — you won't be prompted for your password again until the session expires.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### 4. Check who's logged in
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
psamvault whoami
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Vault commands
|
|
113
|
+
|
|
114
|
+
### Add a credential
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
psamvault add github.com --user me@example.com --pass mysecret
|
|
118
|
+
psamvault add github.com --user me@example.com --pass mysecret --notes "2FA enabled"
|
|
119
|
+
psamvault add github.com --user me@example.com # prompts for password
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Retrieve a credential
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
psamvault get github.com
|
|
126
|
+
psamvault get github.com --copy # copies password to clipboard, clears after 30s
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### List all entries
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
psamvault list
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Shows site name, username hint, and last-updated date. Does not decrypt entries.
|
|
136
|
+
|
|
137
|
+
### Update a credential
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
psamvault update github.com --pass mynewpassword
|
|
141
|
+
psamvault update github.com --user newuser@example.com --pass newpass
|
|
142
|
+
psamvault update github.com --notes "2FA disabled"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Delete a credential
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
psamvault delete github.com
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Permanent — prompts for confirmation first.
|
|
152
|
+
|
|
153
|
+
### Generate a secure password
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
psamvault generate # 20-char password with symbols
|
|
157
|
+
psamvault generate --length 32
|
|
158
|
+
psamvault generate --length 16 --no-symbols
|
|
159
|
+
psamvault generate --length 20 --no-digits
|
|
160
|
+
psamvault generate --save github.com --user me@example.com # generate and save
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Uses Python's `secrets` module (cryptographically secure).
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Recovery commands
|
|
168
|
+
|
|
169
|
+
### Generate recovery codes
|
|
170
|
+
|
|
171
|
+
Run this while logged in to protect your account against a forgotten password.
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
psamvault generate-codes
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Generates **8 one-time recovery codes**. Each code encrypts your VEK — store them somewhere safe. Running this replaces all existing codes.
|
|
178
|
+
|
|
179
|
+
### Check remaining codes
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
psamvault remaining-codes
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Recover your account (forgotten password)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
psamvault recover
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Use one of your saved recovery codes to reset your login password without losing your vault data. The VEK is recovered and re-wrapped with your new login key — no vault re-encryption needed.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Log out
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
psamvault logout
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Revokes the refresh token on the server and deletes the local session file. Your encrypted vault data remains safely on the server.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Command groups
|
|
206
|
+
|
|
207
|
+
All commands are available at the root level and also under grouped sub-commands:
|
|
208
|
+
|
|
209
|
+
| Root shorthand | Grouped form |
|
|
210
|
+
|---|---|
|
|
211
|
+
| `psamvault login` | `psamvault auth login` |
|
|
212
|
+
| `psamvault add` | `psamvault vault add` |
|
|
213
|
+
| `psamvault generate-codes` | `psamvault recovery generate-codes` |
|
|
214
|
+
|
|
215
|
+
Run any group without a subcommand to see its full command table:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
psamvault auth
|
|
219
|
+
psamvault vault
|
|
220
|
+
psamvault recovery
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Configuration files
|
|
226
|
+
|
|
227
|
+
| File | Purpose |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `~/.psamvault/config.env` | API URL and pepper — **back this up** |
|
|
230
|
+
| `~/.psamvault/session.json` | Active session tokens and decrypted VEK |
|
|
231
|
+
|
|
232
|
+
Both files are restricted to owner read/write only (`chmod 600`).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Security notes
|
|
237
|
+
|
|
238
|
+
- Your **login password** is never stored or transmitted in plaintext
|
|
239
|
+
- Your **VEK** is stored locally only during an active session
|
|
240
|
+
- The server stores only **encrypted blobs** — it cannot decrypt your vault
|
|
241
|
+
- **AES-256-GCM** is used for all encryption (authenticated — detects tampering)
|
|
242
|
+
- **PBKDF2-HMAC-SHA256** with 600,000 iterations for key derivation (NIST recommended minimum)
|