@vaultkeepr/cli 0.0.0-stage → 0.2.0
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.
- package/README.md +234 -2
- package/dist/_esm-2BJT4VTJ.js +3739 -0
- package/dist/agent-OVSW5GMB.js +17 -0
- package/dist/ccip-SAAG5KQW.js +14 -0
- package/dist/chunk-4VNS5WPM.js +42 -0
- package/dist/chunk-GOWAFN6V.js +2454 -0
- package/dist/chunk-I25CVPG3.js +4603 -0
- package/dist/chunk-UDT2YIGY.js +158 -0
- package/dist/chunk-UUCFTCF4.js +3358 -0
- package/dist/chunk-V4QISPBH.js +122 -0
- package/dist/chunk-XJMVKU2V.js +22430 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +21 -0
- package/dist/dist-XKDX6HOR.js +484 -0
- package/dist/index.d.ts +794 -0
- package/dist/index.js +215 -0
- package/dist/secp256k1-SITSPVYB.js +16 -0
- package/package.json +42 -4
package/README.md
CHANGED
|
@@ -1,3 +1,235 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@vaultkeepr/cli` — `vaultkeepr`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Terminal client for **a human's** VaultKeepR vault: QR pairing, continuous sync
|
|
4
|
+
with the other devices, and the everyday commands (`list`, `get`, `add`,
|
|
5
|
+
`edit`, `delete`, `status`, `sync`), plus the `agent` dispatcher that hands the
|
|
6
|
+
mandate family to `vaultkeepr-agent` / `vaultkeepr-agent-http`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm i -g @vaultkeepr/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
From source (development):
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
npm run build --workspace=@vaultkeepr/cli
|
|
18
|
+
node packages/cli/dist/cli.js --help # or link `vaultkeepr` from dist/cli.js
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Two binaries, two threat models
|
|
22
|
+
|
|
23
|
+
| Binary | Who uses it | What it can read |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `vaultkeepr` (this package) | a **human** at a terminal | the **whole vault** |
|
|
26
|
+
| `vaultkeepr-agent` (`packages/agent-cli`) | a machine / an LLM agent | only the entries named by a **signed mandate**, one command at a time |
|
|
27
|
+
|
|
28
|
+
`vaultkeepr` is a full vault client and prints/copies values on demand — that
|
|
29
|
+
is its job. `vaultkeepr-agent` never has a value-printing path: values only
|
|
30
|
+
reach the environment of a subprocess allowed by the mandate. Do not mix the
|
|
31
|
+
two, do not reuse the agent's config directory (`~/.config/vaultkeepr-agent`)
|
|
32
|
+
for this CLI, and do not document one as a replacement for the other.
|
|
33
|
+
|
|
34
|
+
## Threat model
|
|
35
|
+
|
|
36
|
+
- **Full vault access is granted to whoever can read the local config.** The
|
|
37
|
+
pairing payload carries the master password and, when the phone has one, the
|
|
38
|
+
account secret key. `~/.config/vaultkeepr/identity.json` therefore holds
|
|
39
|
+
secrets: directory `700`, file `600`, no other path copies it.
|
|
40
|
+
- **The vault is sealed at rest.** `vault.json` holds the entries encrypted
|
|
41
|
+
(XChaCha20-Poly1305 + HMAC commitment, `@vaultkeepr/core`) with the same key
|
|
42
|
+
material that seals the IPFS payload. Losing the config directory means
|
|
43
|
+
re-pairing, not losing the vault: the phone and the remote payload remain.
|
|
44
|
+
- **No master password is typed in the terminal.** `vaultkeepr pair` shows a
|
|
45
|
+
QR; the phone sends the vault sealed (XChaCha20 + HKDF, P256 ECDH) to this
|
|
46
|
+
session's ephemeral key. The session is one-shot and expires.
|
|
47
|
+
- **`vault-summary.json` is the only derived, non-secret projection** written
|
|
48
|
+
next to the sealed vault (on every local save, and by `status`): ids, labels,
|
|
49
|
+
service URLs and edit timestamps, mode `600`. It exists for the scoped
|
|
50
|
+
`vaultkeeper-agent`, which has no business holding the vault key: that CLI
|
|
51
|
+
compares it to a mandate snapshot to warn when an entry diverged. No value,
|
|
52
|
+
note or TOTP secret ever enters it.
|
|
53
|
+
- **Values stay local.** `get` copies to the OS clipboard and `--reveal` prints
|
|
54
|
+
— deliberate, human-facing. No value is ever logged, journaled, put in
|
|
55
|
+
`argv`, written to the sync state file, or sent anywhere except as the
|
|
56
|
+
encrypted vault payload. Clipboard writers receive the value on **stdin**
|
|
57
|
+
(`wl-copy`, `xclip`, `xsel`, `pbcopy`, `termux-clipboard-set`).
|
|
58
|
+
- **No new endpoint.** Pairing uses the existing `/api/pair`, sync uses the
|
|
59
|
+
existing `/api/vault-cid` pointer, `/api/ipfs/upload` and the IPFS gateway.
|
|
60
|
+
Every request carries a dated owner proof signed now with the account key
|
|
61
|
+
(`VaultKeepR:<address>:<action>:<ms>`, five-minute window) — a read proof
|
|
62
|
+
cannot be replayed as an upload, and the pointer write is bound to its CID.
|
|
63
|
+
|
|
64
|
+
## Config directory (and the one-time rename migration)
|
|
65
|
+
|
|
66
|
+
Everything lives in `~/.config/vaultkeepr/` (overridable with `VK_CONFIG_DIR`),
|
|
67
|
+
directory `700`, files `600`.
|
|
68
|
+
|
|
69
|
+
The binary was previously named `vaultkeeper`, writing to `~/.config/vaultkeeper/`.
|
|
70
|
+
On startup, when the legacy directory exists and the new one does not, it is
|
|
71
|
+
**renamed** (never copied) to `~/.config/vaultkeepr/` and a line is logged on
|
|
72
|
+
stderr — an existing live pairing therefore survives the rename. If the rename
|
|
73
|
+
fails, the legacy directory keeps being used rather than starting an empty one.
|
|
74
|
+
|
|
75
|
+
## Pairing
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
vaultkeepr pair # --api <url> for a non-default server
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
1. `VaultKeepR → Réglages → Appairer un terminal` on the phone.
|
|
82
|
+
2. Scan the large QR (half-block cells with forced colours, ~54 columns; a
|
|
83
|
+
plain fallback is used when stdout is not a terminal).
|
|
84
|
+
3. The CLI waits with a spinner, decrypts the sealed payload, stores the
|
|
85
|
+
identity and the vault, and reports the account (redacted) and entry count.
|
|
86
|
+
|
|
87
|
+
The mobile screen still has to exist for this flow; scanner side is unchanged
|
|
88
|
+
from the existing `vk-pair://` protocol.
|
|
89
|
+
|
|
90
|
+
## Continuous sync (peer, not pull-on-demand)
|
|
91
|
+
|
|
92
|
+
Every command reconciles once before acting: read the pointer, fetch the
|
|
93
|
+
payload if it changed, open it, merge, then run the command. `add` publishes
|
|
94
|
+
immediately. For a long session, keep a peer running:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
vaultkeepr sync # loop, 15 s
|
|
98
|
+
vaultkeepr sync --interval 5 # every 5 s
|
|
99
|
+
vaultkeepr sync --once # one reconciliation
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Design, verified against the shipped clients (2026-11-27):
|
|
103
|
+
|
|
104
|
+
- **Wire format.** The IPFS payload is `{ciphertext, nonce, salt, commitment,
|
|
105
|
+
version, updatedAt}` sealed with `Argon2id(payloadKeyMaterial, salt)`, where
|
|
106
|
+
`payloadKeyMaterial` is the account secret key when there is one, the master
|
|
107
|
+
password otherwise — the same rule as `deriveSyncPayloadKey` in
|
|
108
|
+
`apps/extension/background-src/vault-sync.js` and `ipfsSync.ts` on mobile.
|
|
109
|
+
Published payloads are `serializeVault(vault)`; the extension, iOS and
|
|
110
|
+
Android keep reading them unchanged.
|
|
111
|
+
- **Merge.** `threeWayMerge(base, local, remote)` from `@vaultkeepr/core`,
|
|
112
|
+
with the last published state as base — the extension's model
|
|
113
|
+
(`vaultKeeperMergeBase_*`). Distinct entries survive every direction; an
|
|
114
|
+
edit made locally after the base is kept when the remote did not touch it.
|
|
115
|
+
- **CRDT payloads are read.** A payload produced by a CRDT writer is opened
|
|
116
|
+
with `@vaultkeepr/sync` (`detectPayloadFormat` → `importBinary` →
|
|
117
|
+
`purgeTombstones` → `toVault`), exactly like mobile. The CLI does **not**
|
|
118
|
+
publish CRDT binaries: no shipped client writes them, and the extension
|
|
119
|
+
would republish a legacy payload on its next upload, so publishing CRDT
|
|
120
|
+
here would only add a format churn without buying conflict quality.
|
|
121
|
+
- **Pointer.** `GET /api/vault-cid?wallet&signature&message` to read,
|
|
122
|
+
`POST /api/vault-cid {walletAddress,cid,signature,message}` to write with
|
|
123
|
+
`VaultKeepR CID Update:<cid>:<ms>`. Legacy (owner EOA) namespace only:
|
|
124
|
+
keyed/Smart-Account pointer migration is behind `KEYED_MIGRATION_ENABLED =
|
|
125
|
+
false` in `packages/smart-account`, so nothing else can be targeted today.
|
|
126
|
+
|
|
127
|
+
`vaultkeepr status` shows the account, pairing date, vault counts per kind,
|
|
128
|
+
last resolve/publish, the local and remote CID (redacted), and the last error.
|
|
129
|
+
|
|
130
|
+
## Commands
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
vaultkeepr list [--kind api|login|card|identity|note|seed|passkey] [--json] [--offline]
|
|
134
|
+
vaultkeepr get <entrée> [--reveal] [--json] [--offline]
|
|
135
|
+
vaultkeepr add --kind <kind> [--title <t>] [--url <u>] [--username <u>] [--note <n>] [--offline]
|
|
136
|
+
vaultkeepr edit <entrée> [--title <t>] [--url <u>] [--username <u>] [--note <n>] [--offline]
|
|
137
|
+
vaultkeepr delete <entrée> [--yes] [--offline]
|
|
138
|
+
vaultkeepr agent init|list|run|http|mandate [...]
|
|
139
|
+
vaultkeepr status [--json] [--offline]
|
|
140
|
+
vaultkeepr sync [--interval <s>] [--once]
|
|
141
|
+
vaultkeepr completions bash|zsh
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- `list` never prints a value. `--kind` filters on the entry group/type; the
|
|
145
|
+
`api` kind is the dedicated "Clé API" item (one value, optional service URL,
|
|
146
|
+
optional note — no username/password pair), ready for the phone-side kind.
|
|
147
|
+
- `get` matches an exact ID, an ID prefix, or a label/username/URL substring;
|
|
148
|
+
an ambiguous query is an error, never a silent pick. Default action: copy.
|
|
149
|
+
`--reveal` prints the value, `--json` prints the full entry.
|
|
150
|
+
- `add` is an interactive form (`ask` masks secret fields on a TTY). Secret
|
|
151
|
+
fields are only ever read from the prompt: no `--password`, no `--value`.
|
|
152
|
+
`passkey` entries are refused — they are created on the phone/extension.
|
|
153
|
+
- `edit` runs the same per-kind form, pre-filled from the current entry:
|
|
154
|
+
Enter keeps the current value, a lone `-` clears an optional field. A secret
|
|
155
|
+
field is never echoed, not even truncated: the prompt only says `conservée`.
|
|
156
|
+
The entry keeps its id and kind (`api` stays `api`), `modifiedAt` is bumped
|
|
157
|
+
and the result is published like `add`.
|
|
158
|
+
- `delete` shows label, kind and id in its confirmation (never the value),
|
|
159
|
+
removes the entry and publishes a **tombstone** (`entryTombstones[id]`) so the
|
|
160
|
+
deletion propagates on the next merge instead of resurrecting the entry.
|
|
161
|
+
`--yes` skips the prompt for scripted use. Resolving `<entrée>` is shared with
|
|
162
|
+
`get`: exact id, id prefix, or label/username/URL substring, ambiguity is an
|
|
163
|
+
error.
|
|
164
|
+
- `agent` is the single entry point of the agent family: `init|list|run` are
|
|
165
|
+
delegated verbatim to `vaultkeepr-agent`, `http` to `vaultkeepr-agent-http`
|
|
166
|
+
(`VK_AGENT_BIN` / `VK_AGENT_HTTP_BIN` override the path). Models stay
|
|
167
|
+
separated: this CLI is the human client, the agent binaries are the
|
|
168
|
+
mandate-scoped machine clients.
|
|
169
|
+
- `agent mandate --entry <id|libellé> [--entry …] --bin <nom> [--ttl-days N]
|
|
170
|
+
[--prefixes <url,…>]` asks the phone for a mandate: it creates the pair
|
|
171
|
+
session and attaches the **request** (entries, binary, domains, lifetime) to
|
|
172
|
+
it, then delegates the QR/wait loop to `vaultkeepr-agent mandate`. On the
|
|
173
|
+
phone, the scanned session pre-fills the emission screen; Justin reviews and
|
|
174
|
+
confirms, and **the phone signs** — the terminal never seals a mandate.
|
|
175
|
+
Default domains come from each entry's service URL origin, the same default
|
|
176
|
+
the mobile screen applies; `--prefixes` overrides them for every entry and
|
|
177
|
+
warns when an entry URL falls outside them. Old phone builds ignore the
|
|
178
|
+
additive field and keep the manual flow.
|
|
179
|
+
- Exit codes: `0` success, `1` runtime error (network, vault, clipboard),
|
|
180
|
+
`2` usage. `--help` on every command.
|
|
181
|
+
|
|
182
|
+
`--offline` skips the network pass and works on the sealed local vault.
|
|
183
|
+
|
|
184
|
+
## Interactive session (bare `vaultkeepr`)
|
|
185
|
+
|
|
186
|
+
On a TTY, `vaultkeepr` with no command opens the session: the banner, then a
|
|
187
|
+
menu (`List entries`, `Copy a value`, `Add an entry`, `Status`, `Sync once`,
|
|
188
|
+
`Pair this terminal`, `Mandate an agent`, `Agent mandates`, `Quit`).
|
|
189
|
+
|
|
190
|
+
- An action runs the **same** command function as the flag form and then the
|
|
191
|
+
menu is shown again, separated by a blank line. Only `Quit` or `Ctrl-C`
|
|
192
|
+
leaves: the session exits `0`.
|
|
193
|
+
- `Ctrl-C` at any prompt leaves cleanly — no stack trace, no failed `add`.
|
|
194
|
+
- A failure inside an action is reported and the session stays open. The agent
|
|
195
|
+
entries also name the delegated binary's exit code when it is non-zero.
|
|
196
|
+
- `Mandate an agent` is a shell over `agent mandate`: multiselect on the
|
|
197
|
+
delegatable entries (`api` first, passkeys excluded), preset, then binary,
|
|
198
|
+
domains and lifetime pre-filled (preset + entry service URL origin, 30 days).
|
|
199
|
+
It prints the QR that carries the **request** and waits; the phone stays the
|
|
200
|
+
only signer and neither entry ever displays a value.
|
|
201
|
+
- `Agent mandates` is a read-only view: it delegates to `vaultkeepr-agent list`
|
|
202
|
+
(entries in scope, allowed commands/domains, expiry, staleness warnings).
|
|
203
|
+
- A command given as an argument, a piped stdin or a `--json` invocation stays
|
|
204
|
+
single-shot exactly as before: the loop is TTY-menu-only.
|
|
205
|
+
|
|
206
|
+
## Security checks enforced in this package
|
|
207
|
+
|
|
208
|
+
- A grep gate for value leaks: no `console.log`/`console.error` outside
|
|
209
|
+
`bin.ts`, and no call site prints `entry.password` except `get --reveal` /
|
|
210
|
+
`get --json` and the clipboard write.
|
|
211
|
+
- Secrets never in `argv`: `add` prompts for them, `copyToClipboard` passes them
|
|
212
|
+
on stdin.
|
|
213
|
+
- The sync state file (`sync-state.json`) carries timestamps, CIDs and error
|
|
214
|
+
messages only — never a value, never a decrypted entry.
|
|
215
|
+
|
|
216
|
+
## What is NOT live-tested here
|
|
217
|
+
|
|
218
|
+
No paired phone or production account was available on the build box, so:
|
|
219
|
+
|
|
220
|
+
- The **real** pair relay, upload, pointer and gateway acceptance of these
|
|
221
|
+
requests is **not** exercised. The wire shapes are the ones the extension and
|
|
222
|
+
mobile clients already send (read from their source), and the end-to-end
|
|
223
|
+
test (`src/__tests__/e2e.test.ts`) runs the full CLI against a **local mock**
|
|
224
|
+
of that API: `POST /api/pair` + status polling, `GET/POST /api/vault-cid`,
|
|
225
|
+
`POST /api/ipfs/upload` and a `/ipfs/<cid>` gateway. The mock rejects bad
|
|
226
|
+
proof formats, a missing signature and `pointerWrite !== false`.
|
|
227
|
+
- Real signature **verification** (viem `verifyMessage` on the server) is not
|
|
228
|
+
reproduced: the mock checks the dated format and the presence of the
|
|
229
|
+
signature.
|
|
230
|
+
- Passkey-only accounts (no secret key in the pairing payload) are refused at
|
|
231
|
+
pairing: there is no terminal-side passkey unlock.
|
|
232
|
+
- The QR is rendered and structurally tested; scanning it with the phone is a
|
|
233
|
+
manual step.
|
|
234
|
+
- No file lock between two `vaultkeepr sync` daemons on the same machine:
|
|
235
|
+
run one per config directory.
|