@interop/did-cli 0.10.0 → 0.10.1

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/commands/collection-command.d.ts +169 -0
  3. package/dist/commands/collection-command.d.ts.map +1 -0
  4. package/dist/commands/collection-command.js +241 -0
  5. package/dist/commands/collection-command.js.map +1 -0
  6. package/dist/commands/did/create.d.ts +63 -0
  7. package/dist/commands/did/create.d.ts.map +1 -0
  8. package/dist/commands/did/create.js +625 -0
  9. package/dist/commands/did/create.js.map +1 -0
  10. package/dist/commands/did/manage.d.ts +68 -0
  11. package/dist/commands/did/manage.d.ts.map +1 -0
  12. package/dist/commands/did/manage.js +287 -0
  13. package/dist/commands/did/manage.js.map +1 -0
  14. package/dist/commands/did/service.d.ts +93 -0
  15. package/dist/commands/did/service.d.ts.map +1 -0
  16. package/dist/commands/did/service.js +324 -0
  17. package/dist/commands/did/service.js.map +1 -0
  18. package/dist/commands/did/webvh-update.d.ts +170 -0
  19. package/dist/commands/did/webvh-update.d.ts.map +1 -0
  20. package/dist/commands/did/webvh-update.js +402 -0
  21. package/dist/commands/did/webvh-update.js.map +1 -0
  22. package/dist/commands/did.d.ts +8 -8
  23. package/dist/commands/did.d.ts.map +1 -1
  24. package/dist/commands/did.js +27 -1519
  25. package/dist/commands/did.js.map +1 -1
  26. package/dist/commands/edv.d.ts +15 -6
  27. package/dist/commands/edv.d.ts.map +1 -1
  28. package/dist/commands/edv.js +38 -28
  29. package/dist/commands/edv.js.map +1 -1
  30. package/dist/commands/key.d.ts +104 -0
  31. package/dist/commands/key.d.ts.map +1 -1
  32. package/dist/commands/key.js +432 -402
  33. package/dist/commands/key.js.map +1 -1
  34. package/dist/commands/vc.d.ts +2 -1
  35. package/dist/commands/vc.d.ts.map +1 -1
  36. package/dist/commands/vc.js +88 -145
  37. package/dist/commands/vc.js.map +1 -1
  38. package/dist/commands/was/collection.d.ts.map +1 -1
  39. package/dist/commands/was/collection.js +31 -85
  40. package/dist/commands/was/collection.js.map +1 -1
  41. package/dist/commands/was/publish.d.ts.map +1 -1
  42. package/dist/commands/was/publish.js +16 -44
  43. package/dist/commands/was/publish.js.map +1 -1
  44. package/dist/commands/was/resource.d.ts.map +1 -1
  45. package/dist/commands/was/resource.js +24 -51
  46. package/dist/commands/was/resource.js.map +1 -1
  47. package/dist/commands/was/shared.d.ts +78 -0
  48. package/dist/commands/was/shared.d.ts.map +1 -1
  49. package/dist/commands/was/shared.js +84 -0
  50. package/dist/commands/was/shared.js.map +1 -1
  51. package/dist/commands/was/space.d.ts.map +1 -1
  52. package/dist/commands/was/space.js +10 -16
  53. package/dist/commands/was/space.js.map +1 -1
  54. package/dist/commands/was/tree.d.ts.map +1 -1
  55. package/dist/commands/was/tree.js +4 -6
  56. package/dist/commands/was/tree.js.map +1 -1
  57. package/dist/commands/was.d.ts.map +1 -1
  58. package/dist/commands/was.js +60 -74
  59. package/dist/commands/was.js.map +1 -1
  60. package/dist/commands/zcap.d.ts +0 -18
  61. package/dist/commands/zcap.d.ts.map +1 -1
  62. package/dist/commands/zcap.js +63 -155
  63. package/dist/commands/zcap.js.map +1 -1
  64. package/dist/documentLoader.d.ts +5 -0
  65. package/dist/documentLoader.d.ts.map +1 -0
  66. package/dist/documentLoader.js +29 -0
  67. package/dist/documentLoader.js.map +1 -0
  68. package/dist/edv/hmac.d.ts.map +1 -1
  69. package/dist/edv/hmac.js +12 -12
  70. package/dist/edv/hmac.js.map +1 -1
  71. package/dist/edv/recipients.d.ts +2 -0
  72. package/dist/edv/recipients.d.ts.map +1 -1
  73. package/dist/edv/recipients.js +12 -15
  74. package/dist/edv/recipients.js.map +1 -1
  75. package/dist/meta.d.ts +36 -11
  76. package/dist/meta.d.ts.map +1 -1
  77. package/dist/meta.js +95 -73
  78. package/dist/meta.js.map +1 -1
  79. package/dist/storage.d.ts +48 -13
  80. package/dist/storage.d.ts.map +1 -1
  81. package/dist/storage.js +40 -16
  82. package/dist/storage.js.map +1 -1
  83. package/dist/vc/issue.d.ts.map +1 -1
  84. package/dist/vc/issue.js +4 -7
  85. package/dist/vc/issue.js.map +1 -1
  86. package/dist/vc/verify.d.ts +10 -0
  87. package/dist/vc/verify.d.ts.map +1 -1
  88. package/dist/vc/verify.js +38 -1
  89. package/dist/vc/verify.js.map +1 -1
  90. package/dist/was/client.d.ts.map +1 -1
  91. package/dist/was/client.js +8 -2
  92. package/dist/was/client.js.map +1 -1
  93. package/dist/was/grant.d.ts +44 -0
  94. package/dist/was/grant.d.ts.map +1 -0
  95. package/dist/was/grant.js +78 -0
  96. package/dist/was/grant.js.map +1 -0
  97. package/dist/was/registry.d.ts.map +1 -1
  98. package/dist/was/registry.js +9 -2
  99. package/dist/was/registry.js.map +1 -1
  100. package/dist/zcap/delegate.d.ts.map +1 -1
  101. package/dist/zcap/delegate.js +1 -6
  102. package/dist/zcap/delegate.js.map +1 -1
  103. package/dist/zcap/signer.d.ts.map +1 -1
  104. package/dist/zcap/signer.js.map +1 -1
  105. package/package.json +5 -4
  106. package/dist/keys/webvh-driver.d.ts +0 -24
  107. package/dist/keys/webvh-driver.d.ts.map +0 -1
  108. package/dist/keys/webvh-driver.js +0 -73
  109. package/dist/keys/webvh-driver.js.map +0 -1
