@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 +31 -26
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +126 -178
- 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 +4 -37
- 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 +4 -4
- package/src/commands/deactivate.ts +14 -142
- package/src/commands/resolve.ts +8 -64
- 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
|
@@ -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
|
|
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
|
-
| `-
|
|
93
|
-
|
|
|
94
|
-
| `-
|
|
95
|
-
|
|
|
96
|
-
| `-
|
|
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.
|
|
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
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
-p '[{"op":"add","path":"/service/-","value":{"id":"#svc","type":"X","serviceEndpoint":"https://x"}}]'
|
|
255
|
-
|
|
256
|
-
|
|
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.
|
|
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
|
-
-
|
|
422
|
-
|
|
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
|