@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 +35 -26
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +136 -171
- package/dist/esm/src/commands/deactivate.js +11 -88
- package/dist/esm/src/commands/deactivate.js.map +1 -1
- package/dist/esm/src/commands/resolve.js +3 -20
- package/dist/esm/src/commands/resolve.js.map +1 -1
- package/dist/esm/src/commands/update.js +15 -85
- package/dist/esm/src/commands/update.js.map +1 -1
- package/dist/esm/src/commands/write.js +119 -0
- package/dist/esm/src/commands/write.js.map +1 -0
- package/dist/esm/src/resolution-options.js +47 -0
- package/dist/esm/src/resolution-options.js.map +1 -0
- package/dist/esm/src/types.js.map +1 -1
- package/dist/types/src/commands/deactivate.d.ts +1 -1
- package/dist/types/src/commands/deactivate.d.ts.map +1 -1
- package/dist/types/src/commands/resolve.d.ts.map +1 -1
- package/dist/types/src/commands/update.d.ts +1 -1
- package/dist/types/src/commands/update.d.ts.map +1 -1
- package/dist/types/src/commands/write.d.ts +47 -0
- package/dist/types/src/commands/write.d.ts.map +1 -0
- package/dist/types/src/resolution-options.d.ts +21 -0
- package/dist/types/src/resolution-options.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +17 -7
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/commands/deactivate.ts +14 -142
- package/src/commands/resolve.ts +7 -36
- package/src/commands/update.ts +19 -139
- package/src/commands/write.ts +198 -0
- package/src/resolution-options.ts +67 -0
- package/src/types.ts +17 -7
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
|
|
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
|
-
| `-
|
|
92
|
-
|
|
|
93
|
-
| `-
|
|
94
|
-
|
|
|
95
|
-
| `-
|
|
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.
|
|
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
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
-p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]'
|
|
251
|
-
|
|
252
|
-
|
|
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.
|
|
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
|
-
-
|
|
418
|
-
|
|
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
|