@did-btcr2/cli 0.20.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 +44 -27
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +237 -175
- package/dist/esm/src/cli.js +3 -2
- package/dist/esm/src/cli.js.map +1 -1
- package/dist/esm/src/commands/completion.js +1 -1
- package/dist/esm/src/commands/completion.js.map +1 -1
- package/dist/esm/src/commands/deactivate.js +11 -88
- package/dist/esm/src/commands/deactivate.js.map +1 -1
- package/dist/esm/src/commands/identifier.js +110 -0
- package/dist/esm/src/commands/identifier.js.map +1 -0
- package/dist/esm/src/commands/index.js +1 -0
- package/dist/esm/src/commands/index.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/cli.d.ts +1 -1
- package/dist/types/src/cli.d.ts.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/identifier.d.ts +12 -0
- package/dist/types/src/commands/identifier.d.ts.map +1 -0
- package/dist/types/src/commands/index.d.ts +1 -0
- package/dist/types/src/commands/index.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 +37 -7
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +3 -1
- package/src/commands/completion.ts +1 -1
- package/src/commands/deactivate.ts +14 -142
- package/src/commands/identifier.ts +156 -0
- package/src/commands/index.ts +1 -0
- 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 +34 -7
package/dist/cjs/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
registerConfigCommand: () => registerConfigCommand,
|
|
52
52
|
registerCreateCommand: () => registerCreateCommand,
|
|
53
53
|
registerDeactivateCommand: () => registerDeactivateCommand,
|
|
54
|
+
registerIdentifierCommand: () => registerIdentifierCommand,
|
|
54
55
|
registerInitCommand: () => registerInitCommand,
|
|
55
56
|
registerKeyCommand: () => registerKeyCommand,
|
|
56
57
|
registerKeystoreCommand: () => registerKeystoreCommand,
|
|
@@ -2294,51 +2295,40 @@ function parseGenesisBytes(hex, type) {
|
|
|
2294
2295
|
}
|
|
2295
2296
|
|
|
2296
2297
|
// src/commands/resolve.ts
|
|
2298
|
+
var import_api5 = require("@did-btcr2/api");
|
|
2299
|
+
|
|
2300
|
+
// src/resolution-options.ts
|
|
2297
2301
|
var import_api4 = require("@did-btcr2/api");
|
|
2298
2302
|
var import_promises = require("fs/promises");
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
parseMinConf
|
|
2304
|
-
).action(async (options) => {
|
|
2305
|
-
const parsed = await validateResolveOptions(options);
|
|
2306
|
-
const network = deriveNetwork(parsed.identifier);
|
|
2307
|
-
const api = factory(network, globals());
|
|
2308
|
-
const data = await api.resolveDid(parsed.identifier, parsed.options);
|
|
2309
|
-
const result = { action: "resolve", data };
|
|
2310
|
-
console.log(formatResult(result, globals()));
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
async function validateResolveOptions(options) {
|
|
2314
|
-
import_api4.Identifier.decode(options.identifier);
|
|
2315
|
-
let resolutionOptions = void 0;
|
|
2316
|
-
if (options.resolutionOptions) {
|
|
2303
|
+
var MIN_CONF_HELP = `Minimum block confirmations a beacon signal needs before resolution applies it (positive integer, default: ${import_api4.DEFAULT_MIN_CONF}). Overrides a minConf inside the JSON resolution options`;
|
|
2304
|
+
async function readResolutionOptions(flags) {
|
|
2305
|
+
let resolutionOptions;
|
|
2306
|
+
if (flags.resolutionOptions) {
|
|
2317
2307
|
try {
|
|
2318
|
-
resolutionOptions = JSON.parse(
|
|
2308
|
+
resolutionOptions = JSON.parse(flags.resolutionOptions);
|
|
2319
2309
|
} catch {
|
|
2320
2310
|
throw new CLIError(
|
|
2321
2311
|
"Invalid resolution options. Must be a valid JSON string.",
|
|
2322
2312
|
"INVALID_ARGUMENT_ERROR",
|
|
2323
|
-
|
|
2313
|
+
{ resolutionOptions: flags.resolutionOptions }
|
|
2324
2314
|
);
|
|
2325
2315
|
}
|
|
2326
|
-
} else if (
|
|
2316
|
+
} else if (flags.resolutionOptionsPath) {
|
|
2327
2317
|
try {
|
|
2328
|
-
const content = await (0, import_promises.readFile)(
|
|
2318
|
+
const content = await (0, import_promises.readFile)(flags.resolutionOptionsPath, "utf-8");
|
|
2329
2319
|
resolutionOptions = JSON.parse(content);
|
|
2330
2320
|
} catch {
|
|
2331
2321
|
throw new CLIError(
|
|
2332
2322
|
"Invalid resolution options path. Must be a valid path to a JSON file.",
|
|
2333
2323
|
"INVALID_ARGUMENT_ERROR",
|
|
2334
|
-
|
|
2324
|
+
{ resolutionOptionsPath: flags.resolutionOptionsPath }
|
|
2335
2325
|
);
|
|
2336
2326
|
}
|
|
2337
2327
|
}
|
|
2338
|
-
if (
|
|
2339
|
-
resolutionOptions = { ...resolutionOptions ?? {}, minConf:
|
|
2328
|
+
if (flags.minConf !== void 0) {
|
|
2329
|
+
resolutionOptions = { ...resolutionOptions ?? {}, minConf: flags.minConf };
|
|
2340
2330
|
}
|
|
2341
|
-
return
|
|
2331
|
+
return resolutionOptions;
|
|
2342
2332
|
}
|
|
2343
2333
|
function parseMinConf(value) {
|
|
2344
2334
|
if (!/^[1-9]\d*$/.test(value)) {
|
|
@@ -2351,28 +2341,47 @@ function parseMinConf(value) {
|
|
|
2351
2341
|
return Number(value);
|
|
2352
2342
|
}
|
|
2353
2343
|
|
|
2354
|
-
// src/commands/
|
|
2344
|
+
// src/commands/resolve.ts
|
|
2345
|
+
function registerResolveCommand(program, factory, globals) {
|
|
2346
|
+
program.command("resolve").alias("read").description("Resolve the DID document of the identifier.").requiredOption("-i, --identifier <identifier>", "did:btcr2 identifier").option("-r, --resolution-options <json>", "JSON string containing resolution options").option("-p, --resolution-options-path <path>", "Path to a JSON file containing resolution options").option("--min-conf <n>", MIN_CONF_HELP, parseMinConf).action(async (options) => {
|
|
2347
|
+
const parsed = await validateResolveOptions(options);
|
|
2348
|
+
const network = deriveNetwork(parsed.identifier);
|
|
2349
|
+
const api = factory(network, globals());
|
|
2350
|
+
const data = await api.resolveDid(parsed.identifier, parsed.options);
|
|
2351
|
+
const result = { action: "resolve", data };
|
|
2352
|
+
console.log(formatResult(result, globals()));
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
async function validateResolveOptions(options) {
|
|
2356
|
+
import_api5.Identifier.decode(options.identifier);
|
|
2357
|
+
const resolutionOptions = await readResolutionOptions(options);
|
|
2358
|
+
return { identifier: options.identifier, options: resolutionOptions };
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
// src/commands/write.ts
|
|
2355
2362
|
var import_key_manager2 = require("@did-btcr2/key-manager");
|
|
2356
|
-
function
|
|
2357
|
-
|
|
2363
|
+
function registerWriteOptions(command) {
|
|
2364
|
+
return command.option(
|
|
2358
2365
|
"-s, --source-document <json>",
|
|
2359
|
-
"Source DID document as JSON string",
|
|
2366
|
+
"Source DID document as a JSON string. Requires --source-version-id. Omit both to resolve the current document first",
|
|
2360
2367
|
parseJsonArg("--source-document")
|
|
2361
|
-
).
|
|
2368
|
+
).option(
|
|
2362
2369
|
"--source-version-id <number>",
|
|
2363
|
-
"
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
"JSON Patch operations as a JSON string array",
|
|
2367
|
-
parseJsonArg("--patches")
|
|
2368
|
-
).requiredOption(
|
|
2370
|
+
"Version ID of the source document, a non-negative integer. Requires --source-document",
|
|
2371
|
+
parseSourceVersionId
|
|
2372
|
+
).option(
|
|
2369
2373
|
"-m, --verification-method-id <id>",
|
|
2370
|
-
"
|
|
2371
|
-
).
|
|
2372
|
-
"-b, --beacon-id <
|
|
2373
|
-
"Beacon
|
|
2374
|
-
parseJsonArg("--beacon-id")
|
|
2374
|
+
"Verification method that signs the update (default: the one method of the document that publishes the signing key)"
|
|
2375
|
+
).option(
|
|
2376
|
+
"-b, --beacon-id <id>",
|
|
2377
|
+
"Beacon service that announces the update, as a DID URL (default: the only beacon of the document, else the one beacon with a spendable UTXO)"
|
|
2375
2378
|
).option(
|
|
2379
|
+
"-r, --resolution-options <json>",
|
|
2380
|
+
"Resolution options as a JSON string, for the resolution of the source document"
|
|
2381
|
+
).option(
|
|
2382
|
+
"--resolution-options-path <path>",
|
|
2383
|
+
"Path to a JSON file with resolution options, for the resolution of the source document"
|
|
2384
|
+
).option("--min-conf <n>", MIN_CONF_HELP, parseMinConf).option(
|
|
2376
2385
|
"--publish-to-cas <mode>",
|
|
2377
2386
|
"Publish update artifacts to a writable CAS before broadcast: auto|always|never. CAS publication is optional; the default distributes the returned artifacts via sidecar.",
|
|
2378
2387
|
parsePublishToCasMode,
|
|
@@ -2383,51 +2392,62 @@ function registerUpdateCommand(program, factory, globals) {
|
|
|
2383
2392
|
).option(
|
|
2384
2393
|
"--change-address <address>",
|
|
2385
2394
|
"Send transaction change to this address instead of the beacon address, so a DID's announcements are not linked on-chain (ADR 044)."
|
|
2386
|
-
)
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
+
);
|
|
2396
|
+
}
|
|
2397
|
+
async function prepareWrite(options, factory, g) {
|
|
2398
|
+
const did = options.identifier;
|
|
2399
|
+
const network = deriveNetwork(did);
|
|
2400
|
+
const hasDocument = options.sourceDocument !== void 0;
|
|
2401
|
+
const hasVersion = options.sourceVersionId !== void 0;
|
|
2402
|
+
if (hasDocument !== hasVersion) {
|
|
2403
|
+
throw new CLIError(
|
|
2404
|
+
"Provide both --source-document and --source-version-id, or neither. Omit both to resolve the current document first.",
|
|
2405
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2406
|
+
{ did }
|
|
2407
|
+
);
|
|
2408
|
+
}
|
|
2409
|
+
const hasResolutionFlags = options.resolutionOptions !== void 0 || options.resolutionOptionsPath !== void 0 || options.minConf !== void 0;
|
|
2410
|
+
if (hasDocument && hasResolutionFlags) {
|
|
2411
|
+
throw new CLIError(
|
|
2412
|
+
"--resolution-options, --resolution-options-path, and --min-conf apply only when --source-document and --source-version-id are omitted. A supplied source pair skips resolution.",
|
|
2413
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2414
|
+
{ did }
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2417
|
+
assertKeystoreAllowedForNetwork(network, g);
|
|
2418
|
+
const resolutionOptions = await readResolutionOptions(options);
|
|
2419
|
+
const api = factory(network, g);
|
|
2420
|
+
const keyId = resolveKeyRef(api.kms.kms, resolveSigningKeyRef(g));
|
|
2421
|
+
const signer = new import_key_manager2.KeyManagerSigner(api.kms.kms, keyId);
|
|
2422
|
+
const broadcastOptions = resolveBroadcastOptions(network, g, {
|
|
2423
|
+
feeRate: options.feeRate,
|
|
2424
|
+
changeAddress: options.changeAddress
|
|
2425
|
+
});
|
|
2426
|
+
return {
|
|
2427
|
+
network,
|
|
2428
|
+
api,
|
|
2429
|
+
params: {
|
|
2430
|
+
did,
|
|
2431
|
+
signer,
|
|
2395
2432
|
sourceDocument: options.sourceDocument,
|
|
2396
|
-
|
|
2397
|
-
sourceVersionId: Number(options.sourceVersionId),
|
|
2433
|
+
sourceVersionId: options.sourceVersionId,
|
|
2398
2434
|
verificationMethodId: options.verificationMethodId,
|
|
2399
|
-
beaconId: options.beaconId
|
|
2400
|
-
|
|
2401
|
-
const did = parsed.sourceDocument?.id;
|
|
2402
|
-
if (!did) {
|
|
2403
|
-
throw new CLIError(
|
|
2404
|
-
'Source document must contain an "id" field.',
|
|
2405
|
-
"INVALID_ARGUMENT_ERROR",
|
|
2406
|
-
options
|
|
2407
|
-
);
|
|
2408
|
-
}
|
|
2409
|
-
const network = deriveNetwork(did);
|
|
2410
|
-
assertKeystoreAllowedForNetwork(network, globals());
|
|
2411
|
-
const api = factory(network, globals());
|
|
2412
|
-
const keyId = resolveKeyRef(api.kms.kms, resolveSigningKeyRef(globals()));
|
|
2413
|
-
const signer = new import_key_manager2.KeyManagerSigner(api.kms.kms, keyId);
|
|
2414
|
-
const broadcastOptions = resolveBroadcastOptions(network, globals(), {
|
|
2415
|
-
feeRate: options.feeRate,
|
|
2416
|
-
changeAddress: options.changeAddress
|
|
2417
|
-
});
|
|
2418
|
-
const data = await api.btcr2.update({
|
|
2419
|
-
sourceDocument: parsed.sourceDocument,
|
|
2420
|
-
patches: parsed.patches,
|
|
2421
|
-
sourceVersionId: parsed.sourceVersionId,
|
|
2422
|
-
verificationMethodId: parsed.verificationMethodId,
|
|
2423
|
-
beaconId: parsed.beaconId,
|
|
2424
|
-
signer,
|
|
2435
|
+
beaconId: options.beaconId,
|
|
2436
|
+
resolutionOptions,
|
|
2425
2437
|
publishToCas: options.publishToCas,
|
|
2426
|
-
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2438
|
+
broadcastOptions
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
function parseSourceVersionId(value) {
|
|
2443
|
+
if (!/^\d+$/.test(value)) {
|
|
2444
|
+
throw new CLIError(
|
|
2445
|
+
"--source-version-id must be a non-negative integer.",
|
|
2446
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2447
|
+
{ value }
|
|
2448
|
+
);
|
|
2449
|
+
}
|
|
2450
|
+
return Number(value);
|
|
2431
2451
|
}
|
|
2432
2452
|
function parsePublishToCasMode(value) {
|
|
2433
2453
|
if (value !== "auto" && value !== "always" && value !== "never") {
|
|
@@ -2453,108 +2473,148 @@ function parseJsonArg(flagName) {
|
|
|
2453
2473
|
};
|
|
2454
2474
|
}
|
|
2455
2475
|
|
|
2476
|
+
// src/commands/update.ts
|
|
2477
|
+
function registerUpdateCommand(program, factory, globals) {
|
|
2478
|
+
const command = program.command("update").description("Update a did:btcr2 document.").requiredOption("-i, --identifier <identifier>", "did:btcr2 identifier to update").requiredOption(
|
|
2479
|
+
"-p, --patches <json>",
|
|
2480
|
+
"JSON Patch operations as a JSON string array",
|
|
2481
|
+
parseJsonArg("--patches")
|
|
2482
|
+
);
|
|
2483
|
+
registerWriteOptions(command).action(async (options) => {
|
|
2484
|
+
const g = globals();
|
|
2485
|
+
const { network, api, params } = await prepareWrite(options, factory, g);
|
|
2486
|
+
const data = await api.updateDid({ ...params, patches: options.patches });
|
|
2487
|
+
console.log(formatResult({ action: "update", data }, g));
|
|
2488
|
+
printWatchHint(g, network, data.txid);
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2456
2492
|
// src/commands/deactivate.ts
|
|
2457
|
-
var import_key_manager3 = require("@did-btcr2/key-manager");
|
|
2458
|
-
var DEACTIVATION_PATCH = [{ op: "add", path: "/deactivated", value: true }];
|
|
2459
2493
|
function registerDeactivateCommand(program, factory, globals) {
|
|
2460
|
-
program.command("deactivate").alias("delete").description("Deactivate the did:btcr2 identifier permanently. This is irreversible.").requiredOption(
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
)
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
"
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
"Fee rate in sats/vByte for the beacon transaction (default: 5). Raise it under congestion so the transaction confirms."
|
|
2494
|
+
const command = program.command("deactivate").alias("delete").description("Deactivate the did:btcr2 identifier permanently. This is irreversible.").requiredOption("-i, --identifier <identifier>", "did:btcr2 identifier to deactivate");
|
|
2495
|
+
registerWriteOptions(command).action(async (options) => {
|
|
2496
|
+
const g = globals();
|
|
2497
|
+
const { network, api, params } = await prepareWrite(options, factory, g);
|
|
2498
|
+
const data = await api.deactivateDid(params);
|
|
2499
|
+
console.log(formatResult({ action: "deactivate", data }, g));
|
|
2500
|
+
printWatchHint(g, network, data.txid);
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
// src/commands/identifier.ts
|
|
2505
|
+
var import_api6 = require("@did-btcr2/api");
|
|
2506
|
+
var import_utils5 = require("@noble/hashes/utils.js");
|
|
2507
|
+
var import_promises2 = require("fs/promises");
|
|
2508
|
+
function registerIdentifierCommand(program, factory, globals) {
|
|
2509
|
+
const identifier = program.command("identifier").description("Decode and validate did:btcr2 identifiers (offline).");
|
|
2510
|
+
const print = (result) => console.log(formatResult(result, globals()));
|
|
2511
|
+
identifier.command("decode <did>").description("Print the components of a did:btcr2 identifier.").option(
|
|
2512
|
+
"--initial-document",
|
|
2513
|
+
"Add the initial DID document. An external identifier (x) needs --genesis-document.",
|
|
2514
|
+
false
|
|
2482
2515
|
).option(
|
|
2483
|
-
"--
|
|
2484
|
-
"
|
|
2485
|
-
).action(async (options) => {
|
|
2486
|
-
if (
|
|
2516
|
+
"--genesis-document <path>",
|
|
2517
|
+
"Path to the JSON genesis document of an external identifier (x). Requires --initial-document."
|
|
2518
|
+
).action(async (did, options) => {
|
|
2519
|
+
if (options.genesisDocument !== void 0 && !options.initialDocument) {
|
|
2520
|
+
throw new CLIError("--genesis-document requires --initial-document.", "INVALID_ARGUMENT_ERROR");
|
|
2521
|
+
}
|
|
2522
|
+
assertValidIdentifier(did);
|
|
2523
|
+
const api = factory();
|
|
2524
|
+
const components = api.did.decode(did);
|
|
2525
|
+
if (options.genesisDocument !== void 0 && components.hrp === "k") {
|
|
2487
2526
|
throw new CLIError(
|
|
2488
|
-
"--
|
|
2527
|
+
"--genesis-document applies only to external identifiers (x).",
|
|
2489
2528
|
"INVALID_ARGUMENT_ERROR",
|
|
2490
|
-
{
|
|
2529
|
+
{ did }
|
|
2491
2530
|
);
|
|
2492
2531
|
}
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2532
|
+
const data = {
|
|
2533
|
+
did,
|
|
2534
|
+
idType: components.idType,
|
|
2535
|
+
hrp: components.hrp,
|
|
2536
|
+
version: components.version,
|
|
2537
|
+
network: components.network,
|
|
2538
|
+
genesisBytes: (0, import_utils5.bytesToHex)(components.genesisBytes)
|
|
2499
2539
|
};
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2540
|
+
if (options.initialDocument) {
|
|
2541
|
+
if (components.hrp === "x" && options.genesisDocument === void 0) {
|
|
2542
|
+
throw new CLIError(
|
|
2543
|
+
"An external identifier (x) needs --genesis-document <path> for --initial-document.",
|
|
2544
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2545
|
+
{ did }
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2548
|
+
const genesisDocument = options.genesisDocument === void 0 ? void 0 : await readGenesisDocument(options.genesisDocument);
|
|
2549
|
+
data.initialDocument = api.btcr2.getInitialDocument(did, genesisDocument);
|
|
2507
2550
|
}
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2551
|
+
print({ action: "identifier-decode", data });
|
|
2552
|
+
});
|
|
2553
|
+
identifier.command("validate <did>").description("Check that a did:btcr2 identifier conforms to the specification. Exit code 1 if it does not.").option(
|
|
2554
|
+
"-b, --bytes <hex>",
|
|
2555
|
+
"Genesis bytes as a hex string that the identifier must encode: the 33-byte public key (k) or the 32-byte genesis document hash (x). Adds the genesisBytesMatch check."
|
|
2556
|
+
).option(
|
|
2557
|
+
"--genesis-document <path>",
|
|
2558
|
+
"Path to the JSON genesis document of an external identifier (x). Adds the genesisDocument check."
|
|
2559
|
+
).action(async (did, options) => {
|
|
2560
|
+
const genesisBytes = options.bytes === void 0 ? void 0 : parseHexBytes(options.bytes);
|
|
2561
|
+
let genesisDocument;
|
|
2562
|
+
if (options.genesisDocument !== void 0) {
|
|
2563
|
+
if (import_api6.Identifier.isValid(did) && import_api6.Identifier.decode(did).hrp === "k") {
|
|
2564
|
+
throw new CLIError(
|
|
2565
|
+
"--genesis-document applies only to external identifiers (x).",
|
|
2566
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2567
|
+
{ did }
|
|
2568
|
+
);
|
|
2569
|
+
}
|
|
2570
|
+
genesisDocument = await readGenesisDocument(options.genesisDocument);
|
|
2571
|
+
}
|
|
2572
|
+
const report = factory().did.validate(did, { genesisBytes, genesisDocument });
|
|
2573
|
+
print({ action: "identifier-validate", data: report });
|
|
2574
|
+
if (!report.valid) process.exitCode = 1;
|
|
2529
2575
|
});
|
|
2530
2576
|
}
|
|
2531
|
-
function
|
|
2532
|
-
|
|
2577
|
+
function assertValidIdentifier(did) {
|
|
2578
|
+
const report = import_api6.Identifier.validate(did);
|
|
2579
|
+
if (report.valid) return;
|
|
2580
|
+
const failed = report.checks[report.checks.length - 1];
|
|
2581
|
+
throw new CLIError(
|
|
2582
|
+
`Invalid identifier (${failed.name} check): ${failed.detail ?? "failed"}`,
|
|
2583
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2584
|
+
{ did, check: failed.name }
|
|
2585
|
+
);
|
|
2586
|
+
}
|
|
2587
|
+
function parseHexBytes(value) {
|
|
2588
|
+
try {
|
|
2589
|
+
return (0, import_utils5.hexToBytes)(value.trim());
|
|
2590
|
+
} catch {
|
|
2591
|
+
throw new CLIError("Invalid bytes: not valid hex.", "INVALID_ARGUMENT_ERROR", { bytes: value });
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
async function readGenesisDocument(path) {
|
|
2595
|
+
let parsed;
|
|
2596
|
+
try {
|
|
2597
|
+
parsed = JSON.parse(await (0, import_promises2.readFile)(path, "utf-8"));
|
|
2598
|
+
} catch {
|
|
2533
2599
|
throw new CLIError(
|
|
2534
|
-
|
|
2600
|
+
"Invalid genesis document path. Must be a valid path to a JSON file.",
|
|
2535
2601
|
"INVALID_ARGUMENT_ERROR",
|
|
2536
|
-
{
|
|
2602
|
+
{ genesisDocument: path }
|
|
2537
2603
|
);
|
|
2538
2604
|
}
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
`Invalid JSON for ${flagName}. Must be a valid JSON string.`,
|
|
2548
|
-
"INVALID_ARGUMENT_ERROR",
|
|
2549
|
-
{ flagName, value }
|
|
2550
|
-
);
|
|
2551
|
-
}
|
|
2552
|
-
};
|
|
2605
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
2606
|
+
throw new CLIError(
|
|
2607
|
+
"Invalid genesis document. The file must contain a JSON object.",
|
|
2608
|
+
"INVALID_ARGUMENT_ERROR",
|
|
2609
|
+
{ genesisDocument: path }
|
|
2610
|
+
);
|
|
2611
|
+
}
|
|
2612
|
+
return parsed;
|
|
2553
2613
|
}
|
|
2554
2614
|
|
|
2555
2615
|
// src/commands/key.ts
|
|
2556
2616
|
var import_keypair = require("@did-btcr2/keypair");
|
|
2557
|
-
var
|
|
2617
|
+
var import_utils6 = require("@noble/hashes/utils.js");
|
|
2558
2618
|
var import_node_fs9 = require("fs");
|
|
2559
2619
|
function registerKeyCommand(program, factory, globals) {
|
|
2560
2620
|
const key = program.command("key").description("Manage keypairs in the encrypted keystore.");
|
|
@@ -2564,7 +2624,7 @@ function registerKeyCommand(program, factory, globals) {
|
|
|
2564
2624
|
assertNameAvailable(api.kms.kms, options.name);
|
|
2565
2625
|
const setActive = options.setActive ?? false;
|
|
2566
2626
|
const id = api.kms.generateKey({ ...options.name && { tags: { name: options.name } }, setActive });
|
|
2567
|
-
print({ action: "key-generate", data: { keyId: id, publicKey: (0,
|
|
2627
|
+
print({ action: "key-generate", data: { keyId: id, publicKey: (0, import_utils6.bytesToHex)(api.kms.getPublicKey(id)), active: setActive } });
|
|
2568
2628
|
});
|
|
2569
2629
|
key.command("list").alias("ls").description("List stored keys.").action(() => {
|
|
2570
2630
|
const kms = factory(void 0, globals()).kms.kms;
|
|
@@ -2584,7 +2644,7 @@ function registerKeyCommand(program, factory, globals) {
|
|
|
2584
2644
|
const kms = factory(void 0, globals()).kms.kms;
|
|
2585
2645
|
const id = resolveKeyRef(kms, ref);
|
|
2586
2646
|
const entry = kms.getEntry(id);
|
|
2587
|
-
print({ action: "key-show", data: { keyId: id, publicKey: (0,
|
|
2647
|
+
print({ action: "key-show", data: { keyId: id, publicKey: (0, import_utils6.bytesToHex)(entry.publicKey), ...entry.tags && { tags: entry.tags } } });
|
|
2588
2648
|
});
|
|
2589
2649
|
key.command("import").description("Import a key: a secret from a hex file, or a public key as watch-only.").option("--secret-file <path>", "Path to a file containing a 32-byte secret key as hex.").option("--public <hex>", "A 33-byte compressed public key as hex (imported watch-only).").option("--name <name>", "A human-friendly name, stored as a tag.").option("--set-active", "Make this the active key.", false).action((options) => {
|
|
2590
2650
|
if (Boolean(options.secretFile) === Boolean(options.public)) {
|
|
@@ -2595,13 +2655,13 @@ function registerKeyCommand(program, factory, globals) {
|
|
|
2595
2655
|
const keyPair = options.secretFile ? new import_keypair.SchnorrKeyPair({ secretKey: readHexFile(options.secretFile, 32, "--secret-file") }) : new import_keypair.SchnorrKeyPair({ publicKey: parseHex(options.public ?? "", 33, "--public") });
|
|
2596
2656
|
const setActive = options.setActive ?? false;
|
|
2597
2657
|
const id = api.kms.import(keyPair, { ...options.name && { tags: { name: options.name } }, setActive });
|
|
2598
|
-
print({ action: "key-import", data: { keyId: id, publicKey: (0,
|
|
2658
|
+
print({ action: "key-import", data: { keyId: id, publicKey: (0, import_utils6.bytesToHex)(api.kms.getPublicKey(id)), watchOnly: !options.secretFile, active: setActive } });
|
|
2599
2659
|
});
|
|
2600
2660
|
key.command("export <ref>").description("Export a key. Public material by default; --secret writes the secret to a file.").option("--secret", "Export the secret key. Requires --out.", false).option("--out <path>", "Write the exported secret to this file (created 0600).").action((ref, options) => {
|
|
2601
2661
|
const api = factory(void 0, globals());
|
|
2602
2662
|
const id = resolveKeyRef(api.kms.kms, ref);
|
|
2603
2663
|
if (!options.secret) {
|
|
2604
|
-
print({ action: "key-export", data: { keyId: id, publicKey: (0,
|
|
2664
|
+
print({ action: "key-export", data: { keyId: id, publicKey: (0, import_utils6.bytesToHex)(api.kms.getPublicKey(id)) } });
|
|
2605
2665
|
return;
|
|
2606
2666
|
}
|
|
2607
2667
|
if (!options.out) {
|
|
@@ -2612,7 +2672,7 @@ function registerKeyCommand(program, factory, globals) {
|
|
|
2612
2672
|
throw new CLIError(`Key ${id} is watch-only and has no secret to export.`, "INVALID_ARGUMENT_ERROR", { keyId: id });
|
|
2613
2673
|
}
|
|
2614
2674
|
process.stderr.write("warning: writing an unencrypted secret key to disk. Protect this file and delete it when done.\n");
|
|
2615
|
-
writeSecretFile(options.out, (0,
|
|
2675
|
+
writeSecretFile(options.out, (0, import_utils6.bytesToHex)(keyPair.secretKey.bytes));
|
|
2616
2676
|
print({ action: "key-export", data: { keyId: id, secretWrittenTo: options.out } });
|
|
2617
2677
|
});
|
|
2618
2678
|
key.command("delete <ref>").alias("rm").description("Delete a key from the keystore.").option("--force", "Delete even if it is the active key.", false).action((ref, options) => {
|
|
@@ -2637,7 +2697,7 @@ function assertNameAvailable(kms, name) {
|
|
|
2637
2697
|
function parseHex(hex, expectedBytes, label) {
|
|
2638
2698
|
let bytes;
|
|
2639
2699
|
try {
|
|
2640
|
-
bytes = (0,
|
|
2700
|
+
bytes = (0, import_utils6.hexToBytes)(hex.trim());
|
|
2641
2701
|
} catch {
|
|
2642
2702
|
throw new CLIError(`Invalid hex for ${label}.`, "INVALID_ARGUMENT_ERROR", { label });
|
|
2643
2703
|
}
|
|
@@ -2964,7 +3024,7 @@ function registerProfileCommand(program, globals) {
|
|
|
2964
3024
|
}
|
|
2965
3025
|
|
|
2966
3026
|
// src/commands/completion.ts
|
|
2967
|
-
var COMMANDS = "create resolve read update deactivate delete key config profile completion";
|
|
3027
|
+
var COMMANDS = "create resolve read update deactivate delete identifier key config profile completion";
|
|
2968
3028
|
function registerCompletionCommand(program, _globals) {
|
|
2969
3029
|
program.command("completion [shell]").description("Print a shell completion script (bash, zsh, or fish) to stdout.").action((shell = "bash") => {
|
|
2970
3030
|
console.log(completionScript(shell));
|
|
@@ -3024,7 +3084,7 @@ var DidBtcr2Cli = class {
|
|
|
3024
3084
|
* for known networks and localhost Polar for regtest.
|
|
3025
3085
|
*
|
|
3026
3086
|
* @param factory - Optional API factory for keystore-free commands (create,
|
|
3027
|
-
* resolve). Defaults to {@link defaultApiFactory}.
|
|
3087
|
+
* resolve, identifier). Defaults to {@link defaultApiFactory}.
|
|
3028
3088
|
* @param keystoreFactory - Optional keystore-aware API factory for commands
|
|
3029
3089
|
* that need a signing identity (key, update, deactivate). Defaults to
|
|
3030
3090
|
* {@link keystoreApiFactory}.
|
|
@@ -3042,6 +3102,7 @@ var DidBtcr2Cli = class {
|
|
|
3042
3102
|
registerResolveCommand(this.program, factory, globals);
|
|
3043
3103
|
registerUpdateCommand(this.program, keystoreFactory, globals);
|
|
3044
3104
|
registerDeactivateCommand(this.program, keystoreFactory, globals);
|
|
3105
|
+
registerIdentifierCommand(this.program, factory, globals);
|
|
3045
3106
|
registerKeyCommand(this.program, keystoreFactory, globals);
|
|
3046
3107
|
registerKeystoreCommand(this.program, globals);
|
|
3047
3108
|
registerConfigCommand(this.program, globals);
|
|
@@ -3116,6 +3177,7 @@ function handleError(error, verbose) {
|
|
|
3116
3177
|
registerConfigCommand,
|
|
3117
3178
|
registerCreateCommand,
|
|
3118
3179
|
registerDeactivateCommand,
|
|
3180
|
+
registerIdentifierCommand,
|
|
3119
3181
|
registerInitCommand,
|
|
3120
3182
|
registerKeyCommand,
|
|
3121
3183
|
registerKeystoreCommand,
|
package/dist/esm/src/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DidMethodError } from '@did-btcr2/common';
|
|
2
2
|
import { Command, CommanderError } from 'commander';
|
|
3
|
-
import { registerCompletionCommand, registerConfigCommand, registerCreateCommand, registerDeactivateCommand, registerInitCommand, registerKeyCommand, registerKeystoreCommand, registerProfileCommand, registerQuickstartCommand, registerResolveCommand, registerUpdateCommand, } from './commands/index.js';
|
|
3
|
+
import { registerCompletionCommand, registerConfigCommand, registerCreateCommand, registerDeactivateCommand, registerIdentifierCommand, registerInitCommand, registerKeyCommand, registerKeystoreCommand, registerProfileCommand, registerQuickstartCommand, registerResolveCommand, registerUpdateCommand, } from './commands/index.js';
|
|
4
4
|
import { defaultApiFactory, keystoreApiFactory, resolveOutputFormat } from './config.js';
|
|
5
5
|
import { VERSION } from './version.js';
|
|
6
6
|
/**
|
|
@@ -17,7 +17,7 @@ export class DidBtcr2Cli {
|
|
|
17
17
|
* for known networks and localhost Polar for regtest.
|
|
18
18
|
*
|
|
19
19
|
* @param factory - Optional API factory for keystore-free commands (create,
|
|
20
|
-
* resolve). Defaults to {@link defaultApiFactory}.
|
|
20
|
+
* resolve, identifier). Defaults to {@link defaultApiFactory}.
|
|
21
21
|
* @param keystoreFactory - Optional keystore-aware API factory for commands
|
|
22
22
|
* that need a signing identity (key, update, deactivate). Defaults to
|
|
23
23
|
* {@link keystoreApiFactory}.
|
|
@@ -68,6 +68,7 @@ export class DidBtcr2Cli {
|
|
|
68
68
|
registerResolveCommand(this.program, factory, globals);
|
|
69
69
|
registerUpdateCommand(this.program, keystoreFactory, globals);
|
|
70
70
|
registerDeactivateCommand(this.program, keystoreFactory, globals);
|
|
71
|
+
registerIdentifierCommand(this.program, factory, globals);
|
|
71
72
|
registerKeyCommand(this.program, keystoreFactory, globals);
|
|
72
73
|
registerKeystoreCommand(this.program, globals);
|
|
73
74
|
registerConfigCommand(this.program, globals);
|
package/dist/esm/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAmB,MAAM,aAAa,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,WAAW;IACN,OAAO,CAAU;IAEjC;;;;;;;;;;;;;OAaG;I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AAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC;QACvB,OAAO;IACT,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CLIError } from '../error.js';
|
|
2
|
-
const COMMANDS = 'create resolve read update deactivate delete key config profile completion';
|
|
2
|
+
const COMMANDS = 'create resolve read update deactivate delete identifier key config profile completion';
|
|
3
3
|
/** Registers the `completion` command, which prints a shell completion script to stdout. */
|
|
4
4
|
export function registerCompletionCommand(program, _globals) {
|
|
5
5
|
program
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../../src/commands/completion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../../src/commands/completion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,QAAQ,GAAG,uFAAuF,CAAC;AAEzG,4FAA4F;AAC5F,MAAM,UAAU,yBAAyB,CAAC,OAAgB,EAAE,QAA6B;IACvF,OAAO;SACJ,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,CAAC,KAAK,GAAG,MAAM,EAAE,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,uDAAuD;AACvD,SAAS,gBAAgB,CAAC,KAAa;IACrC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO;gBACL,wEAAwE;gBACxE,uCAAuC,GAAG,QAAQ,GAAG,wCAAwC;gBAC7F,0BAA0B;aAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,KAAK,KAAK;YACR,OAAO;gBACL,sEAAsE;gBACtE,qBAAqB,GAAG,QAAQ,GAAG,IAAI;gBACvC,sBAAsB;aACvB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,KAAK,MAAM;YACT,OAAO;gBACL,wEAAwE;gBACxE,2BAA2B,GAAG,QAAQ,GAAG,GAAG;aAC7C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf;YACE,MAAM,IAAI,QAAQ,CAAC,sBAAsB,KAAK,4BAA4B,EAAE,wBAAwB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACrH,CAAC;AACH,CAAC"}
|