enclave-link 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bassim Shahidy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,389 @@
1
- # Temporary Holding Version
1
+ <h1>
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/header-dark.png" />
4
+ <img src="assets/header-light.png" width="838" alt="enclave" />
5
+ </picture>
6
+ </h1>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ Your AI agent needs your Netflix password. Instead of asking in chat, it sends you a link. You open it, type the password (or let your password manager fill it) and tap **Send**. It's locked in your browser before it leaves, so only your agent can open it. The agent keeps it in a vault of its own and uses it later without ever seeing it.
9
+
10
+ <p>
11
+ <picture>
12
+ <source media="(prefers-color-scheme: dark)" srcset="assets/ledger-dark.png" />
13
+ <img src="assets/ledger-light.png" width="300" alt="The enclave page in the ledger theme: hex is asking for Netflix, with email and password fields, a Send to hex button, and a ledger showing who holds the secret" />
14
+ </picture>
15
+ <picture>
16
+ <source media="(prefers-color-scheme: dark)" srcset="assets/field-dark.png" />
17
+ <img src="assets/field-light.png" width="300" alt="The same page in the field theme, on a full blue background" />
18
+ </picture>
19
+ </p>
20
+
21
+ ```
22
+ hex I need your Netflix login to finish this: https://moonlit-lynx-37.convex.site/k3Jd8vQ2…
23
+ you open it, type, tap Send
24
+ hex saved Netflix: email, password
25
+ ```
26
+
27
+ It works out of the box with a hosted relay. No accounts, no keys to set up, nothing for the person to install.
28
+
29
+ The vault also takes 2FA codes and passkeys. Bring in your whole [Proton Pass](#bring-your-proton-pass-vault) vault, and the agent types the current 2FA code or [signs in with a passkey](#passkeys) whose key never leaves the vault.
30
+
31
+ ## Set up your agent
32
+
33
+ **Agents with a shell** (Claude Code, Codex, Cursor, Gemini CLI, OpenCode and [30 more](https://github.com/vercel-labs/skills)) get it as a skill:
34
+
35
+ ```sh
36
+ npx skills add AVGVSTVS96/enclave
37
+ ```
38
+
39
+ The skill teaches the agent to send a link instead of asking in chat, and runs enclave with `npx`, so there's nothing else to install.
40
+
41
+ **Agents that use MCP** get the same thing as tools. Add the server below, and add this line to the agent's instructions, because tools alone don't stop a model from asking in chat:
42
+
43
+ > When you need a password, API key or other secret, ask for it with the enclave tools rather than in chat.
44
+
45
+ <details>
46
+ <summary><b>Claude Code</b></summary>
47
+
48
+ ```sh
49
+ /plugin marketplace add AVGVSTVS96/enclave
50
+ /plugin install enclave@enclave
51
+ ```
52
+
53
+ Or as MCP tools:
54
+
55
+ ```sh
56
+ claude mcp add enclave -- npx -y enclave-link mcp
57
+ ```
58
+
59
+ </details>
60
+
61
+ <details>
62
+ <summary><b>Codex</b></summary>
63
+
64
+ ```sh
65
+ codex mcp add enclave -- npx -y enclave-link mcp
66
+ ```
67
+
68
+ Codex stops a tool after 60 seconds by default. `wait_for_secret` waits up to 25 minutes a call (the agent calls it again if the person needs longer), so add this under `[mcp_servers.enclave]` in `~/.codex/config.toml`:
69
+
70
+ ```toml
71
+ tool_timeout_sec = 1800
72
+ ```
73
+
74
+ </details>
75
+
76
+ <details>
77
+ <summary><b>Cursor, Claude Desktop, Windsurf, Cline, Roo Code, Kiro, Junie, Factory</b></summary>
78
+
79
+ They all take the same JSON:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "enclave": { "command": "npx", "args": ["-y", "enclave-link", "mcp"] }
85
+ }
86
+ }
87
+ ```
88
+
89
+ | App | Where it goes |
90
+ | --- | --- |
91
+ | Cursor | `~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project |
92
+ | Claude Desktop | Settings → Developer → Edit Config |
93
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
94
+ | Cline | MCP Servers → Configure MCP Servers |
95
+ | Roo Code | `.roo/mcp.json` |
96
+ | Kiro | `~/.kiro/settings/mcp.json` |
97
+ | JetBrains Junie | `~/.junie/mcp/mcp.json` |
98
+ | Factory | `~/.factory/mcp.json` |
99
+
100
+ </details>
101
+
102
+ <details>
103
+ <summary><b>VS Code and GitHub Copilot</b></summary>
104
+
105
+ `.vscode/mcp.json`:
106
+
107
+ ```json
108
+ {
109
+ "servers": {
110
+ "enclave": { "type": "stdio", "command": "npx", "args": ["-y", "enclave-link", "mcp"] }
111
+ }
112
+ }
113
+ ```
114
+
115
+ </details>
116
+
117
+ <details>
118
+ <summary><b>Gemini CLI</b></summary>
119
+
120
+ ```sh
121
+ gemini extensions install https://github.com/AVGVSTVS96/enclave
122
+ ```
123
+
124
+ </details>
125
+
126
+ <details>
127
+ <summary><b>Grok Build</b></summary>
128
+
129
+ ```sh
130
+ grok mcp add enclave -- npx -y enclave-link mcp
131
+ ```
132
+
133
+ </details>
134
+
135
+ <details>
136
+ <summary><b>OpenCode</b></summary>
137
+
138
+ `opencode.json`:
139
+
140
+ ```json
141
+ {
142
+ "mcp": {
143
+ "enclave": { "type": "local", "command": ["npx", "-y", "enclave-link", "mcp"] }
144
+ }
145
+ }
146
+ ```
147
+
148
+ </details>
149
+
150
+ <details>
151
+ <summary><b>Zed</b></summary>
152
+
153
+ In Zed's `settings.json`:
154
+
155
+ ```json
156
+ {
157
+ "context_servers": {
158
+ "enclave": { "command": "npx", "args": ["-y", "enclave-link", "mcp"], "env": {} }
159
+ }
160
+ }
161
+ ```
162
+
163
+ </details>
164
+
165
+ <details>
166
+ <summary><b>OpenClaw, Hermes and other chat assistants</b></summary>
167
+
168
+ Assistants that talk to you through Telegram, Discord or WhatsApp should use the skill (`npx skills add AVGVSTVS96/enclave`), so the link reaches you in the chat. For MCP instead:
169
+
170
+ ```sh
171
+ openclaw mcp add enclave --command npx --arg -y --arg enclave-link --arg mcp
172
+ ```
173
+
174
+ Hermes, in `~/.hermes/config.yaml`:
175
+
176
+ ```yaml
177
+ mcp_servers:
178
+ enclave:
179
+ command: npx
180
+ args: ["-y", "enclave-link", "mcp"]
181
+ timeout: 1800
182
+ ```
183
+
184
+ </details>
185
+
186
+ <details>
187
+ <summary><b>Goose</b></summary>
188
+
189
+ Run `goose configure`, choose **Add Extension → Command-line Extension**, enter `npx -y enclave-link mcp`, and set the timeout to 1800 seconds.
190
+
191
+ </details>
192
+
193
+ **ChatGPT, Claude.ai and the Gemini and Grok apps** can't use enclave yet. They run in the cloud with no computer of yours behind them, and enclave keeps the vault on the computer where the agent runs. What would make them work is an enclave server you run yourself that the app reaches over remote MCP; it doesn't exist yet. Their desktop and coding-agent versions above work today.
194
+
195
+ **Your own code** can use the TypeScript SDK; see [SDK](#sdk).
196
+
197
+ ## How it works
198
+
199
+ ```
200
+ agent relay (Convex) person's browser
201
+ ───── ────────────── ────────────────
202
+ makes a one-time key pair
203
+ enclave ask ─── open ──────────▶ stores an empty request
204
+ ◀── link ───────────
205
+ sends https://…/<id>#key=… ──────────────────────────────────▶ opens the link
206
+ reads the key after #
207
+ (browsers never send it)
208
+ encrypts the answer
209
+ stores encrypted bytes ◀───────── POST, once
210
+ enclave wait ◀── live update ───
211
+ decrypts, saves to its vault
212
+ deletes the request ────────▶ gone
213
+ ```
214
+
215
+ - **The relay can't read anything.** The key it would need never leaves the agent's computer. The public key travels in the part of the link after `#`, which browsers don't send to servers, so the relay doesn't even learn what was asked for.
216
+ - **Links work once and expire.** The first answer wins, and the request is deleted as soon as the agent picks it up, or after 24 hours.
217
+ - **No polling.** `enclave wait` holds a live Convex subscription and wakes up the moment the answer lands.
218
+
219
+ ## Using a secret without seeing it
220
+
221
+ ```sh
222
+ enclave run KEY="OpenAI API key/key" sh -c 'curl -s https://api.openai.com/v1/models -H "Authorization: Bearer $KEY"'
223
+ ```
224
+
225
+ `run` works like `env`, except the values come from the vault, and anywhere one shows up in the command's output it's replaced with `[hidden KEY]`. Quote the command so your own shell doesn't expand `$KEY` first.
226
+
227
+ To type a password into a login form, pipe it straight into whatever does the typing: `enclave get Netflix password | <typer>`. A field named `totp` holds a 2FA setup key, and `enclave get GitHub totp` gives its current 6-digit code.
228
+
229
+ ## Passkeys
230
+
231
+ A field named `passkey` holds a passkey, and the agent signs in with it in Chrome without ever seeing its key:
232
+
233
+ ```sh
234
+ enclave passkey GitHub # then click the site's passkey sign-in
235
+ ```
236
+
237
+ `enclave passkey` arms the passkey for one sign-in, for up to 5 minutes. When the site asks for a passkey, enclave's Chrome extension hands the request to `enclave sign`, which signs it inside the vault and disarms the passkey. The private key never enters Chrome.
238
+
239
+ enclave signs the way Proton Pass does, with a signature counter of 0 every time. Sites read 0 as "this authenticator doesn't count", so a passkey keeps working from Proton and from enclave side by side.
240
+
241
+ A passkey's private key never comes out: `enclave get` and `enclave run` refuse passkey fields, and only `enclave sign` uses them.
242
+
243
+ Install the extension once per machine, from a clone of this repo, with Google Chrome on Linux. It's force-installed through Chrome's policy, so it loads in every profile:
244
+
245
+ ```sh
246
+ extension/install # signs with enclave on this machine
247
+ extension/install ssh my-server enclave sign # or with a vault on another machine
248
+ ```
249
+
250
+ ## Bring your Proton Pass vault
251
+
252
+ ```sh
253
+ enclave import proton # every vault
254
+ enclave import proton Work # or just the ones you name
255
+ ```
256
+
257
+ copies [Proton Pass](https://proton.me/pass) in through [pass-cli](https://github.com/protonpass/pass-cli): logins, 2FA, passkeys, notes, cards, SSH keys and custom fields, one item per Proton item, named by its title (two items with the same title get the account or a number after it). Proton keeps everything. Run it again to bring in what changed: each Proton item keeps its name across imports, a renamed one follows its new title, one you deleted in Proton leaves enclave too, and items saved by link are left alone. `~/.enclave/proton.json` remembers which item is which, by Proton's IDs and names only.
258
+
259
+ 2FA comes in as a `totp` field, so `enclave get <name> totp` gives the current code. Passkeys come in as a `passkey` field: Proton keeps each passkey's private key in the item, and enclave unpacks it the way Proton's own [export code](https://github.com/protonpass/proton-pass-common/blob/main/proton-pass-common/src/cxf/credentials/passkey.rs) does.
260
+
261
+ ## CLI
262
+
263
+ ```sh
264
+ npm install -g enclave-link # or run any of these with npx -y enclave-link
265
+ ```
266
+
267
+ | Command | Does |
268
+ | --- | --- |
269
+ | `enclave ask <name> [field…]` | Prints a link asking for `<name>`. Fields default to `password`. |
270
+ | `enclave wait <name>` | Waits for the answer and saves it. Exits 1 if the link expires first. |
271
+ | `enclave run VAR=<name>/<field>… <command…>` | Runs a command with secrets in its environment, hidden in its output. |
272
+ | `enclave get <name> <field>` | Prints a saved value, for a pipe or `$(…)`. |
273
+ | `enclave save <name> <field>` | Saves a value piped in, like a token the agent just made, without it passing through the chat. |
274
+ | `enclave passkey <name> [field]` | Arms a saved passkey for the next sign-in on its site, through the extension. |
275
+ | `enclave sign` | Signs a passkey request (JSON on stdin) with an armed passkey. The extension runs it. |
276
+ | `enclave import proton [vault…]` | Copies Proton Pass in through pass-cli: every vault, or the ones named. |
277
+ | `enclave list [search]` | Saved names and their fields, never values. A search matches names and websites. |
278
+ | `enclave rm <name>` | Deletes a saved item. |
279
+ | `enclave mcp` | Serves the tools below over MCP (stdio). |
280
+
281
+ `ENCLAVE_FROM` sets the name the page shows ("hex is asking for…"), `ENCLAVE_HOME` sets where the vault lives (`~/.enclave`), and `ENCLAVE_RELAY` points at your own relay.
282
+
283
+ ## MCP tools
284
+
285
+ | Tool | Does |
286
+ | --- | --- |
287
+ | `request_secret` | Makes the link. If the client supports [URL elicitation](https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation), it offers to open the link for the person right there; otherwise it gives the agent the link to send. |
288
+ | `wait_for_secret` | Returns the moment the person taps Send, with the field names it saved. |
289
+ | `run_with_secrets` | Runs a command with secrets in its environment and hides them in the output. |
290
+ | `sign_in_with_passkey` | Arms a saved passkey for the next sign-in on its site, then returns so the agent can click sign in. |
291
+ | `list_secrets` | Names and fields, never values, optionally only those matching a name or website. |
292
+
293
+ There's no tool that returns a secret's value.
294
+
295
+ ## SDK
296
+
297
+ ```ts
298
+ import { vault } from "enclave-link"
299
+
300
+ const { url, wait } = await vault.ask("Netflix", ["email", "password"])
301
+ // send url to the person
302
+ await wait()
303
+
304
+ await vault.run(["sh", "-c", 'curl -u "$EMAIL:$PASSWORD" https://example.com'], {
305
+ EMAIL: "Netflix/email",
306
+ PASSWORD: "Netflix/password",
307
+ })
308
+ ```
309
+
310
+ `vault` reads `ENCLAVE_FROM`, `ENCLAVE_HOME` and `ENCLAVE_RELAY`. For anything else, `openVault({ from, home, relay, store })` makes one of your own. It also has `get`, `list` and `remove`, the same as the CLI.
311
+
312
+ Answers are saved to `~/.enclave` by default. To keep them somewhere else, pass a `store`: any object with `get`, `put`, `remove` and `names`, like your own database. For a one-time answer that's never written to disk, keep it in memory:
313
+
314
+ ```ts
315
+ const answers = new Map()
316
+ const oneTime = openVault({
317
+ store: {
318
+ get: async (name) => answers.get(name),
319
+ put: async (name, item) => void answers.set(name, item),
320
+ remove: async (name) => void answers.delete(name),
321
+ names: async () => [...answers.keys()],
322
+ },
323
+ })
324
+ ```
325
+
326
+ ## Security
327
+
328
+ The encryption is [HPKE](https://www.rfc-editor.org/rfc/rfc9180) (RFC 9180) with X25519, HKDF-SHA256 and AES-128-GCM, built on the browser's own Web Crypto with no libraries, and tested against the RFC's test vectors. Answers are padded, so the relay can't even tell how long a password is.
329
+
330
+ The vault keeps each item encrypted in `~/.enclave/items`, sealed to the vault's own key in `~/.enclave/key.json` and bound to the item's name. The item files are safe to back up anywhere. The key is what unlocks them, so treat it like an SSH key.
331
+
332
+ What enclave can't protect against:
333
+
334
+ - **Whoever runs the relay sends you the page.** Your browser downloads the page, including the code that locks your password, from the relay each time you open a link. What the relay stores can't be read, but if someone took over the relay's Convex account, they could change the page to copy what you type before locking it. Every website that encrypts in your browser works this way. The page's script is under 100 lines in [`page/page.ts`](page/page.ts) plus the encryption in [`src/hpke.ts`](src/hpke.ts), served as one file with a strict Content Security Policy, so you can read exactly what it runs. If you'd rather trust nobody's relay, [host your own](#host-your-own).
335
+ - **Anyone with the link can answer it first.** They still can't read anything, but they could send a fake answer. If that happens, the page says "This link doesn't work anymore" when you open it.
336
+ - **Phishing.** A link can say anyone is asking. Only send secrets to agents you asked for help.
337
+ - **An agent that wants to see a secret can.** enclave keeps secrets out of the chat and out of tool results, and `run` hides their exact values in output. But an agent with a shell on the same computer could still read its own vault. enclave stops secrets from leaking by accident, not a model that's trying.
338
+
339
+ ## Host your own
340
+
341
+ The relay is a [Convex](https://convex.dev) app, so self-hosting is a few commands, on Convex's cloud or the [open-source Convex backend](https://github.com/get-convex/convex-backend):
342
+
343
+ ```sh
344
+ git clone https://github.com/AVGVSTVS96/enclave && cd enclave
345
+ npm install
346
+ npm run dev -- --once # sign in to Convex and create your project
347
+ npm run deploy
348
+ ```
349
+
350
+ Then point agents at it with `ENCLAVE_RELAY=https://<your-deployment>.convex.cloud`.
351
+
352
+ ### Themes
353
+
354
+ The page comes in two themes, both following the system's light or dark mode:
355
+
356
+ - **ledger** (the default): calm and white. A highlighter marks what's readable, and a small ledger shows who holds the secret: you, the relay, or your agent.
357
+ - **field**: the whole screen is one color. After you send, a track shows where it went, and a used link turns gray.
358
+
359
+ Pick one, and optionally one color, when you deploy:
360
+
361
+ ```sh
362
+ ENCLAVE_THEME=field ENCLAVE_COLOR=#ff4a2e npm run deploy
363
+ ```
364
+
365
+ `ENCLAVE_COLOR` is ledger's highlight or field's background, and text on it switches between white and ink to stay readable. To make your own theme, copy [`page/themes/ledger.css`](page/themes/ledger.css) and point `ENCLAVE_THEME` at your file. A theme is plain CSS over the page's fixed markup, and any fonts or images it links to get built into the page, which loads nothing from anywhere else.
366
+
367
+ ## Develop
368
+
369
+ ```sh
370
+ npm run dev # builds the page and runs a Convex dev deployment
371
+ npm run check # typecheck and tests
372
+ npm run build # bundles the CLI, SDK and types into dist/
373
+ ```
374
+
375
+ | Path | What's there |
376
+ | --- | --- |
377
+ | `convex/` | The relay: requests, rate limits and two HTTP routes, in 133 lines |
378
+ | `page/` | The page people see and its two themes, built into one HTML file by `scripts/page.ts` |
379
+ | `src/hpke.ts` | The encryption, shared by the page and the agent |
380
+ | `src/vault.ts` | `ask`, `wait`, `get`, `run` and the rest of the SDK |
381
+ | `src/mcp.ts` | The MCP server |
382
+ | `src/passkey.ts` | Signing a passkey sign-in |
383
+ | `extension/` | The Chrome extension that sends passkey requests to `enclave sign` |
384
+ | `src/proton.ts` | Reading a Proton Pass vault, passkeys included |
385
+ | `skills/enclave/` | The Agent Skill |
386
+
387
+ ## License
388
+
389
+ MIT