@did-btcr2/cli 0.21.0 → 0.22.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
@@ -6,7 +6,7 @@ Part of the [`did-btcr2-js`](https://github.com/dcdpr/did-btcr2-js) monorepo.
6
6
 
7
7
  ## Summary
8
8
 
9
- This package provides the `btcr2` CLI for creating, resolving, updating, and deactivating did:btcr2 decentralized identifiers. It also manages an encrypted keystore of keypairs, reads and writes CLI configuration and profiles, and prints shell completion scripts. It wraps the `@did-btcr2/api` SDK via dependency injection, using [commander.js](https://github.com/tj/commander.js/) for argument parsing.
9
+ This package provides the `btcr2` CLI for creating, resolving, updating, and deactivating did:btcr2 decentralized identifiers. It decodes and validates identifiers offline. It also manages an encrypted keystore of keypairs, reads and writes CLI configuration and profiles, and prints shell completion scripts. It wraps the `@did-btcr2/api` SDK via dependency injection, using [commander.js](https://github.com/tj/commander.js/) for argument parsing.
10
10
 
11
11
  Out of the box, `btcr2 resolve` works with zero configuration. The Bitcoin network is derived from the DID itself, and public endpoints (mempool.space, ipfs.io) are used as defaults. Override endpoints via CLI flags, environment variables, or a config file.
12
12
 
@@ -44,6 +44,7 @@ npx @did-btcr2/cli resolve -i did:btcr2:k1qq...
44
44
  | `resolve` | `read` | Resolve a DID document |
45
45
  | `update` | - | Update a DID document (signs via the keystore) |
46
46
  | `deactivate` | `delete` | Deactivate a DID permanently (signs via the keystore) |
47
+ | `identifier` | - | Decode and validate identifiers (offline) |
47
48
  | `key` | - | Manage keypairs in the keystore |
48
49
  | `keystore` | - | Establish, inspect, and re-key the keystore |
49
50
  | `config` | - | Read and write CLI configuration |
@@ -110,6 +111,17 @@ Permanently deactivates a DID. This is irreversible. The command calls the api's
110
111
 
111
112
  Required flag: `-i/--identifier`. Optional: the same source, derivation, resolution, CAS, fee, and change-address flags as `update`, minus `-p`.
112
113
 
114
+ ### identifier
115
+
116
+ Decodes and validates identifiers. Both subcommands are offline and keystore-free. The identifier is a positional argument.
117
+
118
+ | Subcommand | Description |
119
+ |---|---|
120
+ | `identifier decode <did>` | Print the identifier type, the `hrp`, the version, the network, and the genesis bytes as hex. `--initial-document` adds the initial DID document; an `x` identifier needs `--genesis-document <path>` for it. |
121
+ | `identifier validate <did>` | Run the checks of the identifier decoding algorithm in order and print the report. Exit code `1` if a check fails. `-b, --bytes <hex>` adds the `genesisBytesMatch` check: the identifier must encode these genesis bytes (`k` or `x`). `--genesis-document <path>` adds the `genesisDocument` check for an `x` identifier. |
122
+
123
+ See [`docs/identifier.md`](./docs/identifier.md) for the check list and the output fields.
124
+
113
125
  ### init
114
126
 
115
127
  `btcr2 init` is the one-command setup: it creates the btcr2 home directory, writes a default config if none exists, and establishes the keystore if none exists. It is idempotent (existing files are left untouched unless `--force`). For a single command that also records the network and (optionally) caches the session and probes the endpoints, see [`quickstart`](#quickstart).