@did-btcr2/cli 0.19.3 → 0.21.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
@@ -79,20 +79,25 @@ Required flag: `-i/--identifier`. If both `-r` and `-p` are given, `-r` wins and
79
79
  | `-i, --identifier <identifier>` | did:btcr2 identifier to resolve (required) |
80
80
  | `-r, --resolution-options <json>` | Resolution options as an inline JSON string |
81
81
  | `-p, --resolution-options-path <path>` | Path to a JSON file containing resolution options |
82
+ | `--min-conf <n>` | Minimum block confirmations a beacon signal needs before resolution applies it. A positive integer; default `6`, the specification value. Overrides a `minConf` inside `-r`/`-p`. Pass `1` to see a fresh update after one block |
82
83
 
83
84
  ### update
84
85
 
85
86
  Signs and broadcasts an update to a DID document. The signing key comes from the encrypted keystore (choose one with `--signing-key <ref>` or set an active key with `btcr2 key use`).
86
87
 
87
- Required flags: `-s/--source-document`, `--source-version-id`, `-p/--patches`, `-m/--verification-method-id`, `-b/--beacon-id`.
88
+ Required flags: `-i/--identifier`, `-p/--patches`. The command resolves the current document from the network unless you supply the source pair `-s/--source-document` and `--source-version-id` (both or neither). The api derives the verification method and the beacon unless you pass `-m` or `-b`.
88
89
 
89
90
  | Flag | Description |
90
91
  |---|---|
91
- | `-s, --source-document <json>` | Source DID document as a JSON string |
92
- | `--source-version-id <number>` | Source version ID as a non-negative integer |
93
- | `-p, --patches <json>` | JSON Patch operations as a JSON array string |
94
- | `-m, --verification-method-id <id>` | DID document verification method ID |
95
- | `-b, --beacon-id <json>` | Beacon ID as a JSON string |
92
+ | `-i, --identifier <identifier>` | did:btcr2 identifier to update (required) |
93
+ | `-p, --patches <json>` | JSON Patch operations as a JSON array string (required) |
94
+ | `-s, --source-document <json>` | Source DID document as a JSON string. Requires `--source-version-id`. Omit both to resolve the current document first |
95
+ | `--source-version-id <number>` | Version ID of the source document, a non-negative integer. Requires `--source-document` |
96
+ | `-m, --verification-method-id <id>` | Verification method that signs the update. Default: the one method of the document that publishes the signing key. Pass it when the api names several candidates |
97
+ | `-b, --beacon-id <id>` | Beacon service that announces the update, as a DID URL (`#initialP2WPKH` or absolute). Default: the only beacon of the document, else the one beacon with a spendable UTXO. Pass it when the api names several funded beacons |
98
+ | `-r, --resolution-options <json>` | Resolution options as an inline JSON string, for the resolution of the source document. Supply sidecar data here if the DID's prior updates are not in a CAS. Not allowed with the source pair |
99
+ | `--resolution-options-path <path>` | Path to a JSON file containing resolution options (`-r` wins if both are given). Not allowed with the source pair |
100
+ | `--min-conf <n>` | Minimum block confirmations a beacon signal needs before the source resolution applies it. A positive integer; default `6`, the specification value. Overrides a `minConf` inside `-r`/`--resolution-options-path`. Not allowed with the source pair |
96
101
  | `--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) |
97
102
  | `--fee-rate <satsPerVByte>` | Fee rate in sats/vByte for the beacon transaction (default: `5`). Raise it under congestion so the transaction confirms (also `BTCR2_FEE_RATE`, profile `btc.feeRate`) |
98
103
  | `--change-address <address>` | Send transaction change to this address instead of the beacon address, so a DID's announcements are not linked on-chain (profile `btc.changeAddress`) |
@@ -101,9 +106,9 @@ On a network with a block explorer, text-mode `update` (and `deactivate`) also p
101
106
 
102
107
  ### deactivate (alias: delete)
103
108
 
104
- 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.
109
+ Permanently deactivates a DID. This is irreversible. The command calls the api's `deactivateDid`, which applies the `{ "op": "add", "path": "/deactivated", "value": true }` patch and refuses a DID that is deactivated already. It signs via the keystore like `update`.
105
110
 
106
- Required flags: `-s/--source-document`, `--source-version-id`, `-m/--verification-method-id`, `-b/--beacon-id`. Optional: `--publish-to-cas <mode>`, `--fee-rate <satsPerVByte>`, `--change-address <address>` (same as `update`).
111
+ Required flag: `-i/--identifier`. Optional: the same source, derivation, resolution, CAS, fee, and change-address flags as `update`, minus `-p`.
107
112
 
108
113
  ### init
109
114
 
@@ -236,6 +241,9 @@ btcr2 resolve -i did:btcr2:k1qq... -r '{"versionId":"1"}'
236
241
  # With resolution options from a JSON file
237
242
  btcr2 resolve -i did:btcr2:k1qq... -p resolution-options.json
238
243
 
244
+ # Apply a signal after one confirmation instead of the default six
245
+ btcr2 resolve -i did:btcr2:k1qq... --min-conf 1 -r '{"sidecar":{"updates":[...]}}'
246
+
239
247
  # JSON output
240
248
  btcr2 -o json resolve -i did:btcr2:k1qq...
241
249
  ```
