@did-btcr2/cli 0.5.1 → 0.5.3
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/dist/.tsbuildinfo +1 -0
- package/dist/cjs/index.js +339 -7
- package/dist/esm/src/cli.js +1 -1
- package/dist/esm/src/cli.js.map +1 -1
- package/dist/esm/src/commands/create.js.map +1 -1
- package/dist/esm/src/commands/resolve.js +2 -0
- package/dist/esm/src/commands/resolve.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/create.d.ts +2 -2
- package/dist/types/src/commands/create.d.ts.map +1 -1
- package/dist/types/src/commands/deactivate.d.ts +2 -2
- package/dist/types/src/commands/deactivate.d.ts.map +1 -1
- package/dist/types/src/commands/resolve.d.ts +2 -2
- package/dist/types/src/commands/resolve.d.ts.map +1 -1
- package/dist/types/src/commands/update.d.ts +2 -2
- package/dist/types/src/commands/update.d.ts.map +1 -1
- package/dist/types/src/output.d.ts +1 -1
- package/dist/types/src/output.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/cli.ts +4 -3
- package/src/commands/create.ts +4 -3
- package/src/commands/deactivate.ts +2 -2
- package/src/commands/resolve.ts +4 -2
- package/src/commands/update.ts +2 -2
- package/src/output.ts +1 -1
- package/dist/cjs/cli.js +0 -77
- package/dist/cjs/cli.js.map +0 -1
- package/dist/cjs/commands/create.js +0 -48
- package/dist/cjs/commands/create.js.map +0 -1
- package/dist/cjs/commands/deactivate.js +0 -41
- package/dist/cjs/commands/deactivate.js.map +0 -1
- package/dist/cjs/commands/index.js +0 -5
- package/dist/cjs/commands/index.js.map +0 -1
- package/dist/cjs/commands/resolve.js +0 -43
- package/dist/cjs/commands/resolve.js.map +0 -1
- package/dist/cjs/commands/update.js +0 -39
- package/dist/cjs/commands/update.js.map +0 -1
- package/dist/cjs/error.js +0 -10
- package/dist/cjs/error.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/output.js +0 -16
- package/dist/cjs/output.js.map +0 -1
- package/dist/cjs/types.js +0 -4
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/version.js +0 -22
- package/dist/cjs/version.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,339 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
CLIError: () => CLIError,
|
|
24
|
+
DidBtcr2Cli: () => DidBtcr2Cli,
|
|
25
|
+
SUPPORTED_NETWORKS: () => SUPPORTED_NETWORKS,
|
|
26
|
+
VERSION: () => VERSION,
|
|
27
|
+
formatResult: () => formatResult,
|
|
28
|
+
registerCreateCommand: () => registerCreateCommand,
|
|
29
|
+
registerDeactivateCommand: () => registerDeactivateCommand,
|
|
30
|
+
registerResolveCommand: () => registerResolveCommand,
|
|
31
|
+
registerUpdateCommand: () => registerUpdateCommand
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
|
|
35
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.7.3_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js
|
|
36
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
37
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
38
|
+
|
|
39
|
+
// src/cli.ts
|
|
40
|
+
var import_commander = require("commander");
|
|
41
|
+
var import_api2 = require("@did-btcr2/api");
|
|
42
|
+
|
|
43
|
+
// src/error.ts
|
|
44
|
+
var import_common = require("@did-btcr2/common");
|
|
45
|
+
var CLIError = class extends import_common.DidMethodError {
|
|
46
|
+
constructor(message, type = "CLIError", data) {
|
|
47
|
+
super(message, { type, name: "CLIError", data });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/output.ts
|
|
52
|
+
function formatResult(result, options) {
|
|
53
|
+
if (options.output === "json") {
|
|
54
|
+
return JSON.stringify(result, null, 2);
|
|
55
|
+
}
|
|
56
|
+
const { data } = result;
|
|
57
|
+
return typeof data === "string" ? data : JSON.stringify(data, null, 2);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/types.ts
|
|
61
|
+
var SUPPORTED_NETWORKS = [
|
|
62
|
+
"bitcoin",
|
|
63
|
+
"testnet3",
|
|
64
|
+
"testnet4",
|
|
65
|
+
"signet",
|
|
66
|
+
"mutinynet",
|
|
67
|
+
"regtest"
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
// src/commands/create.ts
|
|
71
|
+
var EXPECTED_BYTES = {
|
|
72
|
+
k: { length: 33, label: "secp256k1 compressed public key (33 bytes)" },
|
|
73
|
+
x: { length: 32, label: "SHA-256 hash (32 bytes)" }
|
|
74
|
+
};
|
|
75
|
+
function registerCreateCommand(program, api, globals) {
|
|
76
|
+
program.command("create").description("Create an identifier and initial DID document").requiredOption("-t, --type <type>", "Identifier type <k|x>", "k").requiredOption(
|
|
77
|
+
"-n, --network <network>",
|
|
78
|
+
"Identifier bitcoin network <bitcoin|testnet3|testnet4|signet|mutinynet|regtest>"
|
|
79
|
+
).requiredOption(
|
|
80
|
+
"-b, --bytes <bytes>",
|
|
81
|
+
"Genesis bytes as a hex string. If type=k, MUST be secp256k1 public key. If type=x, MUST be SHA-256 hash of a genesis document"
|
|
82
|
+
).action(async (options) => {
|
|
83
|
+
const parsed = validateCreateOptions(options);
|
|
84
|
+
const type = parsed.type === "k" ? "deterministic" : "external";
|
|
85
|
+
const genesisBytes = Buffer.from(parsed.bytes, "hex");
|
|
86
|
+
const data = api.createDid(type, genesisBytes, { network: parsed.network });
|
|
87
|
+
const result = { action: "create", data };
|
|
88
|
+
console.log(formatResult(result, globals()));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function validateCreateOptions(options) {
|
|
92
|
+
if (!["k", "x"].includes(options.type)) {
|
|
93
|
+
throw new CLIError(
|
|
94
|
+
'Invalid type. Must be "k" or "x".',
|
|
95
|
+
"INVALID_ARGUMENT_ERROR",
|
|
96
|
+
options
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (!SUPPORTED_NETWORKS.includes(options.network)) {
|
|
100
|
+
throw new CLIError(
|
|
101
|
+
'Invalid network. Must be one of "bitcoin", "testnet3", "testnet4", "signet", "mutinynet", or "regtest".',
|
|
102
|
+
"INVALID_ARGUMENT_ERROR",
|
|
103
|
+
options
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
const buf = Buffer.from(options.bytes, "hex");
|
|
107
|
+
if (buf.length === 0) {
|
|
108
|
+
throw new CLIError(
|
|
109
|
+
"Invalid bytes. Must be a non-empty hex string.",
|
|
110
|
+
"INVALID_ARGUMENT_ERROR",
|
|
111
|
+
options
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const expected = EXPECTED_BYTES[options.type];
|
|
115
|
+
if (buf.length !== expected.length) {
|
|
116
|
+
throw new CLIError(
|
|
117
|
+
`Invalid bytes length for type="${options.type}": expected ${expected.label}, got ${buf.length} bytes.`,
|
|
118
|
+
"INVALID_ARGUMENT_ERROR",
|
|
119
|
+
options
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
type: options.type,
|
|
124
|
+
network: options.network,
|
|
125
|
+
bytes: options.bytes
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/commands/resolve.ts
|
|
130
|
+
var import_api = require("@did-btcr2/api");
|
|
131
|
+
var import_promises = require("fs/promises");
|
|
132
|
+
function registerResolveCommand(program, api, globals) {
|
|
133
|
+
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").action(async (options) => {
|
|
134
|
+
console.log("resolve command options prevalidation", options);
|
|
135
|
+
const parsed = await validateResolveOptions(options);
|
|
136
|
+
console.log("resolve command options postvalidation", options);
|
|
137
|
+
const data = await api.resolveDid(parsed.identifier, parsed.options);
|
|
138
|
+
const result = { action: "resolve", data };
|
|
139
|
+
console.log(formatResult(result, globals()));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async function validateResolveOptions(options) {
|
|
143
|
+
import_api.Identifier.decode(options.identifier);
|
|
144
|
+
let resolutionOptions = void 0;
|
|
145
|
+
if (options.resolutionOptions) {
|
|
146
|
+
try {
|
|
147
|
+
resolutionOptions = JSON.parse(options.resolutionOptions);
|
|
148
|
+
} catch {
|
|
149
|
+
throw new CLIError(
|
|
150
|
+
"Invalid resolution options. Must be a valid JSON string.",
|
|
151
|
+
"INVALID_ARGUMENT_ERROR",
|
|
152
|
+
options
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
} else if (options.resolutionOptionsPath) {
|
|
156
|
+
try {
|
|
157
|
+
const content = await (0, import_promises.readFile)(options.resolutionOptionsPath, "utf-8");
|
|
158
|
+
resolutionOptions = JSON.parse(content);
|
|
159
|
+
} catch {
|
|
160
|
+
throw new CLIError(
|
|
161
|
+
"Invalid resolution options path. Must be a valid path to a JSON file.",
|
|
162
|
+
"INVALID_ARGUMENT_ERROR",
|
|
163
|
+
options
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { identifier: options.identifier, options: resolutionOptions };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/commands/update.ts
|
|
171
|
+
function registerUpdateCommand(program, api, globals) {
|
|
172
|
+
program.command("update").description("Update a did:btcr2 document.").requiredOption(
|
|
173
|
+
"-s, --source-document <json>",
|
|
174
|
+
"Source DID document as JSON string",
|
|
175
|
+
parseJsonArg("--source-document")
|
|
176
|
+
).requiredOption(
|
|
177
|
+
"--source-version-id <number>",
|
|
178
|
+
"Source version ID as a number"
|
|
179
|
+
).requiredOption(
|
|
180
|
+
"-p, --patches <json>",
|
|
181
|
+
"JSON Patch operations as a JSON string array",
|
|
182
|
+
parseJsonArg("--patches")
|
|
183
|
+
).requiredOption(
|
|
184
|
+
"-m, --verification-method-id <id>",
|
|
185
|
+
"DID document verification method ID"
|
|
186
|
+
).requiredOption(
|
|
187
|
+
"-b, --beacon-id <json>",
|
|
188
|
+
"Beacon ID as a JSON string",
|
|
189
|
+
parseJsonArg("--beacon-id")
|
|
190
|
+
).action(async (options) => {
|
|
191
|
+
const parsed = {
|
|
192
|
+
sourceDocument: options.sourceDocument,
|
|
193
|
+
patches: options.patches,
|
|
194
|
+
sourceVersionId: Number(options.sourceVersionId),
|
|
195
|
+
verificationMethodId: options.verificationMethodId,
|
|
196
|
+
beaconId: options.beaconId
|
|
197
|
+
};
|
|
198
|
+
const data = await api.btcr2.update(parsed);
|
|
199
|
+
const result = { action: "update", data };
|
|
200
|
+
console.log(formatResult(result, globals()));
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function parseJsonArg(flagName) {
|
|
204
|
+
return (value) => {
|
|
205
|
+
try {
|
|
206
|
+
return JSON.parse(value);
|
|
207
|
+
} catch {
|
|
208
|
+
throw new CLIError(
|
|
209
|
+
`Invalid JSON for ${flagName}. Must be a valid JSON string.`,
|
|
210
|
+
"INVALID_ARGUMENT_ERROR",
|
|
211
|
+
{ flagName, value }
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/commands/deactivate.ts
|
|
218
|
+
var DEACTIVATION_PATCH = [{ op: "add", path: "/deactivated", value: true }];
|
|
219
|
+
function registerDeactivateCommand(program, api, globals) {
|
|
220
|
+
program.command("deactivate").alias("delete").description("Deactivate the did:btcr2 identifier permanently. This is irreversible.").requiredOption(
|
|
221
|
+
"-s, --source-document <json>",
|
|
222
|
+
"Current DID document as JSON string",
|
|
223
|
+
parseJsonArg2("--source-document")
|
|
224
|
+
).requiredOption(
|
|
225
|
+
"--source-version-id <number>",
|
|
226
|
+
"Current version ID of the DID document"
|
|
227
|
+
).requiredOption(
|
|
228
|
+
"-m, --verification-method-id <id>",
|
|
229
|
+
"DID document verification method ID used to sign the deactivation"
|
|
230
|
+
).requiredOption(
|
|
231
|
+
"-b, --beacon-id <json>",
|
|
232
|
+
"Beacon ID as a JSON string",
|
|
233
|
+
parseJsonArg2("--beacon-id")
|
|
234
|
+
).action(async (options) => {
|
|
235
|
+
const parsed = {
|
|
236
|
+
sourceDocument: options.sourceDocument,
|
|
237
|
+
patches: DEACTIVATION_PATCH,
|
|
238
|
+
sourceVersionId: Number(options.sourceVersionId),
|
|
239
|
+
verificationMethodId: options.verificationMethodId,
|
|
240
|
+
beaconId: options.beaconId
|
|
241
|
+
};
|
|
242
|
+
const data = await api.btcr2.update(parsed);
|
|
243
|
+
const result = { action: "deactivate", data };
|
|
244
|
+
console.log(formatResult(result, globals()));
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function parseJsonArg2(flagName) {
|
|
248
|
+
return (value) => {
|
|
249
|
+
try {
|
|
250
|
+
return JSON.parse(value);
|
|
251
|
+
} catch {
|
|
252
|
+
throw new CLIError(
|
|
253
|
+
`Invalid JSON for ${flagName}. Must be a valid JSON string.`,
|
|
254
|
+
"INVALID_ARGUMENT_ERROR",
|
|
255
|
+
{ flagName, value }
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/version.ts
|
|
262
|
+
var import_node_fs = require("fs");
|
|
263
|
+
var import_node_path = require("path");
|
|
264
|
+
var import_node_url = require("url");
|
|
265
|
+
function readVersion() {
|
|
266
|
+
let dir = (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
267
|
+
for (let i = 0; i < 5; i++) {
|
|
268
|
+
try {
|
|
269
|
+
const pkg = JSON.parse((0, import_node_fs.readFileSync)((0, import_node_path.join)(dir, "package.json"), "utf-8"));
|
|
270
|
+
if (pkg.name === "@did-btcr2/cli") return pkg.version;
|
|
271
|
+
} catch {
|
|
272
|
+
}
|
|
273
|
+
dir = (0, import_node_path.dirname)(dir);
|
|
274
|
+
}
|
|
275
|
+
return "0.0.0";
|
|
276
|
+
}
|
|
277
|
+
var VERSION = readVersion();
|
|
278
|
+
|
|
279
|
+
// src/cli.ts
|
|
280
|
+
var DidBtcr2Cli = class {
|
|
281
|
+
program;
|
|
282
|
+
api;
|
|
283
|
+
/**
|
|
284
|
+
* Initializes the CLI with an optional pre-configured API instance.
|
|
285
|
+
* @param {DidBtcr2Api} api - Optional API instance. Defaults to an unconfigured instance.
|
|
286
|
+
*/
|
|
287
|
+
constructor(api = (0, import_api2.createApi)({ btc: { network: "mutinynet" } })) {
|
|
288
|
+
this.api = api;
|
|
289
|
+
this.program = new import_commander.Command("btcr2").version(`btcr2 ${VERSION}`, "-v, --version", "Output the current version").description("CLI tool for the did:btcr2 method").option("-o, --output <format>", "Output format <json|text>", "text").option("--verbose", "Verbose output", false).option("--quiet", "Suppress non-essential output", false);
|
|
290
|
+
const globals = () => this.program.opts();
|
|
291
|
+
registerCreateCommand(this.program, this.api, globals);
|
|
292
|
+
registerResolveCommand(this.program, this.api, globals);
|
|
293
|
+
registerUpdateCommand(this.program, this.api, globals);
|
|
294
|
+
registerDeactivateCommand(this.program, this.api, globals);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Runs the CLI with the provided argv or process.argv.
|
|
298
|
+
* @param {string[]} [argv] - Optional array of command-line arguments.
|
|
299
|
+
* @returns {Promise<void>} - Resolves when execution is complete.
|
|
300
|
+
*/
|
|
301
|
+
async run(argv) {
|
|
302
|
+
try {
|
|
303
|
+
const normalized = normalizeArgv(argv ?? process.argv);
|
|
304
|
+
await this.program.parseAsync(normalized, { from: "node" });
|
|
305
|
+
if (!this.program.args.length) this.program.outputHelp();
|
|
306
|
+
} catch (error) {
|
|
307
|
+
handleError(error);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
function normalizeArgv(argv) {
|
|
312
|
+
if (argv.length >= 2) return argv;
|
|
313
|
+
if (argv.length === 1) return ["node", argv[0]];
|
|
314
|
+
return ["node", "btcr2"];
|
|
315
|
+
}
|
|
316
|
+
function handleError(error) {
|
|
317
|
+
if (error instanceof import_commander.CommanderError && (error.code === "commander.helpDisplayed" || error.code === "commander.help")) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (error instanceof CLIError) {
|
|
321
|
+
console.error(error.message);
|
|
322
|
+
process.exitCode ??= 1;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
console.error(error);
|
|
326
|
+
process.exitCode ??= 1;
|
|
327
|
+
}
|
|
328
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
329
|
+
0 && (module.exports = {
|
|
330
|
+
CLIError,
|
|
331
|
+
DidBtcr2Cli,
|
|
332
|
+
SUPPORTED_NETWORKS,
|
|
333
|
+
VERSION,
|
|
334
|
+
formatResult,
|
|
335
|
+
registerCreateCommand,
|
|
336
|
+
registerDeactivateCommand,
|
|
337
|
+
registerResolveCommand,
|
|
338
|
+
registerUpdateCommand
|
|
339
|
+
});
|
package/dist/esm/src/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ export class DidBtcr2Cli {
|
|
|
13
13
|
* Initializes the CLI with an optional pre-configured API instance.
|
|
14
14
|
* @param {DidBtcr2Api} api - Optional API instance. Defaults to an unconfigured instance.
|
|
15
15
|
*/
|
|
16
|
-
constructor(api = createApi()) {
|
|
16
|
+
constructor(api = createApi({ btc: { network: 'mutinynet' } })) {
|
|
17
17
|
this.api = api;
|
|
18
18
|
this.program = new Command('btcr2')
|
|
19
19
|
.version(`btcr2 ${VERSION}`, '-v, --version', 'Output the current version')
|
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,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;A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AAM,EAAE,CAAC,CAAC;YAC5D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAc;IACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,KAAc;IACjC,IACE,KAAK,YAAY,cAAc;QAC/B,CAAC,KAAK,CAAC,IAAI,KAAK,yBAAyB,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,EAC7E,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/create.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":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
|
11
11
|
.option('-r, --resolution-options <json>', 'JSON string containing resolution options')
|
|
12
12
|
.option('-p, --resolution-options-path <path>', 'Path to a JSON file containing resolution options')
|
|
13
13
|
.action(async (options) => {
|
|
14
|
+
console.log('resolve command options prevalidation', options);
|
|
14
15
|
const parsed = await validateResolveOptions(options);
|
|
16
|
+
console.log('resolve command options postvalidation', options);
|
|
15
17
|
const data = await api.resolveDid(parsed.identifier, parsed.options);
|
|
16
18
|
const result = { action: 'resolve', data };
|
|
17
19
|
console.log(formatResult(result, globals()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../../src/commands/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,UAAU,sBAAsB,CACpC,OAAiB,EACjB,GAAqB,EACrB,OAA6B;IAE7B,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,KAAK,CAAC,MAAM,CAAC;SACb,WAAW,CAAC,6CAA6C,CAAC;SAC1D,cAAc,CAAC,+BAA+B,EAAE,sBAAsB,CAAC;SACvE,MAAM,CAAC,iCAAiC,EAAE,2CAA2C,CAAC;SACtF,MAAM,CAAC,sCAAsC,EAAE,mDAAmD,CAAC;SACnG,MAAM,CAAC,KAAK,EAAE,OAId,EAAE,EAAE;QACH,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,SAAkB,EAAE,IAAI,EAA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,QAAQ,CAChB,0DAA0D,EAC1D,wBAAwB,EACxB,OAAO,CACR,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;YACvE,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,QAAQ,CAChB,uEAAuE,EACvE,wBAAwB,EACxB,OAAO,CACR,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AACxE,CAAC"}
|
package/dist/types/src/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAYjD;;GAEG;AACH,qBAAa,WAAW;IACtB,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAElC;;;OAGG;gBACS,GAAG,GAAE,WAA0D;IAiB3E;;;;OAIG;IACU,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CASjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { GlobalOptions } from '../types.js';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
import type { GlobalOptions } from '../types.js';
|
|
4
4
|
export declare function registerCreateCommand(program: Command, api: DidBtcr2Api, globals: () => GlobalOptions): void;
|
|
5
5
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAEV,aAAa,EACC,MAAM,aAAa,CAAC;AAWpC,wBAAgB,qBAAqB,CACnC,OAAO,EAAG,OAAO,EACjB,GAAG,EAAO,WAAW,EACrB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAuBN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { GlobalOptions } from '../types.js';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
import type { GlobalOptions } from '../types.js';
|
|
4
4
|
export declare function registerDeactivateCommand(program: Command, api: DidBtcr2Api, globals: () => GlobalOptions): void;
|
|
5
5
|
//# sourceMappingURL=deactivate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deactivate.d.ts","sourceRoot":"","sources":["../../../../src/commands/deactivate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"deactivate.d.ts","sourceRoot":"","sources":["../../../../src/commands/deactivate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAKvE,wBAAgB,yBAAyB,CACvC,OAAO,EAAG,OAAO,EACjB,GAAG,EAAO,WAAW,EACrB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAwCN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { GlobalOptions } from '../types.js';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
import type { GlobalOptions } from '../types.js';
|
|
4
4
|
export declare function registerResolveCommand(program: Command, api: DidBtcr2Api, globals: () => GlobalOptions): void;
|
|
5
5
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../src/commands/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../src/commands/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,aAAa,CAAC;AAExE,wBAAgB,sBAAsB,CACpC,OAAO,EAAG,OAAO,EACjB,GAAG,EAAO,WAAW,EACrB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAoBN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { GlobalOptions } from '../types.js';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
import type { GlobalOptions } from '../types.js';
|
|
4
4
|
export declare function registerUpdateCommand(program: Command, api: DidBtcr2Api, globals: () => GlobalOptions): void;
|
|
5
5
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAEvE,wBAAgB,qBAAqB,CACnC,OAAO,EAAG,OAAO,EACjB,GAAG,EAAO,WAAW,EACrB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CA6CN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAMlF"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-btcr2/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for interacting with did-btcr2-js, the JavaScript/TypeScript reference implementation of the did:btcr2 method. Exposes various parts of multiple packages in the did-btcr2-js monorepo.",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
|
-
"module": "./dist/esm/index.js",
|
|
7
|
+
"module": "./dist/esm/src/index.js",
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
10
|
"btcr2": "./dist/esm/bin/btcr2.js"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/types/index.d.ts",
|
|
15
|
-
"import": "./dist/esm/index.js",
|
|
15
|
+
"import": "./dist/esm/src/index.js",
|
|
16
16
|
"require": "./dist/cjs/index.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@web5/dids": "^1.2.0",
|
|
60
60
|
"commander": "^13.1.0",
|
|
61
|
-
"@did-btcr2/
|
|
62
|
-
"@did-btcr2/common": "^
|
|
63
|
-
"@did-btcr2/
|
|
64
|
-
"@did-btcr2/
|
|
61
|
+
"@did-btcr2/api": "^0.4.0",
|
|
62
|
+
"@did-btcr2/common": "^9.0.0",
|
|
63
|
+
"@did-btcr2/cryptosuite": "^6.0.6",
|
|
64
|
+
"@did-btcr2/method": "^0.26.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/js": "^9.21.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"reinstall": "pnpm install --force",
|
|
98
98
|
"build": "pnpm clean:build && pnpm build:esm && pnpm build:cjs",
|
|
99
99
|
"build:esm": "rimraf dist/esm dist/types && pnpm tsc -p tsconfig.json && chmod +x dist/esm/bin/btcr2.js",
|
|
100
|
-
"build:cjs": "
|
|
100
|
+
"build:cjs": "tsup && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json",
|
|
101
101
|
"build:tests": "pnpm clean:tests && pnpm tsc -p tests/tsconfig.json",
|
|
102
102
|
"build:all": "pnpm build && pnpm build:tests",
|
|
103
103
|
"lint": "eslint . --max-warnings 0",
|
package/src/cli.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command, CommanderError } from 'commander';
|
|
2
|
-
import { DidBtcr2Api
|
|
2
|
+
import type { DidBtcr2Api} from '@did-btcr2/api';
|
|
3
|
+
import { createApi } from '@did-btcr2/api';
|
|
3
4
|
import {
|
|
4
5
|
registerCreateCommand,
|
|
5
6
|
registerDeactivateCommand,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
registerUpdateCommand,
|
|
8
9
|
} from './commands/index.js';
|
|
9
10
|
import { CLIError } from './error.js';
|
|
10
|
-
import { GlobalOptions } from './types.js';
|
|
11
|
+
import type { GlobalOptions } from './types.js';
|
|
11
12
|
import { VERSION } from './version.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -21,7 +22,7 @@ export class DidBtcr2Cli {
|
|
|
21
22
|
* Initializes the CLI with an optional pre-configured API instance.
|
|
22
23
|
* @param {DidBtcr2Api} api - Optional API instance. Defaults to an unconfigured instance.
|
|
23
24
|
*/
|
|
24
|
-
constructor(api: DidBtcr2Api = createApi()) {
|
|
25
|
+
constructor(api: DidBtcr2Api = createApi({ btc: { network: 'mutinynet' } })) {
|
|
25
26
|
this.api = api;
|
|
26
27
|
this.program = new Command('btcr2')
|
|
27
28
|
.version(`btcr2 ${VERSION}`, '-v, --version', 'Output the current version')
|
package/src/commands/create.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
3
|
import { CLIError } from '../error.js';
|
|
4
4
|
import { formatResult } from '../output.js';
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
CreateCommandOptions,
|
|
7
7
|
GlobalOptions,
|
|
8
|
-
NetworkOption
|
|
8
|
+
NetworkOption} from '../types.js';
|
|
9
|
+
import {
|
|
9
10
|
SUPPORTED_NETWORKS,
|
|
10
11
|
} from '../types.js';
|
|
11
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
3
|
import { CLIError } from '../error.js';
|
|
4
4
|
import { formatResult } from '../output.js';
|
|
5
|
-
import { GlobalOptions, UpdateCommandOptions } from '../types.js';
|
|
5
|
+
import type { GlobalOptions, UpdateCommandOptions } from '../types.js';
|
|
6
6
|
|
|
7
7
|
/** The JSON Patch that marks a DID document as permanently deactivated. */
|
|
8
8
|
const DEACTIVATION_PATCH = [{ op: 'add' as const, path: '/deactivated', value: true }];
|
package/src/commands/resolve.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
2
|
import { Identifier } from '@did-btcr2/api';
|
|
3
|
-
import { Command } from 'commander';
|
|
3
|
+
import type { Command } from 'commander';
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { CLIError } from '../error.js';
|
|
6
6
|
import { formatResult } from '../output.js';
|
|
7
|
-
import { GlobalOptions, ResolveCommandOptions } from '../types.js';
|
|
7
|
+
import type { GlobalOptions, ResolveCommandOptions } from '../types.js';
|
|
8
8
|
|
|
9
9
|
export function registerResolveCommand(
|
|
10
10
|
program : Command,
|
|
@@ -23,7 +23,9 @@ export function registerResolveCommand(
|
|
|
23
23
|
resolutionOptions?: string;
|
|
24
24
|
resolutionOptionsPath?: string;
|
|
25
25
|
}) => {
|
|
26
|
+
console.log('resolve command options prevalidation', options);
|
|
26
27
|
const parsed = await validateResolveOptions(options);
|
|
28
|
+
console.log('resolve command options postvalidation', options);
|
|
27
29
|
const data = await api.resolveDid(parsed.identifier, parsed.options);
|
|
28
30
|
const result = { action: 'resolve' as const, data };
|
|
29
31
|
console.log(formatResult(result, globals()));
|
package/src/commands/update.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DidBtcr2Api } from '@did-btcr2/api';
|
|
2
|
-
import { Command } from 'commander';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
3
|
import { CLIError } from '../error.js';
|
|
4
4
|
import { formatResult } from '../output.js';
|
|
5
|
-
import { GlobalOptions, UpdateCommandOptions } from '../types.js';
|
|
5
|
+
import type { GlobalOptions, UpdateCommandOptions } from '../types.js';
|
|
6
6
|
|
|
7
7
|
export function registerUpdateCommand(
|
|
8
8
|
program : Command,
|
package/src/output.ts
CHANGED