sigild 0.0.10 → 0.0.12

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.
Files changed (162) hide show
  1. package/README.md +62 -11
  2. package/SECURITY.md +69 -0
  3. package/THREAT_MODEL.md +14 -3
  4. package/dist/src/audit/log.d.ts.map +1 -1
  5. package/dist/src/audit/log.js +3 -1
  6. package/dist/src/audit/log.js.map +1 -1
  7. package/dist/src/bin/sigil-mcp.js +73 -9
  8. package/dist/src/bin/sigil-mcp.js.map +1 -1
  9. package/dist/src/cli/args.d.ts.map +1 -1
  10. package/dist/src/cli/args.js.map +1 -1
  11. package/dist/src/cli/index.d.ts +1 -1
  12. package/dist/src/cli/index.d.ts.map +1 -1
  13. package/dist/src/cli/index.js +1 -1
  14. package/dist/src/cli/index.js.map +1 -1
  15. package/dist/src/cli/main.d.ts.map +1 -1
  16. package/dist/src/cli/main.js +41 -3
  17. package/dist/src/cli/main.js.map +1 -1
  18. package/dist/src/cli/portal.d.ts.map +1 -1
  19. package/dist/src/cli/portal.js +7 -3
  20. package/dist/src/cli/portal.js.map +1 -1
  21. package/dist/src/cli/rpc.d.ts +24 -0
  22. package/dist/src/cli/rpc.d.ts.map +1 -0
  23. package/dist/src/cli/rpc.js +68 -0
  24. package/dist/src/cli/rpc.js.map +1 -0
  25. package/dist/src/cli/status.d.ts.map +1 -1
  26. package/dist/src/cli/status.js +1 -1
  27. package/dist/src/cli/status.js.map +1 -1
  28. package/dist/src/cli/unlock.d.ts.map +1 -1
  29. package/dist/src/cli/unlock.js +1 -1
  30. package/dist/src/cli/unlock.js.map +1 -1
  31. package/dist/src/confirm/config.d.ts +29 -2
  32. package/dist/src/confirm/config.d.ts.map +1 -1
  33. package/dist/src/confirm/config.js +52 -0
  34. package/dist/src/confirm/config.js.map +1 -1
  35. package/dist/src/confirm/index.d.ts +3 -3
  36. package/dist/src/confirm/index.d.ts.map +1 -1
  37. package/dist/src/confirm/index.js +2 -2
  38. package/dist/src/confirm/index.js.map +1 -1
  39. package/dist/src/confirm/ntfy.d.ts.map +1 -1
  40. package/dist/src/confirm/ntfy.js +5 -5
  41. package/dist/src/confirm/ntfy.js.map +1 -1
  42. package/dist/src/control/broadcast.d.ts.map +1 -1
  43. package/dist/src/control/broadcast.js +7 -4
  44. package/dist/src/control/broadcast.js.map +1 -1
  45. package/dist/src/control/client.d.ts.map +1 -1
  46. package/dist/src/control/client.js +5 -2
  47. package/dist/src/control/client.js.map +1 -1
  48. package/dist/src/control/protocol.d.ts.map +1 -1
  49. package/dist/src/control/protocol.js.map +1 -1
  50. package/dist/src/control/server.d.ts.map +1 -1
  51. package/dist/src/control/server.js +17 -4
  52. package/dist/src/control/server.js.map +1 -1
  53. package/dist/src/crypto/aead.d.ts.map +1 -1
  54. package/dist/src/crypto/aead.js.map +1 -1
  55. package/dist/src/crypto/index.d.ts +1 -1
  56. package/dist/src/crypto/index.d.ts.map +1 -1
  57. package/dist/src/crypto/index.js +1 -1
  58. package/dist/src/crypto/index.js.map +1 -1
  59. package/dist/src/crypto/keyfile.d.ts.map +1 -1
  60. package/dist/src/crypto/keyfile.js +1 -0
  61. package/dist/src/crypto/keyfile.js.map +1 -1
  62. package/dist/src/daemon/handles.d.ts.map +1 -1
  63. package/dist/src/daemon/handles.js +1 -1
  64. package/dist/src/daemon/handles.js.map +1 -1
  65. package/dist/src/daemon/index.d.ts +1 -1
  66. package/dist/src/daemon/index.d.ts.map +1 -1
  67. package/dist/src/daemon/index.js +1 -1
  68. package/dist/src/daemon/index.js.map +1 -1
  69. package/dist/src/daemon/methods.d.ts.map +1 -1
  70. package/dist/src/daemon/methods.js +12 -6
  71. package/dist/src/daemon/methods.js.map +1 -1
  72. package/dist/src/daemon/passphrase.d.ts.map +1 -1
  73. package/dist/src/daemon/passphrase.js.map +1 -1
  74. package/dist/src/eth/address.d.ts.map +1 -1
  75. package/dist/src/eth/address.js +1 -1
  76. package/dist/src/eth/address.js.map +1 -1
  77. package/dist/src/eth/index.d.ts +2 -2
  78. package/dist/src/eth/index.d.ts.map +1 -1
  79. package/dist/src/eth/index.js +2 -2
  80. package/dist/src/eth/index.js.map +1 -1
  81. package/dist/src/eth/rlp.js +1 -1
  82. package/dist/src/eth/rlp.js.map +1 -1
  83. package/dist/src/eth/secp.d.ts.map +1 -1
  84. package/dist/src/eth/secp.js.map +1 -1
  85. package/dist/src/eth/sign-message.d.ts.map +1 -1
  86. package/dist/src/eth/sign-message.js.map +1 -1
  87. package/dist/src/eth/sign-tx.d.ts.map +1 -1
  88. package/dist/src/eth/sign-tx.js +13 -4
  89. package/dist/src/eth/sign-tx.js.map +1 -1
  90. package/dist/src/eth/sign-typed.d.ts.map +1 -1
  91. package/dist/src/eth/sign-typed.js.map +1 -1
  92. package/dist/src/hooks/bip39-wordlist.d.ts +12 -0
  93. package/dist/src/hooks/bip39-wordlist.d.ts.map +1 -0
  94. package/dist/src/hooks/bip39-wordlist.js +2061 -0
  95. package/dist/src/hooks/bip39-wordlist.js.map +1 -0
  96. package/dist/src/hooks/bip39.d.ts +19 -0
  97. package/dist/src/hooks/bip39.d.ts.map +1 -0
  98. package/dist/src/hooks/bip39.js +101 -0
  99. package/dist/src/hooks/bip39.js.map +1 -0
  100. package/dist/src/hooks/command-scanner.d.ts.map +1 -1
  101. package/dist/src/hooks/command-scanner.js +45 -9
  102. package/dist/src/hooks/command-scanner.js.map +1 -1
  103. package/dist/src/hooks/index.d.ts +1 -1
  104. package/dist/src/hooks/index.d.ts.map +1 -1
  105. package/dist/src/hooks/index.js +1 -1
  106. package/dist/src/hooks/index.js.map +1 -1
  107. package/dist/src/hooks/install.js +1 -1
  108. package/dist/src/hooks/install.js.map +1 -1
  109. package/dist/src/hooks/protocol.d.ts.map +1 -1
  110. package/dist/src/hooks/protocol.js +1 -1
  111. package/dist/src/hooks/protocol.js.map +1 -1
  112. package/dist/src/hooks/redactor.d.ts +10 -1
  113. package/dist/src/hooks/redactor.d.ts.map +1 -1
  114. package/dist/src/hooks/redactor.js +34 -3
  115. package/dist/src/hooks/redactor.js.map +1 -1
  116. package/dist/src/mcp/protocol.d.ts.map +1 -1
  117. package/dist/src/mcp/protocol.js +5 -1
  118. package/dist/src/mcp/protocol.js.map +1 -1
  119. package/dist/src/mcp/server.d.ts +8 -0
  120. package/dist/src/mcp/server.d.ts.map +1 -1
  121. package/dist/src/mcp/server.js +8 -1
  122. package/dist/src/mcp/server.js.map +1 -1
  123. package/dist/src/mcp/tools.d.ts.map +1 -1
  124. package/dist/src/mcp/tools.js +6 -3
  125. package/dist/src/mcp/tools.js.map +1 -1
  126. package/dist/src/policy/evaluate.js +2 -2
  127. package/dist/src/policy/evaluate.js.map +1 -1
  128. package/dist/src/policy/index.d.ts +1 -1
  129. package/dist/src/policy/index.d.ts.map +1 -1
  130. package/dist/src/policy/index.js +1 -1
  131. package/dist/src/policy/index.js.map +1 -1
  132. package/dist/src/policy/loader.d.ts.map +1 -1
  133. package/dist/src/policy/loader.js.map +1 -1
  134. package/dist/src/policy/types.d.ts.map +1 -1
  135. package/dist/src/policy/types.js.map +1 -1
  136. package/dist/src/qr/encode.d.ts +10 -1
  137. package/dist/src/qr/encode.d.ts.map +1 -1
  138. package/dist/src/qr/encode.js +2 -2
  139. package/dist/src/qr/encode.js.map +1 -1
  140. package/dist/src/qr/index.d.ts +1 -1
  141. package/dist/src/qr/index.d.ts.map +1 -1
  142. package/dist/src/qr/index.js.map +1 -1
  143. package/dist/src/rpc/fill.d.ts +16 -0
  144. package/dist/src/rpc/fill.d.ts.map +1 -0
  145. package/dist/src/rpc/fill.js +202 -0
  146. package/dist/src/rpc/fill.js.map +1 -0
  147. package/dist/src/rpc/index.d.ts +4 -0
  148. package/dist/src/rpc/index.d.ts.map +1 -0
  149. package/dist/src/rpc/index.js +4 -0
  150. package/dist/src/rpc/index.js.map +1 -0
  151. package/dist/src/rpc/server.d.ts +63 -0
  152. package/dist/src/rpc/server.d.ts.map +1 -0
  153. package/dist/src/rpc/server.js +303 -0
  154. package/dist/src/rpc/server.js.map +1 -0
  155. package/dist/src/rpc/upstream.d.ts +48 -0
  156. package/dist/src/rpc/upstream.d.ts.map +1 -0
  157. package/dist/src/rpc/upstream.js +74 -0
  158. package/dist/src/rpc/upstream.js.map +1 -0
  159. package/dist/src/svm/transaction.d.ts.map +1 -1
  160. package/dist/src/svm/transaction.js +13 -4
  161. package/dist/src/svm/transaction.js.map +1 -1
  162. package/package.json +14 -5
