@did-btcr2/cli 0.20.0 → 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
@@ -85,15 +85,19 @@ Required flag: `-i/--identifier`. If both `-r` and `-p` are given, `-r` wins and
85
85
 
86
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`).
87
87
 
88
- 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`.
89
89
 
90
90
  | Flag | Description |
91
91
  |---|---|
92
- | `-s, --source-document <json>` | Source DID document as a JSON string |
93
- | `--source-version-id <number>` | Source version ID as a non-negative integer |
94
- | `-p, --patches <json>` | JSON Patch operations as a JSON array string |
95
- | `-m, --verification-method-id <id>` | DID document verification method ID |
96
- | `-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 |
97
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) |
98
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`) |
99
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`) |
@@ -102,9 +106,9 @@ On a network with a block explorer, text-mode `update` (and `deactivate`) also p
102
106
 
103
107
  ### deactivate (alias: delete)
104
108
 
105
- 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`.
106
110
 
107
- 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`.
108
112
 
109
113
  ### init
110
114
 
@@ -247,24 +251,28 @@ btcr2 -o json resolve -i did:btcr2:k1qq...
247
251
  ### Update a DID
248
252
 
249
253
  ```bash
250
- # Signs with the active keystore key (or one chosen via --signing-key)
251
- btcr2 update \
252
- -s "$(cat did.json)" \
253
- --source-version-id 1 \
254
- -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]' \
255
- -m 'did:btcr2:k1qq...#key-0' \
256
- -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'
257
269
  ```
258
270
 
259
271
  ### Deactivate a DID
260
272
 
261
273
  ```bash
262
- # Irreversible. Applies the deactivation patch and signs via the keystore.
263
- btcr2 deactivate \
264
- -s "$(cat did.json)" \
265
- --source-version-id 1 \
266
- -m 'did:btcr2:k1qq...#key-0' \
267
- -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":[...]}}'
268
276
  ```
269
277
 
270
278
  ### Manage keys
@@ -418,11 +426,8 @@ A writable CAS is configured with `--cas-rpc-url <url>` (an IPFS HTTP RPC endpoi
418
426
  btcr2 update \
419
427
  --cas-rpc-url http://127.0.0.1:5001 \
420
428
  --publish-to-cas auto \
421
- -s "$(cat did.json)" \
422
- --source-version-id 1 \
423
- -p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]' \
424
- -m 'did:btcr2:k1qq...#key-0' \
425
- -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"}}]'
426
431
  ```
427
432
 
428
433
  ## Links