@@ -243,24 +251,28 @@ btcr2 -o json resolve -i did:btcr2:k1qq...
243
251
  ### Update a DID
244
252
 
245
253
  ```bash
246
- # Signs with the active keystore key (or one chosen via --signing-key)
247
- btcr2 update \
248
- -s "$(cat did.json)" \
249
- --source-version-id 1 \
250
- -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]' \
251
- -m 'did:btcr2:k1qq...#key-0' \
252
- -b '{"id":"#beacon-0","type":"SingletonBeacon","serviceEndpoint":"bitcoin:bc1..."}'
254
+ # Signs with the active keystore key (or one chosen via --signing-key).
255
+ # The command resolves the current document, derives the verification
256
+ # method and the beacon, then signs and broadcasts.
257
+ btcr2 update -i did:btcr2:k1qq... \
258
+ -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]'
259
+
260
+ # A DID whose prior update is sidecar-only: hand that update to the source resolution
261
+ btcr2 update -i did:btcr2:k1qq... --min-conf 1 -r '{"sidecar":{"updates":[...]}}' \
262
+ -p '[{"op":"remove","path":"/service/1"}]'
263
+
264
+ # Offline source: supply the document and its version, and name the method and the beacon
265
+ btcr2 update -i did:btcr2:k1qq... \
266
+ -s "$(cat did.json)" --source-version-id 1 \
267
+ -p '[{"op":"remove","path":"/service/1"}]' \
268
+ -m '#initialKey' -b '#initialP2WPKH'
253
269
  ```
254
270
 
255
271
  ### Deactivate a DID
256
272
 
257
273
  ```bash
258
- # Irreversible. Applies the deactivation patch and signs via the keystore.
259
- btcr2 deactivate \
260
- -s "$(cat did.json)" \
261
- --source-version-id 1 \
262
- -m 'did:btcr2:k1qq...#key-0' \
263
- -b '{"id":"#beacon-0","type":"SingletonBeacon","serviceEndpoint":"bitcoin:bc1..."}'
274
+ # Irreversible. Resolves the current document, then signs the deactivation via the keystore.
275
+ btcr2 deactivate -i did:btcr2:k1qq... --min-conf 1 -r '{"sidecar":{"updates":[...]}}'
264
276
  ```
265
277
 
266
278
  ### Manage keys
@@ -414,11 +426,8 @@ A writable CAS is configured with `--cas-rpc-url <url>` (an IPFS HTTP RPC endpoi
414
426
  btcr2 update \
415
427
  --cas-rpc-url http://127.0.0.1:5001 \
416
428
  --publish-to-cas auto \
417
- -s "$(cat did.json)" \
418
- --source-version-id 1 \
419
- -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]' \
420
- -m 'did:btcr2:k1qq...#key-0' \
421
- -b '{"id":"#beacon-0","type":"SingletonBeacon","serviceEndpoint":"bitcoin:bc1..."}'
429
+ -i did:btcr2:k1qq... \
430
+ -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]'
422
431
  ```
423
432
 
424
433
  ## Links