package/README.md CHANGED
@@ -4,14 +4,14 @@
4
4
 
5
5
  `sigil` is a local signing tool and Claude Code integration that lets agentic coding tools use private keys without ever putting key material in the model's context window.
6
6
 
7
- **Status:** pre-alpha. The MCP server, CLI, unlock flow, ward hooks, policy engine (static checks), and out-of-band confirmation via ntfy all work end-to-end. Rolling-window value caps and EIP-712 domain allowlists are not yet implemented. Until they land — and until the supply-chain attestations promised for v0.1.0 ship — **do not use this with real funds yet.** Build plan lives in the [tracking issue](https://github.com/cdrn/sigil/issues/9).
7
+ **Status:** pre-alpha. The MCP server, CLI, unlock flow, ward hooks, policy engine (static checks), out-of-band confirmation via ntfy, Solana signing, and the JSON-RPC signing proxy (Foundry/Hardhat) all work end-to-end. Rolling-window value caps and EIP-712 domain allowlists are not yet implemented. Until they land — and until the supply-chain attestations promised for v0.1.0 ship — **do not use this with real funds yet.** Build plan lives in the [tracking issue](https://github.com/cdrn/sigil/issues/9).
8
8
 
9
9
  ## What it is
10
10
 
11
- One MCP server process, four bins, six runtime deps (all pinned, zero transitive):
11
+ One MCP server process, four bins (plus a legacy `sigild` alias), six runtime deps (all pinned, zero transitive):
12
12
 
13
13
  1. **`sigil-mcp`** — the only thing that runs. Claude Code spawns it per session via your `mcpServers` config; it dies when Claude exits. Holds unlocked keys in process memory (zeroized on shutdown, `sigil lock`, or unlock-failure; mlock against swap is planned). Keys at rest are encrypted with XChaCha20-Poly1305 and an Argon2id-derived key. Signs over stdio using a DIY MCP wire protocol (~200 lines, no SDK dep). Claude never sees key material — only opaque handles like `evm:executor`.
14
- 2. **`sigil`** — control CLI. `init`, `status`, `portal add`/`list`/`remove`, `unlock`, `lock`.
14
+ 2. **`sigil`** — control CLI. `init`, `status`, `portal new`/`add`/`list`/`qr`/`remove`, `policy show`/`init`, `unlock`, `lock`.
15
15
  3. **`sigil-hook-pre` / `sigil-hook-post`** — Claude Code hook binaries that block reads of common key paths and redact key-shaped strings from tool output.
16
16
 
17
17
  `sigil-mcp` boots **locked**: empty in-memory handle table, no keys loaded. Sign methods return `DAEMON_LOCKED` (-32003) with a "run sigil unlock" message until you push the passphrase in from a separate terminal via `sigil unlock`. That CLI connects to a per-session Unix socket at `~/.sigil/control/<pid>.sock` (0600) that `sigil-mcp` opens at startup — and fans out to every such socket so one `sigil unlock` reaches all open windows. After unlock, signs work for the rest of the session; `sigil lock` zeroizes the table without killing the process.
@@ -22,7 +22,7 @@ Sign methods exposed today: EIP-191 personal_sign, EIP-1559 + legacy transaction
22
22
 
23
23
  - Not a hardware wallet replacement. If you can use a Ledger or YubiKey, do that.
24
24
  - Not a custody solution. It runs on your laptop or VPS and protects you from one specific class of failure: leaking key material through an LLM agent.
25
- - A first cut of *bounding signing authority* via the policy engine — but not the full thing. v1 covers static checks (chain ID, destination allowlist, per-tx value cap, function-selector allowlist, on/off toggles for personal_sign and EIP-712). Rolling-window caps, EIP-712 domain allowlists, and out-of-band human confirmation are tracked in [#3](https://github.com/cdrn/sigil/issues/3) + [#4](https://github.com/cdrn/sigil/issues/4) and will land incrementally.
25
+ - A first cut of *bounding signing authority* via the policy engine — but not the full thing. Shipped: static checks (chain ID, destination allowlist, per-tx value cap, function-selector allowlist, contract-creation gating, on/off toggles for personal_sign and EIP-712) plus out-of-band human confirmation via ntfy. Rolling-window caps and EIP-712 domain allowlists are tracked in [#3](https://github.com/cdrn/sigil/issues/3) and will land incrementally.
26
26
 
27
27
  ## Install
28
28
 
@@ -30,9 +30,9 @@ Sign methods exposed today: EIP-191 personal_sign, EIP-1559 + legacy transaction
30
30
  npm install -g sigild
31
31
  ```
32
32
 
33
- This drops four binaries on your `$PATH`: `sigil`, `sigil-mcp`, `sigil-hook-pre`, `sigil-hook-post`. (The package name on npm is `sigild` for legacy reasons; the bins do not include a daemon any more.)
33
+ This drops four binaries on your `$PATH`: `sigil`, `sigil-mcp`, `sigil-hook-pre`, `sigil-hook-post` (plus `sigild`, a legacy alias for `sigil-mcp`). (The package name on npm is `sigild` for legacy reasons; the bins do not include a daemon any more.)
34
34
 
35
- Requires Node 22+.
35
+ Requires Node 22+, macOS or Linux. (The CLI ↔ session control channel uses Unix domain sockets; Windows is untested and currently unsupported.)
36
36
 
37
37
  ## Quick start
38
38
 
@@ -92,7 +92,7 @@ sigil portal new <handle> [--strict]
92
92
  sigil portal add <handle> --key-file <path> [--no-remove-source] [--strict]
93
93
  Import an existing private key. Encrypts it with your passphrase
94
94
  and stores at ~/.sigil/keys/<handle>.sigil (mode 0600). Handle
95
- format is <kind>:<name> where kind is "eth". The source key file
95
+ format is <kind>:<name> where kind is "evm". The source key file
96
96
  is deleted by default — pass --no-remove-source to keep it.
97
97
  Also writes ~/.sigil/policy/<handle>.toml — permissive by default
98
98
  (signs anything), or --strict for a locked-down template you fill
@@ -109,9 +109,20 @@ sigil policy init <handle> [--strict]
109
109
  or remove it first. Defaults to permissive; --strict writes the
110
110
  locked-down template.
111
111
 
112
+ sigil rpc init <handle> --upstream <url> [--port <n>]
113
+ Enable the JSON-RPC signing proxy for a portal: generates a strong
114
+ auth token and appends the [rpc] block to ~/.sigil/config.toml
115
+ (refuses if one exists; preserves the rest of the file). Prints the
116
+ ready-to-paste authenticated endpoint and forge invocation. Restart
117
+ Claude Code sessions to pick it up.
118
+
112
119
  sigil portal list
113
- List the encrypted keyfiles on disk with their derived addresses.
114
- Requires the passphrase.
120
+ List the encrypted keyfiles on disk with their derived addresses
121
+ (EVM + Solana). Requires the passphrase.
122
+
123
+ sigil portal qr <handle>
124
+ Render a portal's address as a terminal QR code (for funding it from
125
+ a phone wallet). Requires the passphrase.
115
126
 
116
127
  sigil portal remove <handle>
117
128
  Delete a keyfile from disk.
@@ -196,6 +207,46 @@ Install the ntfy app on your phone, subscribe to that topic, and you'll get a pu
196
207
 
197
208
  If any policy file sets `require_confirm_above_wei` but no transport is configured, `sigil-mcp` refuses to start with a clear error rather than silently degrading every confirm-gated sign to a deny.
198
209
 
210
+ ## JSON-RPC signing proxy (Foundry / Hardhat / any web3 tool)
211
+
212
+ sigil can expose a local JSON-RPC endpoint that makes any portal a drop-in signer for tooling that expects an unlocked node account — the same pattern Clef and web3signer use. Contract bytecode goes from `forge` straight into sigil; it never transits the agent's context or an MCP tool parameter.
213
+
214
+ Enable it with one command (generates the token, writes the config block, prints the forge invocation):
215
+
216
+ ```sh
217
+ sigil rpc init evm:bot --upstream https://sepolia.example/v3/KEY
218
+ ```
219
+
220
+ ...or by hand in `~/.sigil/config.toml`:
221
+
222
+ ```toml
223
+ [rpc]
224
+ portal = "evm:bot" # which portal signs
225
+ upstream = "https://sepolia.example/v3/KEY" # real node for everything else
226
+ token = "<openssl rand -hex 24>" # required — guards the endpoint
227
+ # port = 8547 # default 8547 (clear of anvil's 8545)
228
+ ```
229
+
230
+ Then point any tool at it, with the token as the Basic-auth password:
231
+
232
+ ```bash
233
+ forge script script/Deploy.s.sol \
234
+ --rpc-url "http://sigil:<token>@127.0.0.1:8547" \
235
+ --unlocked --sender 0xYourPortalAddress --broadcast
236
+ ```
237
+
238
+ The proxy serves three things with the portal key and forwards everything else (`eth_call`, `eth_estimateGas`, `eth_getTransactionReceipt`, …) to the upstream:
239
+
240
+ - `eth_accounts` → the portal address (empty while locked)
241
+ - `eth_signTransaction` → fills nonce/gas/fees if missing, signs, returns the raw tx
242
+ - `eth_sendTransaction` → same, then broadcasts via the upstream and returns the hash
243
+
244
+ **Security properties.** The listener binds `127.0.0.1` only; every request must present the config token (constant-time compared) and a loopback `Host` header (DNS-rebinding defence). Signing runs through the *identical* daemon pipeline as the MCP tools — policy checks, the out-of-band confirm gate, and the hash-chained audit log all apply, so this surface adds a transport, not a privilege. The filled transaction carries the **upstream's** chain id, so a strict policy's `chain_ids` allowlist binds the proxy to the network you configured. Message/typed-data methods (`eth_sign`, `personal_sign`, `eth_signTypedData*`) are rejected on this surface — use the MCP tools, which have their own policy toggles. A strict policy with `allow_contract_creation = true` gives you confirm-gated `forge script` deploys: forge submits, your phone buzzes, the tx signs when you tap approve.
245
+
246
+ With multiple Claude windows open, each `sigil-mcp` tries to bind the port; the first wins and the rest log and continue — any one session's proxy serves the machine.
247
+
248
+ When the proxy is enabled, sigil-mcp advertises the endpoint — including the authenticated URL — in the `sigil_eth_sign_transaction` tool description, so the agent discovers it on its own and reaches for `forge --unlocked` instead of transcribing bytecode through the MCP tool. This is deliberate: the token gates other local software, not your agent (see THREAT_MODEL.md).
249
+
199
250
  ## Solana (SVM)
200
251
 
201
252
  Every portal also controls a **Solana address**, derived from the *same secret*. EVM uses secp256k1; Solana uses ed25519 — different curves, so you can't share a public key. But the portal's raw 32-byte secret doubles as an ed25519 seed, yielding one secret → two addresses:
@@ -222,7 +273,7 @@ Relevant policy fields (`~/.sigil/policy/<handle>.toml`): `allow_svm_message_sig
222
273
 
223
274
  Key-management libraries die from supply chain compromise, not from clever attacks on the code. Given the npm ecosystem in 2026 (Mini Shai-Hulud, Axios, pgserve, TanStack), `sigil` commits to:
224
275
 
225
- - **Zero install scripts.** No `postinstall`, `preinstall`, `prepare`. CI-enforced (planned: a CI guard that fails if any dep adds one).
276
+ - **Zero install scripts.** No `postinstall`, `preinstall`, `prepare`. CI-enforced: every PR runs a guard that fails if any package in the resolved tree declares one.
226
277
  - **Six runtime deps, all version-pinned** (no caret ranges), all zero-transitive — the entire `npm ls --omit dev` tree is exactly these six packages:
227
278
  - [`@noble/ciphers`](https://github.com/paulmillr/noble-ciphers) for XChaCha20-Poly1305
228
279
  - [`@noble/hashes`](https://github.com/paulmillr/noble-hashes) for Argon2id, keccak256, sha2/sha512, HMAC
@@ -272,7 +323,7 @@ See [THREAT_MODEL.md](./THREAT_MODEL.md). Read it before trusting this with anyt
272
323
  git clone https://github.com/cdrn/sigil
273
324
  cd sigil
274
325
  npm install # respects .npmrc ignore-scripts=true
275
- npm test # builds + runs ~330 tests; should finish in under 10s
326
+ npm test # builds + runs 600+ tests; should finish in under 15s
276
327
  ```
277
328
 
278
329
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for the PR-per-layer workflow.
package/SECURITY.md ADDED
@@ -0,0 +1,69 @@
1
+ # Security Policy
2
+
3
+ `sigil` handles private keys. Security reports are the most valuable
4
+ contribution the project can receive, and they are always welcome.
5
+
6
+ ## Reporting a vulnerability
7
+
8
+ **Please report privately — do not open a public issue for a vulnerability.**
9
+
10
+ Use GitHub's private vulnerability reporting:
11
+ [**Report a vulnerability**](https://github.com/cdrn/sigil/security/advisories/new).
12
+ This opens a private advisory visible only to you and the maintainers.
13
+
14
+ If you cannot use GitHub advisories, email the maintainer listed on the
15
+ [GitHub profile](https://github.com/cdrn) with the subject line
16
+ `sigil security`.
17
+
18
+ A good report includes:
19
+
20
+ - the affected version (`npm ls sigild`) or commit,
21
+ - what the issue is and why it matters (impact),
22
+ - a minimal reproduction — **please use canary/dummy values, never real
23
+ keys, seed phrases, or credentials**, and
24
+ - any suggested fix, if you have one.
25
+
26
+ You do not need a working exploit. A precise description of the flaw is
27
+ enough.
28
+
29
+ ## What to expect
30
+
31
+ This is a small pre-alpha project maintained on a best-effort basis, so
32
+ timelines are not contractual, but the intent is:
33
+
34
+ - acknowledge your report within a few days,
35
+ - confirm or dispute it, and agree a fix and disclosure timeline with you,
36
+ - credit you in the advisory and release notes unless you ask otherwise,
37
+ - publish a GitHub Security Advisory (GHSA) and a patched release when the
38
+ fix ships.
39
+
40
+ Coordinated disclosure is appreciated: please give a reasonable window to
41
+ ship a fix before any public write-up.
42
+
43
+ ## Scope
44
+
45
+ In scope — anything that undermines sigil's core promise ("Claude can sign,
46
+ but never see") or its documented controls, for example:
47
+
48
+ - key material reaching the agent's context, transcripts, or logs,
49
+ - a signing path that bypasses the policy engine, confirm gate, or audit
50
+ log,
51
+ - the ward hooks (path blocker / output redactor) not doing what
52
+ [`THREAT_MODEL.md`](./THREAT_MODEL.md) says they do,
53
+ - the JSON-RPC signing proxy signing without the documented authentication
54
+ or policy checks,
55
+ - supply-chain integrity of the published `sigild` package.
56
+
57
+ Out of scope — see the "Out of scope" and "Assumptions" sections of
58
+ [`THREAT_MODEL.md`](./THREAT_MODEL.md). In particular, an attacker who
59
+ already has local code execution or can read process memory is explicitly
60
+ outside the model.
61
+
62
+ Read [`THREAT_MODEL.md`](./THREAT_MODEL.md) before reporting — it states
63
+ what sigil does and does not defend against, which will tell you whether a
64
+ behavior is a bug or a documented limitation.
65
+
66
+ ## Supported versions
67
+
68
+ Pre-alpha: only the latest published `sigild` version receives security
69
+ fixes. Pin to an exact version and read the diff before upgrading.
package/THREAT_MODEL.md CHANGED
@@ -31,6 +31,17 @@ The unlock path:
31
31
 
32
32
  This shape was chosen so the agent has no path to trigger unlock — only a human at the local TTY can. `sigil lock` zeroizes the in-memory table without killing the process; subsequent signs return `DAEMON_LOCKED` again until the next `sigil unlock`.
33
33
 
34
+ ### The JSON-RPC signing proxy surface
35
+
36
+ With a `[rpc]` block in `~/.sigil/config.toml`, `sigil-mcp` additionally listens on `127.0.0.1:<port>` and serves `eth_accounts` / `eth_signTransaction` / `eth_sendTransaction` with the configured portal's key (proxying every other method to the configured upstream node). This is a deliberate second way to reach a key, added so Foundry/Hardhat-class tooling can sign without transaction payloads transiting the agent's context. Its containment:
37
+
38
+ - **Same pipeline, no proxy privilege.** Proxy signs are dispatched through the identical daemon path as the MCP tools — policy evaluation, the out-of-band confirm gate, and the hash-chained audit log all apply. There is no signing branch unique to the proxy.
39
+ - **Mandatory shared token.** Every request must present the config token (min 16 chars, constant-time compared) as a Bearer credential or the Basic-auth password. Without it, any local process could ask a permissive-mode portal to sign arbitrary transactions. The token lives in `~/.sigil/config.toml` (0700 home dir) — it gates *other software on the machine*, not the user's own agent: when the proxy is enabled, sigil-mcp deliberately advertises the authenticated URL in the `sigil_eth_sign_transaction` tool description so the agent can drive forge/hardhat against it (the ward hooks block it from reading the config file directly). The token therefore appears in agent context and transcripts; that is accepted — it is useless without local code execution, at which point the attacker already has the config file.
40
+ - **Loopback binding + Host allowlist.** The listener binds 127.0.0.1 only and rejects any request whose `Host` header is not a loopback name, which closes DNS-rebinding attacks from a browser tab even if the token leaks into a page-visible URL.
41
+ - **Chain binding.** The proxy fills transactions with the *upstream's* `eth_chainId`; a strict policy's `chain_ids` allowlist therefore pins the proxy to the intended network, and a client-supplied `chainId` that disagrees with the upstream is rejected outright.
42
+ - **Fail-closed inheritance.** Locked handle table, policy deny, confirm deny/timeout, missing confirm transport — each surfaces as a JSON-RPC error and no signature is produced. `eth_sign`/`personal_sign`/`eth_signTypedData*` are rejected on this surface entirely.
43
+ - **Residual risk, stated plainly:** with a **permissive** portal and the token, anything that can POST to loopback signs at will — same authority the MCP tools already grant the agent, now reachable by any tool the user (or agent) runs. Use a strict policy on any proxy-exposed portal that holds real value, and a confirm threshold for the rest. The upstream node also becomes an availability and privacy dependency: it sees every proxied call and the broadcast of every signed tx.
44
+
34
45
  ## In scope
35
46
 
36
47
  ### 1. Preventing key ingestion by the agent
@@ -41,8 +52,8 @@ Defenses:
41
52
  - Keys live in `sigil-mcp`'s memory only, unlocked from encrypted at-rest storage. Plaintext is zeroized on shutdown, on `sigil lock`, and on any failed unlock. mlock against swap is planned (requires a native module distributed as bundled prebuilds, see Known limitations).
42
53
  - The MCP interface exposes only opaque handles (`eth:executor`), never key bytes.
43
54
  - The unlock passphrase is delivered out-of-band via the control socket, not through the agent. The agent has no exposed surface that can trigger an unlock.
44
- - PreToolUse hooks block `Read` and `Bash` access to `~/.sigil/**`, `*.pem`, `**/.env*`, `**/keystore*`, and a configurable extra list.
45
- - PostToolUse output filter redacts hex-encoded 32-byte blobs, PEM blocks, and bip39-shaped strings from tool output before it reaches the model.
55
+ - PreToolUse hooks block `Read` and `Bash` access to files whose *entire purpose* is to hold a private key: `~/.sigil/**`, `*.key` / `*.keystore` / `*.jks` / `*.p12`, SSH private-key conventions (`.ssh/id_*`, `*_rsa`, `*_ed25519`, `*_ecdsa`), and GPG / `pass(1)` stores (`.gnupg/**`, `.password-store/**`) — plus a user-configurable extra list. This layer is deliberately **narrow and high-precision**: it does *not* block mixed-content files such as `.env` (blocking every `.env` would break ordinary work and give false assurance — secrets live in many places, and most `.env` content is not secret) nor `*.pem` (dominated by public certs and CA bundles). Those are handled by content redaction below, not by denying the read. Blocking is a whole-file veto; use it only where a read has no legitimate purpose.
56
+ - PostToolUse output filter redacts secret *content* from tool output before it reaches the model, wherever it appears — including inside a `.env` the agent legitimately read. Rules: 0x-prefixed 32-byte hex private keys; PEM private-key / key blocks; **BIP-39 seed phrases, checksum-validated** (a loose "N words" match would shred prose, so a run is only redacted if every word is in the 2048-word list *and* the BIP-39 checksum verifies); **secret-named env/config assignments** (`PRIVATE_KEY=` / `MNEMONIC=` / `SEED_PHRASE=` / `SECRET_KEY=`, value redacted, name kept); and common API-key/token shapes (JWT, npm, Anthropic, OpenAI, AWS). This is the layer that protects `.env` reads: the file comes back with `PORT` and `DATABASE_URL` intact and the key material stripped.
46
57
 
47
58
  ### 2. Bounding signing authority
48
59
 
@@ -111,4 +122,4 @@ Given the 2026 npm threat landscape, a compromised release of `sigil` would be c
111
122
 
112
123
  ## Reporting issues
113
124
 
114
- Security issues: open a GitHub security advisory on the repo. Please do not file public issues for vulnerabilities.
125
+ See [SECURITY.md](./SECURITY.md) for how to report a vulnerability privately. In short: use GitHub's [private vulnerability reporting](https://github.com/cdrn/sigil/security/advisories/new) — please don't file public issues for vulnerabilities, and use canary values (never real keys) in reproductions.
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/audit/log.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAElE,MAAM,WAAW,UAAU;IACz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(typeof value === 'object') {
39
39
  const obj = value;
40
- const keys = Object.keys(obj).filter((k) => obj[k] !== undefined).sort();
40
+ const keys = Object.keys(obj)
41
+ .filter((k) => obj[k] !== undefined)
42
+ .sort();
41
43
  return '{' + keys.map((k) => JSON.stringify(k) + ':' + canonicalJSON(obj[k])).join(',') + '}';
42
44
  }
43
45
  throw new Error(`canonicalJSON: unsupported value type ${typeof value}`);
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/audit/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAoB7C,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,KAAK,CAAqB;IACnC,YAAY,GAAW,EAAE,KAAc;QACrC,KAAK,CAAC,oBAAoB,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACzD,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B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EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC;QACF,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAEpC,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC;YACH,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACpB,SAAS,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC;gBAAS,CAAC;YACT,SAAS,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF"}
@@ -7,6 +7,7 @@ import { startControlServer } from '../control/index.js';
7
7
  import { HandleTable } from '../daemon/handles.js';
8
8
  import { runMcpStdio } from '../mcp/server.js';
9
9
  import { FileSystemPolicyResolver } from '../policy/index.js';
10
+ import { DEFAULT_RPC_PORT, startRpcServer } from '../rpc/index.js';
10
11
  /**
11
12
  * sigil-mcp: single-process MCP server for sigil. Spawned by Claude Code per
12
13
  * session via the .claude/settings.json mcpServers entry.
@@ -41,7 +42,9 @@ async function main() {
41
42
  try {
42
43
  chmodSync(paths.controlDir, 0o700);
43
44
  }
44
- catch { /* best-effort */ }
45
+ catch {
46
+ /* best-effort */
47
+ }
45
48
  const socketPath = sessionSocketPath(paths.controlDir, process.pid);
46
49
  // Load config + fail-closed check. If any portal policy requires OOB
47
50
  // confirmation but no transport is configured, refuse to start — running
@@ -67,6 +70,60 @@ async function main() {
67
70
  const handles = new HandleTable();
68
71
  const audit = new AuditWriter(paths.auditLog);
69
72
  const policy = new FileSystemPolicyResolver(paths.policyDir);
73
+ const context = {
74
+ handles,
75
+ audit,
76
+ policy,
77
+ ...(confirmGate ? { confirm: confirmGate } : {}),
78
+ };
79
+ // Local JSON-RPC signing proxy (forge/hardhat/cast integration). Shares
80
+ // `context` with the MCP loop, so its signs run the identical policy →
81
+ // confirm → audit pipeline. Multiple Claude windows each spawn a
82
+ // sigil-mcp; only the first binds the port — the others log and carry on,
83
+ // since any one session's proxy serves the machine.
84
+ let rpcServer;
85
+ let rpcProxyPort;
86
+ if (config.rpc) {
87
+ try {
88
+ rpcServer = await startRpcServer({
89
+ config: config.rpc,
90
+ ctx: context,
91
+ onLog: (e) => process.stderr.write(`rpc: ${JSON.stringify(e)}\n`),
92
+ });
93
+ rpcProxyPort = rpcServer.port;
94
+ const upstreamOrigin = new URL(config.rpc.upstream).origin;
95
+ process.stderr.write(`sigil-mcp: json-rpc signing proxy on ${rpcServer.url} ` +
96
+ `(portal "${config.rpc.portal}", upstream ${upstreamOrigin})\n`);
97
+ }
98
+ catch (err) {
99
+ if (err.code === 'EADDRINUSE') {
100
+ // Another session already serves the proxy on the configured port —
101
+ // still advertise it to the model below; it's the same config.
102
+ rpcProxyPort = config.rpc.port ?? DEFAULT_RPC_PORT;
103
+ process.stderr.write(`sigil-mcp: rpc port busy — another sigil-mcp session already serves the proxy\n`);
104
+ }
105
+ else {
106
+ throw err;
107
+ }
108
+ }
109
+ }
110
+ // Tell the model the proxy exists — tool descriptions are its only
111
+ // discovery channel. The authenticated URL is included on purpose: the
112
+ // token gates other local software, not the agent (which is the intended
113
+ // client and cannot read the config file past the ward hooks).
114
+ let toolNotes;
115
+ if (config.rpc && rpcProxyPort !== undefined) {
116
+ const authedUrl = `http://sigil:${config.rpc.token}@127.0.0.1:${rpcProxyPort}`;
117
+ toolNotes = {
118
+ sigil_eth_sign_transaction: `NOTE: sigil also serves a local JSON-RPC signing proxy for portal ` +
119
+ `"${config.rpc.portal}" at ${authedUrl} (chain per its configured upstream). ` +
120
+ `For Foundry/Hardhat/web3-tool workflows — especially contract deployments — ` +
121
+ `prefer that endpoint over transcribing calldata into this tool: e.g. ` +
122
+ `forge script <Script> --rpc-url '${authedUrl}' --unlocked --sender <portal address> --broadcast. ` +
123
+ `Its eth_sendTransaction fills nonce/gas/fees automatically, broadcasts via the ` +
124
+ `upstream, and runs the same policy, confirm, and audit pipeline as this tool.`,
125
+ };
126
+ }
70
127
  let controlClosed = false;
71
128
  let control = null;
72
129
  try {
@@ -97,22 +154,27 @@ async function main() {
97
154
  audit.close();
98
155
  if (!controlClosed && control) {
99
156
  controlClosed = true;
100
- control.close().catch(() => { });
157
+ control.close().catch(() => {
158
+ /* best-effort */
159
+ });
101
160
  }
102
161
  if (ackServer) {
103
- ackServer.close().catch(() => { });
162
+ ackServer.close().catch(() => {
163
+ /* best-effort */
164
+ });
165
+ }
166
+ if (rpcServer) {
167
+ rpcServer.close().catch(() => {
168
+ /* best-effort */
169
+ });
104
170
  }
105
171
  };
106
172
  process.on('exit', shutdown);
107
173
  process.on('SIGINT', () => process.exit(0));
108
174
  process.on('SIGTERM', () => process.exit(0));
109
175
  await runMcpStdio({
110
- context: {
111
- handles,
112
- audit,
113
- policy,
114
- ...(confirmGate ? { confirm: confirmGate } : {}),
115
- },
176
+ context,
177
+ ...(toolNotes ? { toolNotes } : {}),
116
178
  stdin: process.stdin,
117
179
  stdout: process.stdout,
118
180
  onLog: (e) => process.stderr.write(JSON.stringify(e) + '\n'),
@@ -125,6 +187,8 @@ async function main() {
125
187
  }
126
188
  if (ackServer)
127
189
  await ackServer.close();
190
+ if (rpcServer)
191
+ await rpcServer.close();
128
192
  process.exit(0);
129
193
  }
130
194
  main().catch((err) => {
@@ -1 +1 @@
1
- {"version":3,"file":"sigil-mcp.js","sourceRoot":"","sources":["../../../src/bin/sigil-mcp.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAA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BAAgB,CA2BlB;AAED,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B"}
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/cli/args.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CAC3C;AAID,MAAM,MAAM,SAAS,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACrC;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC,gBAAgB,CA2BlB;AAED,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAC;AAwB5D,MAAM,UAAU,eAAe,CAC7B,IAAc,EACd,KAAqC;IAErC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,IAA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G,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,SAAS,CACjB,uBAAuB,IAAI,uBAAuB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,SAAS,CAAC;YACjB,IAAI,EAAE,IAAI;YACV,gBAAgB,EAAE,IAAI;YACtB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;SACT,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,SAAS,CAAC,YAAY,IAAI,MAAO,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,MAA0C;KAC3D,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF"}
@@ -2,6 +2,6 @@ export { type SigilPaths, resolvePaths } from './paths.js';
2
2
  export { ArgsError, parseSubcommand } from './args.js';
3
3
  export { type PortalAddOpts, type PortalInfo, type PortalRemoveResult, portalAdd, portalListFromDisk, portalRemove, } from './portal.js';
4
4
  export { type StatusReport, type SessionStatus, status } from './status.js';
5
- export { type UnlockOpts, type LockOpts, formatResult, lock, unlock, } from './unlock.js';
5
+ export { type UnlockOpts, type LockOpts, formatResult, lock, unlock } from './unlock.js';
6
6
  export { type RunCliOpts, type CliExit, runCli } from './main.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,SAAS,EACT,kBAAkB,EAClB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,YAAY,EACZ,IAAI,EACJ,MAAM,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,SAAS,EACT,kBAAkB,EAClB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
@@ -2,6 +2,6 @@ export { resolvePaths } from './paths.js';
2
2
  export { ArgsError, parseSubcommand } from './args.js';
3
3
  export { portalAdd, portalListFromDisk, portalRemove, } from './portal.js';
4
4
  export { status } from './status.js';
5
- export { formatResult, lock, unlock, } from './unlock.js';
5
+ export { formatResult, lock, unlock } from './unlock.js';
6
6
  export { runCli } from './main.js';
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAIL,SAAS,EACT,kBAAkB,EAClB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAyC,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAGL,YAAY,EACZ,IAAI,EACJ,MAAM,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAiC,MAAM,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAIL,SAAS,EACT,kBAAkB,EAClB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAyC,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAkC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAiC,MAAM,EAAE,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/cli/main.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAsCpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC5C,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAuN/D"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/cli/main.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAkDpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC5C,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA+P/D"}
@@ -6,7 +6,8 @@ import { parsePolicy } from '../policy/index.js';
6
6
  import { ArgsError, parseSubcommand } from './args.js';
7
7
  import { resolvePaths } from './paths.js';
8
8
  import { encode as encodeQr, renderTerminal } from '../qr/index.js';
9
- import { policyInit, portalAdd, portalAddress, portalListFromDisk, portalNew, portalRemove } from './portal.js';
9
+ import { policyInit, portalAdd, portalAddress, portalListFromDisk, portalNew, portalRemove, } from './portal.js';
10
+ import { rpcInit } from './rpc.js';
10
11
  import { status } from './status.js';
11
12
  import { formatResult, lock, unlock } from './unlock.js';
12
13
  const USAGE = `sigil — local signing control for Claude Code
@@ -21,6 +22,7 @@ Usage:
21
22
  sigil portal remove <handle>
22
23
  sigil policy show <handle>
23
24
  sigil policy init <handle> [--strict]
25
+ sigil rpc init <handle> --upstream <url> [--port <n>]
24
26
  sigil unlock
25
27
  sigil lock
26
28
 
@@ -31,6 +33,9 @@ the MCP server in ~/.claude.json (with --user) or <root>/.mcp.json
31
33
  to get a locked-down template you fill in before any sign succeeds.
32
34
  "sigil policy init" provisions a policy file for an existing portal
33
35
  whose policy is missing (e.g. keyfile from an older sigil version).
36
+ "sigil rpc init" enables the local JSON-RPC signing proxy for a portal:
37
+ generates the auth token and writes the [rpc] config block, so Foundry/
38
+ Hardhat can use the portal as an unlocked signer.
34
39
  "sigil unlock" prompts for the passphrase and pushes it to every running
35
40
  sigil-mcp session (one per Claude Code window) over their control sockets,
36
41
  so a single unlock covers all open windows.
@@ -94,14 +99,14 @@ export async function runCli(opts) {
94
99
  const sub = parseSubcommand(rest, {
95
100
  new: {
96
101
  options: {
97
- 'strict': { type: 'boolean' },
102
+ strict: { type: 'boolean' },
98
103
  },
99
104
  },
100
105
  add: {
101
106
  options: {
102
107
  'key-file': { type: 'string' },
103
108
  'no-remove-source': { type: 'boolean' },
104
- 'strict': { type: 'boolean' },
109
+ strict: { type: 'boolean' },
105
110
  },
106
111
  },
107
112
  list: { options: {} },
@@ -260,6 +265,39 @@ export async function runCli(opts) {
260
265
  return { code: 0 };
261
266
  }
262
267
  }
268
+ if (head === 'rpc') {
269
+ const sub = parseSubcommand(rest, {
270
+ init: {
271
+ options: {
272
+ upstream: { type: 'string' },
273
+ port: { type: 'string' },
274
+ },
275
+ },
276
+ });
277
+ if (sub.command === 'init') {
278
+ const handle = sub.positionals[0];
279
+ if (!handle)
280
+ throw new ArgsError('rpc init: missing handle');
281
+ const upstream = sub.options['upstream'];
282
+ if (typeof upstream !== 'string') {
283
+ throw new ArgsError('rpc init: --upstream <url> is required');
284
+ }
285
+ let port;
286
+ if (sub.options['port'] !== undefined) {
287
+ port = Number(sub.options['port']);
288
+ }
289
+ const result = rpcInit(paths, handle, upstream, port);
290
+ out.write(`${result.created ? 'wrote' : 'appended [rpc] block to'} ${result.configPath}\n`);
291
+ out.write(`proxy will listen on 127.0.0.1:${result.port} for portal "${result.portal}"\n\n`);
292
+ out.write(`endpoint (embeds the auth token — treat it like a password):\n`);
293
+ out.write(` ${result.authedUrl}\n\n`);
294
+ out.write(`use with Foundry (get the sender address from "sigil portal list"):\n`);
295
+ out.write(` forge script <Script> --rpc-url '${result.authedUrl}' \\\n`);
296
+ out.write(` --unlocked --sender <portal address> --broadcast\n\n`);
297
+ out.write(`restart your Claude Code session(s) so sigil-mcp picks up the config.\n`);
298
+ return { code: 0 };
299
+ }
300
+ }
263
301
  throw new ArgsError(`unknown subcommand "${head}"`);
264
302
  }
265
303
  catch (e) {