Commit 645b513
feat(vault): M4 write paths — vault add + vault edit
Completes the M4 write verbs (`remove`/`generate` shipped in 61a56fb). `add`
and `edit` are the inverse of the read path: caller-supplied plaintext fields
are encrypted inside the agent — the unwrapped user key never crosses the UDS
— and POST/PUT to the server. Login and secure-note types are supported.
- vault-core: `Cipher::from_plain` — the encryption inverse of `decrypt`;
assembles a /sync-shaped Cipher from a PlainCipher. 3 round-trip tests.
- vault-api: `create_cipher` (POST /api/ciphers → new id) and `update_cipher`
(PUT /api/ciphers/{id}). camelCase request body (CipherRequest) reusing
vault-core's PascalCase Login nested, with a `secureNote` marker on type 2.
Shared `bearer_headers` helper. Wiremock tests assert method/path/Bearer, an
EncString-shaped name, and the type-2 secureNote marker.
- vault-ipc: `Request::Add` / `Request::Edit` (plaintext optional fields,
secrets as `Vec<u8>`) and `Response::Saved { id, name }`.
- vault-agent: `add_cipher` / `edit_cipher`, with folder name→id resolution.
`edit` re-encrypts only changed fields onto a clone of the original encrypted
cipher (`apply_cipher_edits`), so secondary URIs, custom fields, and org
membership it doesn't model survive verbatim — `--uri` replaces the primary
and keeps the rest. Two unit tests prove a secondary URI survives an edit.
Secrets wiped via PlainCipher/Zeroizing.
- vault-cli: `vault add <name> [--type login|note] [--username] [--uri]
[--folder] [--notes] [--generate[=LEN]] [--json]` (password from stdin or
generated; no --password flag, so secrets never enter argv) and
`vault edit <selector> [field flags] [--password|--generate] [--json]`.
Remaining M4: `--json` on unlock/lock/sync/stop-agent, and a real re-pull
`vault sync`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 61a56fb commit 645b513
9 files changed
Lines changed: 1108 additions & 4 deletions
File tree
- crates
- vault-agent/src
- vault-api
- src
- tests
- vault-cli/src
- vault-core
- src
- tests
- vault-ipc/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
11 | 40 | | |
12 | 41 | | |
13 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
148 | 205 | | |
149 | 206 | | |
150 | 207 | | |
| |||
0 commit comments