@did-btcr2/cli 0.12.18 → 0.14.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 CHANGED
@@ -86,12 +86,13 @@ Required flags: `-s/--source-document`, `--source-version-id`, `-p/--patches`, `
86
86
  | `-p, --patches <json>` | JSON Patch operations as a JSON array string |
87
87
  | `-m, --verification-method-id <id>` | DID document verification method ID |
88
88
  | `-b, --beacon-id <json>` | Beacon ID as a JSON string |
89
+ | `--publish-to-cas <mode>` | Publish update artifacts to a writable CAS before broadcast: `auto`, `always`, or `never` (default: `never`). See [Publishing updates to CAS](#publishing-updates-to-cas) |
89
90
 
90
91
  ### deactivate (alias: delete)
91
92
 
92
93
  Permanently deactivates a DID. This is irreversible. Deactivation applies the `{ "op": "add", "path": "/deactivated", "value": true }` patch and routes through the same signed-update path as `update`, so it also signs via the keystore.
93
94
 
94
- Required flags: `-s/--source-document`, `--source-version-id`, `-m/--verification-method-id`, `-b/--beacon-id`.
95
+ Required flags: `-s/--source-document`, `--source-version-id`, `-m/--verification-method-id`, `-b/--beacon-id`. Optional: `--publish-to-cas <mode>` (same as `update`).
95
96
 
96
97
  ### key
97
98
 
@@ -222,7 +223,8 @@ Override precedence, highest wins: CLI flags, then environment variables, then c
222
223
  | `--btc-rpc-url <url>` | Override Bitcoin Core RPC endpoint |
223
224
  | `--btc-rpc-user <user>` | Bitcoin Core RPC username |
224
225
  | `--btc-rpc-pass <pass>` | Bitcoin Core RPC password |
225
- | `--cas-gateway <url>` | IPFS HTTP gateway for CAS reads |
226
+ | `--cas-gateway <url>` | IPFS HTTP gateway for CAS reads (read-only) |
227
+ | `--cas-rpc-url <url>` | IPFS HTTP RPC endpoint for a writable CAS (reads + writes; enables `--publish-to-cas`) |
226
228
  | `--keystore <path>` | Path to the keystore file (default: `$XDG_DATA_HOME/btcr2/keystore.json`) |
227
229
  | `--passphrase-file <path>` | Read the keystore passphrase from a file (unattended use) |
228
230
  | `--signing-key <ref>` | Key for create/update/deactivate signing: a URN, fingerprint prefix, or name |
@@ -236,6 +238,7 @@ Override precedence, highest wins: CLI flags, then environment variables, then c
236
238
  | `BTCR2_BTC_RPC_USER` | `--btc-rpc-user` |
237
239
  | `BTCR2_BTC_RPC_PASS` | `--btc-rpc-pass` |
238
240
  | `BTCR2_CAS_GATEWAY` | `--cas-gateway` |
241
+ | `BTCR2_CAS_RPC_URL` | `--cas-rpc-url` |
239
242
 
240
243
  ### Config file
241
244
 
@@ -256,19 +259,49 @@ Profiles are matched by network name when `--profile` is not specified. For exam
256
259
  },
257
260
  "bitcoin": {
258
261
  "btc": { "rest": "https://my-mempool/api" },
259
- "cas": { "gateway": "https://ipfs.io" }
262
+ "cas": { "gateway": "https://ipfs.io", "rpcUrl": "http://127.0.0.1:5001" }
260
263
  }
261
264
  }
262
265
  }
263
266
  ```
264
267
 
268
+ `cas.gateway` is a read-only IPFS HTTP gateway (used for reads). `cas.rpcUrl` is an IPFS HTTP RPC endpoint that supports writes; configure it to enable `--publish-to-cas`. When both are set, `rpcUrl` takes precedence.
269
+
265
270
  ### Defaults
266
271
 
267
272
  When no overrides are configured:
268
273
 
269
274
  - **Bitcoin REST**: [mempool.space](https://mempool.space) for `bitcoin`, `testnet3`, `testnet4`, and `signet`; [mutinynet.com](https://mutinynet.com) for `mutinynet`; `http://localhost:3000` for `regtest`
270
275
  - **Bitcoin RPC**: `http://localhost:18443` for `regtest` (credentials required), not configured for public networks
271
- - **CAS**: [ipfs.io](https://ipfs.io) HTTP gateway (read-only)
276
+ - **CAS**: [ipfs.io](https://ipfs.io) HTTP gateway (read-only). Configure a writable CAS with `--cas-rpc-url` (or `cas.rpcUrl`) to publish with `--publish-to-cas`
277
+
278
+ ## Publishing updates to CAS
279
+
280
+ CAS publication is **optional and never required**. Every `update` and `deactivate` can be completed and shared entirely via sidecar: the command always prints the artifacts a resolver needs (the signed update, the transaction id, the CAS announcement for CAS beacons, and the SMT proof for SMT beacons) for you to distribute yourself.
281
+
282
+ Optionally, the signed update (and, for CAS beacons, the announcement) can be published to a content-addressed store before the on-chain broadcast, so any OP_RETURN update hash is fetchable from CAS at resolution time without sidecar data. This is opt-in via `--publish-to-cas`:
283
+
284
+ | Mode | Behavior |
285
+ |---|---|
286
+ | `never` (default) | Publish nothing. Distribute the printed artifacts via sidecar. |
287
+ | `auto` | Best-effort. Publish when a writable CAS is configured; otherwise skip publication silently for every beacon type and proceed. Never blocks an update. |
288
+ | `always` | Require a writable CAS; error up-front for every beacon type when none is configured. |
289
+
290
+ A writable CAS is configured with `--cas-rpc-url <url>` (an IPFS HTTP RPC endpoint, e.g. a local Kubo node at `http://127.0.0.1:5001`), the `BTCR2_CAS_RPC_URL` environment variable, or a profile's `cas.rpcUrl`. The default IPFS gateway is read-only, so without a configured `--cas-rpc-url`, `--publish-to-cas auto` publishes nothing and completes the update sidecar-only, while `--publish-to-cas always` errors up-front (naming the fix) for every beacon type.
291
+
292
+ **Privacy:** under `auto`/`always`, canonical signed updates (and announcements) are published to the configured, possibly public, CAS before the on-chain anchor. Keep `never` (the default) to distribute update data privately via sidecar.
293
+
294
+ ```bash
295
+ # Opt into CAS publication against a local IPFS (Kubo) node
296
+ btcr2 update \
297
+ --cas-rpc-url http://127.0.0.1:5001 \
298
+ --publish-to-cas auto \
299
+ -s "$(cat did.json)" \
300
+ --source-version-id 1 \
301
+ -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]' \
302
+ -m 'did:btcr2:k1qq...#key-0' \
303
+ -b '{"id":"#beacon-0","type":"SingletonBeacon","serviceEndpoint":"bitcoin:bc1..."}'
304
+ ```
272
305
 
273
306
  ## Links
274
307