@@ -0,0 +1,402 @@
1
+ /**
2
+ * did:webvh update-key plumbing and the `rotate-keys` runner. A stored
3
+ * did:webvh is authored by appending entries to its history log (the source of
4
+ * truth); each entry must be signed by an update (authorization) key. This
5
+ * module owns the shared machinery for that -- loading and resolving the log,
6
+ * selecting the signer (ordinary active key vs. a pre-rotation staged reveal),
7
+ * and persisting the update-keys sidecar -- plus `runRotateKeys`, which rotates
8
+ * the update key itself. The service-update and create runners reuse these
9
+ * helpers.
10
+ */
11
+ import { createInterface } from 'node:readline/promises';
12
+ import { stdin, stdout } from 'node:process';
13
+ import { resolveDIDFromLog, updateDID } from '@interop/did-method-webvh';
14
+ import { Ed25519VerificationKey } from '@interop/ed25519-verification-key';
15
+ import { loadDidLog, loadDidUpdateKeys, saveDidLog, saveDidUpdateKeys, saveToDids } from '../../storage.js';
16
+ import { resolveDidRef } from '../../meta.js';
17
+ import { makeWebvhSigner } from '../../keys/webvh-signer.js';
18
+ import { webvhLogVerifier } from '../../documentLoader.js';
19
+ import { exportUpdateKey, generateStagedKey, loadUpdateKey } from '../../keys/webvh-update.js';
20
+ /**
21
+ * Parse a raw did:webvh history log (newline-delimited JSON) into the entry
22
+ * array the library's resolver/updater expect, ignoring blank lines.
23
+ *
24
+ * @param logText {string}
25
+ * @returns {DIDLog}
26
+ */
27
+ export function parseDidLog(logText) {
28
+ return logText
29
+ .split('\n')
30
+ .filter(line => line.trim().length > 0)
31
+ .map(line => JSON.parse(line));
32
+ }
33
+ /**
34
+ * Ask the user to confirm a hard-to-undo action. Returns true immediately when
35
+ * `--yes` was passed or when stdin is not an interactive TTY (so scripts and
36
+ * tests are not blocked); otherwise prompts and requires an explicit `y`.
37
+ *
38
+ * @param options {object}
39
+ * @param options.message {string}
40
+ * @param options.yes {boolean} the value of the `--yes` flag.
41
+ * @returns {Promise<boolean>}
42
+ */
43
+ export async function confirmAction({ message, yes }) {
44
+ if (yes || !stdin.isTTY) {
45
+ return true;
46
+ }
47
+ const rl = createInterface({ input: stdin, output: stdout });
48
+ try {
49
+ const answer = await rl.question(`${message} [y/N] `);
50
+ return answer.trim().toLowerCase() === 'y';
51
+ }
52
+ finally {
53
+ rl.close();
54
+ }
55
+ }
56
+ /**
57
+ * Load and resolve a locally stored did:webvh history log in preparation for an
58
+ * update, asserting it is updatable. The log is the source of truth for a
59
+ * stored did:webvh, so its absence is what "not locally stored" means.
60
+ *
61
+ * @param options {object}
62
+ * @param options.targetDid {string} the resolved did:webvh DID.
63
+ * @param options.action {string} verb used in error messages (e.g.
64
+ * `rotate keys`, `update services`).
65
+ * @returns {Promise<{ log, doc, meta }>}
66
+ * @throws {Error} with a user-facing message if the log is missing, fails to
67
+ * resolve, or the DID is deactivated.
68
+ */
69
+ export async function resolveWebvhForUpdate({ targetDid, action }) {
70
+ let logText;
71
+ try {
72
+ logText = await loadDidLog(targetDid);
73
+ }
74
+ catch {
75
+ throw new Error(`No locally stored did:webvh found for ${targetDid}`);
76
+ }
77
+ const log = parseDidLog(logText);
78
+ let resolved;
79
+ try {
80
+ resolved = await resolveDIDFromLog(log, { verifier: webvhLogVerifier });
81
+ }
82
+ catch (err) {
83
+ throw new Error(`Could not resolve the DID log: ${err.message}`, {
84
+ cause: err
85
+ });
86
+ }
87
+ if (resolved.meta.deactivated) {
88
+ throw new Error(`Cannot ${action}: the DID is deactivated.`);
89
+ }
90
+ return { log, doc: resolved.doc, meta: resolved.meta };
91
+ }
92
+ /**
93
+ * Resolve a locally stored did:webvh DID from its history log (`.jsonl`) -- the
94
+ * source of truth for the current document and its accumulated parameters.
95
+ * Unlike `resolveWebvhForUpdate` this does not reject a deactivated DID, since
96
+ * `show` should still display it; it returns `undefined` when no log is stored
97
+ * so the caller can fall back to the stored document snapshot.
98
+ *
99
+ * @param did {string} the resolved did:webvh DID.
100
+ * @returns {Promise<{ doc, meta } | undefined>}
101
+ * @throws {Error} if a log exists but fails to resolve/verify.
102
+ */
103
+ export async function resolveStoredWebvh(did) {
104
+ let logText;
105
+ try {
106
+ logText = await loadDidLog(did);
107
+ }
108
+ catch {
109
+ return undefined;
110
+ }
111
+ const { doc, meta } = await resolveDIDFromLog(parseDidLog(logText), {
112
+ verifier: webvhLogVerifier
113
+ });
114
+ return { doc, meta };
115
+ }
116
+ /**
117
+ * Load a did:webvh DID's update-keys sidecar, treating an absent file as
118
+ * `undefined` (no stored secrets) rather than an error.
119
+ *
120
+ * @param did {string}
121
+ * @returns {Promise<WebvhUpdateKeys | undefined>}
122
+ */
123
+ export async function loadStoredUpdateKeys(did) {
124
+ try {
125
+ return await loadDidUpdateKeys(did);
126
+ }
127
+ catch (err) {
128
+ if (err.code !== 'ENOENT') {
129
+ throw err;
130
+ }
131
+ return undefined;
132
+ }
133
+ }
134
+ /**
135
+ * Pre-rotation reveal: validate and load the staged (pre-committed) update key
136
+ * that must sign this entry, returning the signer key pair plus the records
137
+ * that make it the new active key and retire the current one.
138
+ *
139
+ * @param options {object}
140
+ * @param options.stored {WebvhUpdateKeys | undefined} the update-keys sidecar.
141
+ * @param options.meta {Awaited<ReturnType<typeof resolveDIDFromLog>>['meta']}
142
+ * @param options.targetDid {string}
143
+ * @param options.action {string} verb used in error messages.
144
+ * @returns {Promise<{ signerKeyPair, newActive, retiredActive }>}
145
+ * @throws {Error} if the staged secret is missing or has diverged from the
146
+ * log's committed nextKeyHashes.
147
+ */
148
+ export async function revealStagedSigner({ stored, meta, targetDid, action }) {
149
+ if (!stored?.staged) {
150
+ throw new Error(`Cannot ${action}: the pre-committed next-key secret was not found. ` +
151
+ 'While pre-rotation is armed the staged key must sign this entry; ' +
152
+ `check for a backup of the ${targetDid}.update-keys.json sidecar.`);
153
+ }
154
+ if (!meta.nextKeyHashes.includes(stored.staged.nextKeyHash)) {
155
+ throw new Error(`Cannot ${action}: the staged key's hash is not among the log's ` +
156
+ 'committed nextKeyHashes. The local update-keys record has diverged ' +
157
+ 'from the published log (an update may have happened elsewhere); ' +
158
+ 're-resolve before retrying.');
159
+ }
160
+ return {
161
+ signerKeyPair: await loadUpdateKey(stored.staged),
162
+ newActive: {
163
+ publicKeyMultibase: stored.staged.publicKeyMultibase,
164
+ secretKeyMultibase: stored.staged.secretKeyMultibase
165
+ },
166
+ retiredActive: stored.active
167
+ };
168
+ }
169
+ /**
170
+ * Ordinary (non-pre-rotation) signer: the current active update key signs.
171
+ * Returns the signer key pair and the active record it was loaded from.
172
+ *
173
+ * @param options {object}
174
+ * @param options.stored {WebvhUpdateKeys | undefined} the update-keys sidecar.
175
+ * @param options.meta {Awaited<ReturnType<typeof resolveDIDFromLog>>['meta']}
176
+ * @param options.targetDid {string}
177
+ * @param options.action {string} verb used in error messages.
178
+ * @returns {Promise<{ signerKeyPair, activeRecord }>}
179
+ * @throws {Error} if the active secret is missing or no longer matches the
180
+ * log's updateKeys.
181
+ */
182
+ export async function loadActiveSigner({ stored, meta, targetDid, action }) {
183
+ const activeRecord = stored?.active.secretKeyMultibase &&
184
+ meta.updateKeys.includes(stored.active.publicKeyMultibase)
185
+ ? stored.active
186
+ : undefined;
187
+ if (!activeRecord) {
188
+ throw new Error(`Cannot ${action}: the current active update-key secret was not found ` +
189
+ `in ${targetDid}.update-keys.json.`);
190
+ }
191
+ return { signerKeyPair: await loadUpdateKey(activeRecord), activeRecord };
192
+ }
193
+ /**
194
+ * Build the entry signer for a did:webvh update from an update key pair.
195
+ *
196
+ * @param keyPair {Ed25519VerificationKey} mutated: its `id` is set in place.
197
+ * @returns the signer to pass to `updateDID`.
198
+ */
199
+ export function makeWebvhEntrySigner(keyPair) {
200
+ const signer = makeWebvhSigner({ keyPair });
201
+ // `keyPair.signer()` requires an id to be set before signing.
202
+ keyPair.id = signer.getVerificationMethodId();
203
+ return signer;
204
+ }
205
+ /**
206
+ * Write the update-keys sidecar: the active key, the staged next key (or
207
+ * none), and any retired secrets. At creation there is no prior sidecar; after
208
+ * an advance/rotation the superseded active key is appended to `retired` only
209
+ * when `keepOldKey` asks to preserve it.
210
+ *
211
+ * @param options {object}
212
+ * @param options.did {string}
213
+ * @param options.newActive {WebvhUpdateKey}
214
+ * @param [options.newStaged] {WebvhUpdateKey & { nextKeyHash: string }}
215
+ * @param [options.retiredActive] {WebvhUpdateKey} the superseded active key.
216
+ * @param [options.stored] {WebvhUpdateKeys} the prior sidecar, if any.
217
+ * @param [options.keepOldKey] {boolean} retain the retired secret.
218
+ * @returns {Promise<string>} the saved sidecar path.
219
+ */
220
+ export async function persistUpdateKeysSidecar({ did, newActive, newStaged, retiredActive, stored, keepOldKey }) {
221
+ const updated = { active: newActive };
222
+ if (newStaged) {
223
+ updated.staged = newStaged;
224
+ }
225
+ const retiredList = stored?.retired ? [...stored.retired] : [];
226
+ // retiredActive is undefined on the stage-only path, so this also skips that
227
+ // case without a separate guard.
228
+ if (keepOldKey && retiredActive?.secretKeyMultibase) {
229
+ retiredList.push(retiredActive);
230
+ }
231
+ if (retiredList.length > 0) {
232
+ updated.retired = retiredList;
233
+ }
234
+ return saveDidUpdateKeys({ did, updateKeys: updated });
235
+ }
236
+ /**
237
+ * Rotate the update (authorization) key of a locally stored did:webvh DID. By
238
+ * default advances key pre-rotation -- reveals the staged next key and stages a
239
+ * fresh one -- and never touches the document verification methods.
240
+ *
241
+ * @param options {object}
242
+ * @param options.didRef {string} The DID or metadata handle.
243
+ * @param [options.updateKey] {string[]} Rotate to specific update key(s).
244
+ * @param [options.enablePrerotation] {boolean} Turn pre-rotation on.
245
+ * @param [options.stopPrerotation] {boolean} Turn pre-rotation off.
246
+ * @param [options.keepOldKey] {boolean} Retain the retired update key secret.
247
+ * @param [options.yes] {boolean} Skip the confirmation prompt.
248
+ * @returns {Promise<number>} The process exit code.
249
+ */
250
+ export async function runRotateKeys(options) {
251
+ const { didRef } = options;
252
+ let resolved;
253
+ try {
254
+ resolved = await resolveDidRef({ ref: didRef });
255
+ }
256
+ catch (err) {
257
+ console.error(err.message);
258
+ return 1;
259
+ }
260
+ const targetDid = resolved ?? didRef;
261
+ if (!targetDid.startsWith('did:webvh:')) {
262
+ console.error('rotate-keys is only supported for did:webvh DIDs');
263
+ return 1;
264
+ }
265
+ // The history log is the source of truth for a stored did:webvh (the
266
+ // current document is just its last entry's state), so a key-only
267
+ // rotation ignores the resolved document.
268
+ let log;
269
+ let meta;
270
+ try {
271
+ ;
272
+ ({ log, meta } = await resolveWebvhForUpdate({
273
+ targetDid,
274
+ action: 'rotate keys'
275
+ }));
276
+ }
277
+ catch (err) {
278
+ console.error(err.message);
279
+ return 1;
280
+ }
281
+ // Flag validation against the current pre-rotation state.
282
+ if (options.enablePrerotation && options.stopPrerotation) {
283
+ console.error('--enable-prerotation and --stop-prerotation are mutually exclusive');
284
+ return 1;
285
+ }
286
+ if (meta.prerotation) {
287
+ if (options.updateKey) {
288
+ console.error('--update-key is not allowed while pre-rotation is armed; the ' +
289
+ 'next update keys are fixed by the committed nextKeyHashes');
290
+ return 1;
291
+ }
292
+ if (options.enablePrerotation) {
293
+ console.error('pre-rotation is already enabled for this DID');
294
+ return 1;
295
+ }
296
+ }
297
+ else if (options.stopPrerotation) {
298
+ console.error('pre-rotation is already off for this DID');
299
+ return 1;
300
+ }
301
+ const stored = await loadStoredUpdateKeys(targetDid);
302
+ // Inbound: who signs this entry, and what becomes the active key.
303
+ let signerKeyPair;
304
+ let newActive;
305
+ let retiredActive;
306
+ try {
307
+ if (meta.prerotation) {
308
+ // Pre-rotation reveal: the staged key signs its own activation.
309
+ ;
310
+ ({ signerKeyPair, newActive, retiredActive } = await revealStagedSigner({
311
+ stored,
312
+ meta,
313
+ targetDid,
314
+ action: 'rotate keys'
315
+ }));
316
+ }
317
+ else {
318
+ // Ordinary rotation: the current active key signs.
319
+ let activeRecord;
320
+ ({ signerKeyPair, activeRecord } = await loadActiveSigner({
321
+ stored,
322
+ meta,
323
+ targetDid,
324
+ action: 'rotate keys'
325
+ }));
326
+ if (options.enablePrerotation && !options.updateKey) {
327
+ // Stage only: arm pre-rotation without changing the active key.
328
+ newActive = activeRecord;
329
+ }
330
+ else if (options.updateKey) {
331
+ // Rotate to externally-held key(s); the secret is not ours to store.
332
+ newActive = { publicKeyMultibase: options.updateKey[0] };
333
+ retiredActive = activeRecord;
334
+ }
335
+ else {
336
+ newActive = await exportUpdateKey(await Ed25519VerificationKey.generate());
337
+ retiredActive = activeRecord;
338
+ }
339
+ }
340
+ }
341
+ catch (err) {
342
+ console.error(err.message);
343
+ return 1;
344
+ }
345
+ // Outbound: keep the ratchet armed (stage a fresh next key) or not.
346
+ const arm = meta.prerotation
347
+ ? !options.stopPrerotation
348
+ : Boolean(options.enablePrerotation);
349
+ const newStaged = arm ? await generateStagedKey() : undefined;
350
+ const nextKeyHashes = newStaged ? [newStaged.nextKeyHash] : [];
351
+ const confirmed = await confirmAction({
352
+ message: `Rotate the update key of ${targetDid}? This appends a new log ` +
353
+ 'entry and is hard to undo.',
354
+ yes: options.yes
355
+ });
356
+ if (!confirmed) {
357
+ console.error('Aborted.');
358
+ return 0;
359
+ }
360
+ const signer = makeWebvhEntrySigner(signerKeyPair);
361
+ // A sparse updateDID() carries the prior DID document state forward and
362
+ // only overlays the fields an update actually supplies, so a key-only
363
+ // rotation omits all document directives to leave the document
364
+ // unchanged.
365
+ let result;
366
+ try {
367
+ result = await updateDID({
368
+ log,
369
+ signer,
370
+ verifier: webvhLogVerifier,
371
+ updateKeys: [newActive.publicKeyMultibase],
372
+ nextKeyHashes
373
+ });
374
+ }
375
+ catch (err) {
376
+ console.error(`Key rotation failed: ${err.message}`);
377
+ return 1;
378
+ }
379
+ const logPath = await saveDidLog({ did: result.did, log: result.log });
380
+ const docPath = await saveToDids({
381
+ method: 'webvh',
382
+ did: result.did,
383
+ data: result.doc
384
+ });
385
+ const updateKeysPath = await persistUpdateKeysSidecar({
386
+ did: result.did,
387
+ newActive,
388
+ newStaged,
389
+ retiredActive,
390
+ stored,
391
+ keepOldKey: options.keepOldKey
392
+ });
393
+ console.error(`DID document saved to ${docPath}`);
394
+ console.error(`DID history log saved to ${logPath}`);
395
+ console.error(`Update keys saved to ${updateKeysPath}`);
396
+ console.error(nextKeyHashes.length > 0
397
+ ? 'Pre-rotation is armed: a next update key is staged.'
398
+ : 'Pre-rotation is off after this rotation.');
399
+ console.log(JSON.stringify({ id: result.did, didDocument: result.doc }, null, 2));
400
+ return 0;
401
+ }
402
+ //# sourceMappingURL=webvh-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webvh-update.js","sourceRoot":"","sources":["../../../src/commands/did/webvh-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EACL,iBAAiB,EACjB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CAAC;QACtB,CAAC,CAAC,qDAAqD;QACvD,CAAC,CAAC,0CAA0C,CAC/C,CAAA;IAED,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CACrE,CAAA;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
@@ -1,12 +1,12 @@
1
- import { Command } from 'commander';
2
- import { type DIDLog } from '@interop/did-method-webvh';
3
1
  /**
4
- * Parse a raw did:webvh history log (newline-delimited JSON) into the entry
5
- * array the library's resolver/updater expect, ignoring blank lines.
6
- *
7
- * @param logText {string}
8
- * @returns {DIDLog}
2
+ * `did` command wiring. Defines the commander surface (create, add-key,
3
+ * add-service, remove-service, get, show, list, meta, remove, and the webvh
4
+ * subcommand) and delegates each action to a `run*` function in the `did/`
5
+ * modules: create/add-key in `./did/create.js`, service edits in
6
+ * `./did/service.js`, read/manage operations in `./did/manage.js`, and the
7
+ * did:webvh update-key plumbing plus rotate-keys in `./did/webvh-update.js`.
9
8
  */
10
- export declare function parseDidLog(logText: string): DIDLog;
9
+ import { Command } from 'commander';
10
+ export { parseDidLog } from './did/webvh-update.js';
11
11
  export declare function makeDidCommand(): Command;
12
12
  //# sourceMappingURL=did.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"did.d.ts","sourceRoot":"","sources":["../../src/commands/did.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,OAAO,EAIL,KAAK,MAAM,EAEZ,MAAM,2BAA2B,CAAA;AA2FlC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnD;AA6qBD,wBAAgB,cAAc,IAAI,OAAO,CA41CxC"}
1
+ {"version":3,"file":"did.d.ts","sourceRoot":"","sources":["../../src/commands/did.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmBnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,wBAAgB,cAAc,IAAI,OAAO,CAwVxC"}