@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.
- package/CHANGELOG.md +58 -0
- package/dist/commands/collection-command.d.ts +169 -0
- package/dist/commands/collection-command.d.ts.map +1 -0
- package/dist/commands/collection-command.js +241 -0
- package/dist/commands/collection-command.js.map +1 -0
- package/dist/commands/did/create.d.ts +63 -0
- package/dist/commands/did/create.d.ts.map +1 -0
- package/dist/commands/did/create.js +625 -0
- package/dist/commands/did/create.js.map +1 -0
- package/dist/commands/did/manage.d.ts +68 -0
- package/dist/commands/did/manage.d.ts.map +1 -0
- package/dist/commands/did/manage.js +287 -0
- package/dist/commands/did/manage.js.map +1 -0
- package/dist/commands/did/service.d.ts +93 -0
- package/dist/commands/did/service.d.ts.map +1 -0
- package/dist/commands/did/service.js +324 -0
- package/dist/commands/did/service.js.map +1 -0
- package/dist/commands/did/webvh-update.d.ts +170 -0
- package/dist/commands/did/webvh-update.d.ts.map +1 -0
- package/dist/commands/did/webvh-update.js +402 -0
- package/dist/commands/did/webvh-update.js.map +1 -0
- package/dist/commands/did.d.ts +8 -8
- package/dist/commands/did.d.ts.map +1 -1
- package/dist/commands/did.js +27 -1519
- package/dist/commands/did.js.map +1 -1
- package/dist/commands/edv.d.ts +15 -6
- package/dist/commands/edv.d.ts.map +1 -1
- package/dist/commands/edv.js +38 -28
- package/dist/commands/edv.js.map +1 -1
- package/dist/commands/key.d.ts +104 -0
- package/dist/commands/key.d.ts.map +1 -1
- package/dist/commands/key.js +432 -402
- package/dist/commands/key.js.map +1 -1
- package/dist/commands/vc.d.ts +2 -1
- package/dist/commands/vc.d.ts.map +1 -1
- package/dist/commands/vc.js +88 -145
- package/dist/commands/vc.js.map +1 -1
- package/dist/commands/was/collection.d.ts.map +1 -1
- package/dist/commands/was/collection.js +31 -85
- package/dist/commands/was/collection.js.map +1 -1
- package/dist/commands/was/publish.d.ts.map +1 -1
- package/dist/commands/was/publish.js +16 -44
- package/dist/commands/was/publish.js.map +1 -1
- package/dist/commands/was/resource.d.ts.map +1 -1
- package/dist/commands/was/resource.js +24 -51
- package/dist/commands/was/resource.js.map +1 -1
- package/dist/commands/was/shared.d.ts +78 -0
- package/dist/commands/was/shared.d.ts.map +1 -1
- package/dist/commands/was/shared.js +84 -0
- package/dist/commands/was/shared.js.map +1 -1
- package/dist/commands/was/space.d.ts.map +1 -1
- package/dist/commands/was/space.js +10 -16
- package/dist/commands/was/space.js.map +1 -1
- package/dist/commands/was/tree.d.ts.map +1 -1
- package/dist/commands/was/tree.js +4 -6
- package/dist/commands/was/tree.js.map +1 -1
- package/dist/commands/was.d.ts.map +1 -1
- package/dist/commands/was.js +60 -74
- package/dist/commands/was.js.map +1 -1
- package/dist/commands/zcap.d.ts +0 -18
- package/dist/commands/zcap.d.ts.map +1 -1
- package/dist/commands/zcap.js +63 -155
- package/dist/commands/zcap.js.map +1 -1
- package/dist/documentLoader.d.ts +5 -0
- package/dist/documentLoader.d.ts.map +1 -0
- package/dist/documentLoader.js +29 -0
- package/dist/documentLoader.js.map +1 -0
- package/dist/edv/hmac.d.ts.map +1 -1
- package/dist/edv/hmac.js +12 -12
- package/dist/edv/hmac.js.map +1 -1
- package/dist/edv/recipients.d.ts +2 -0
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +12 -15
- package/dist/edv/recipients.js.map +1 -1
- package/dist/meta.d.ts +36 -11
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +95 -73
- package/dist/meta.js.map +1 -1
- package/dist/storage.d.ts +48 -13
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +40 -16
- package/dist/storage.js.map +1 -1
- package/dist/vc/issue.d.ts.map +1 -1
- package/dist/vc/issue.js +4 -7
- package/dist/vc/issue.js.map +1 -1
- package/dist/vc/verify.d.ts +10 -0
- package/dist/vc/verify.d.ts.map +1 -1
- package/dist/vc/verify.js +38 -1
- package/dist/vc/verify.js.map +1 -1
- package/dist/was/client.d.ts.map +1 -1
- package/dist/was/client.js +8 -2
- package/dist/was/client.js.map +1 -1
- package/dist/was/grant.d.ts +44 -0
- package/dist/was/grant.d.ts.map +1 -0
- package/dist/was/grant.js +78 -0
- package/dist/was/grant.js.map +1 -0
- package/dist/was/registry.d.ts.map +1 -1
- package/dist/was/registry.js +9 -2
- package/dist/was/registry.js.map +1 -1
- package/dist/zcap/delegate.d.ts.map +1 -1
- package/dist/zcap/delegate.js +1 -6
- package/dist/zcap/delegate.js.map +1 -1
- package/dist/zcap/signer.d.ts.map +1 -1
- package/dist/zcap/signer.js.map +1 -1
- package/package.json +5 -4
- package/dist/keys/webvh-driver.d.ts +0 -24
- package/dist/keys/webvh-driver.d.ts.map +0 -1
- package/dist/keys/webvh-driver.js +0 -73
- package/dist/keys/webvh-driver.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a DID to its DID document, or a DID URL to its verification method,
|
|
3
|
+
* via the security document loader, and print the result.
|
|
4
|
+
*
|
|
5
|
+
* @param options {object}
|
|
6
|
+
* @param options.didOrKeyId {string} The DID or DID URL to resolve.
|
|
7
|
+
* @returns {Promise<number>} The process exit code.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runGet(options: {
|
|
10
|
+
didOrKeyId: string;
|
|
11
|
+
}): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
* Show a locally stored DID document (no secret key material), or its metadata
|
|
14
|
+
* with `--meta`, by DID or handle. For did:webvh the document is resolved from
|
|
15
|
+
* its history log rather than the stored snapshot.
|
|
16
|
+
*
|
|
17
|
+
* @param options {object}
|
|
18
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
19
|
+
* @param [options.meta] {boolean} Show the metadata instead of the document.
|
|
20
|
+
* @param [options.json] {boolean} With --meta, output the metadata as JSON.
|
|
21
|
+
* @returns {Promise<number>} The process exit code.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runShow(options: {
|
|
24
|
+
didRef: string;
|
|
25
|
+
meta?: boolean;
|
|
26
|
+
json?: boolean;
|
|
27
|
+
}): Promise<number>;
|
|
28
|
+
/**
|
|
29
|
+
* List locally stored DIDs with their metadata: one DID per line with
|
|
30
|
+
* `--plain`, a JSON array with `--json`, otherwise a column-aligned table.
|
|
31
|
+
*
|
|
32
|
+
* @param options {object}
|
|
33
|
+
* @param [options.json] {boolean} Output a JSON array of objects.
|
|
34
|
+
* @param [options.plain] {boolean} Output one DID per line, sorted.
|
|
35
|
+
* @returns {Promise<number>} The process exit code.
|
|
36
|
+
*/
|
|
37
|
+
export declare function runList(options: {
|
|
38
|
+
json?: boolean;
|
|
39
|
+
plain?: boolean;
|
|
40
|
+
}): Promise<number>;
|
|
41
|
+
/**
|
|
42
|
+
* Show or edit the metadata of a locally stored DID (by DID or handle). With no
|
|
43
|
+
* edits, prints the current metadata; otherwise applies the handle/description
|
|
44
|
+
* changes and saves the sidecar.
|
|
45
|
+
*
|
|
46
|
+
* @param options {object}
|
|
47
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
48
|
+
* @param [options.handle] {string} Set the handle (empty string clears it).
|
|
49
|
+
* @param [options.description] {string} Set the description (empty clears it).
|
|
50
|
+
* @returns {Promise<number>} The process exit code.
|
|
51
|
+
*/
|
|
52
|
+
export declare function runMeta(options: {
|
|
53
|
+
didRef: string;
|
|
54
|
+
handle?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}): Promise<number>;
|
|
57
|
+
/**
|
|
58
|
+
* Remove a locally stored DID document, its keys file, and its metadata
|
|
59
|
+
* sidecar (by DID or handle), scrubbing the cached key-to-DID associations.
|
|
60
|
+
*
|
|
61
|
+
* @param options {object}
|
|
62
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
63
|
+
* @returns {Promise<number>} The process exit code.
|
|
64
|
+
*/
|
|
65
|
+
export declare function runRemove(options: {
|
|
66
|
+
didRef: string;
|
|
67
|
+
}): Promise<number>;
|
|
68
|
+
//# sourceMappingURL=manage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manage.d.ts","sourceRoot":"","sources":["../../../src/commands/did/manage.ts"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAe7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAiHlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE;IACrC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuClB;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC5E"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { listDids, loadDidDocument, loadDidMeta, methodOf, removeDidFiles, saveDidMeta } from '../../storage.js';
|
|
2
|
+
import { removeKeyDidAssociation, resolveDidRef } from '../../meta.js';
|
|
3
|
+
import { renderTable } from '../../table.js';
|
|
4
|
+
import { documentLoader } from '../../documentLoader.js';
|
|
5
|
+
import { applyMetaEdits } from '../collection-command.js';
|
|
6
|
+
import { resolveStoredWebvh } from './webvh-update.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a DID to its DID document, or a DID URL to its verification method,
|
|
9
|
+
* via the security document loader, and print the result.
|
|
10
|
+
*
|
|
11
|
+
* @param options {object}
|
|
12
|
+
* @param options.didOrKeyId {string} The DID or DID URL to resolve.
|
|
13
|
+
* @returns {Promise<number>} The process exit code.
|
|
14
|
+
*/
|
|
15
|
+
export async function runGet(options) {
|
|
16
|
+
const { didOrKeyId } = options;
|
|
17
|
+
let document;
|
|
18
|
+
try {
|
|
19
|
+
;
|
|
20
|
+
({ document } = (await documentLoader(didOrKeyId)));
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.error(`Could not resolve "${didOrKeyId}": ${err.message}`);
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
console.log(JSON.stringify(document, null, 2));
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Show a locally stored DID document (no secret key material), or its metadata
|
|
31
|
+
* with `--meta`, by DID or handle. For did:webvh the document is resolved from
|
|
32
|
+
* its history log rather than the stored snapshot.
|
|
33
|
+
*
|
|
34
|
+
* @param options {object}
|
|
35
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
36
|
+
* @param [options.meta] {boolean} Show the metadata instead of the document.
|
|
37
|
+
* @param [options.json] {boolean} With --meta, output the metadata as JSON.
|
|
38
|
+
* @returns {Promise<number>} The process exit code.
|
|
39
|
+
*/
|
|
40
|
+
export async function runShow(options) {
|
|
41
|
+
const { didRef } = options;
|
|
42
|
+
let did;
|
|
43
|
+
try {
|
|
44
|
+
did = await resolveDidRef({ ref: didRef });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.error(err.message);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
const targetDid = did ?? didRef;
|
|
51
|
+
// For did:webvh the history log is the source of truth, so resolve the
|
|
52
|
+
// current document (and its accumulated parameters) from it rather than
|
|
53
|
+
// trusting the stored snapshot. A DID with no stored log falls through
|
|
54
|
+
// to the stored document below.
|
|
55
|
+
let webvhMeta;
|
|
56
|
+
let resolvedDoc;
|
|
57
|
+
if (targetDid.startsWith('did:webvh:')) {
|
|
58
|
+
let resolved;
|
|
59
|
+
try {
|
|
60
|
+
resolved = await resolveStoredWebvh(targetDid);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
console.error(`Could not resolve the DID log for ${targetDid}: ` +
|
|
64
|
+
err.message);
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
if (resolved) {
|
|
68
|
+
resolvedDoc = resolved.doc;
|
|
69
|
+
webvhMeta = resolved.meta;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let didDocument;
|
|
73
|
+
if (resolvedDoc) {
|
|
74
|
+
didDocument = resolvedDoc;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
try {
|
|
78
|
+
didDocument = await loadDidDocument(targetDid);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
console.error(`No locally stored DID found for ${didRef}`);
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (options.meta) {
|
|
86
|
+
const docDid = didDocument.id;
|
|
87
|
+
const meta = await loadDidMeta({ did: docDid });
|
|
88
|
+
const keyCount = Array.isArray(didDocument.verificationMethod)
|
|
89
|
+
? didDocument.verificationMethod.length
|
|
90
|
+
: 0;
|
|
91
|
+
// Parameters resolved from the did:webvh log (absent for other
|
|
92
|
+
// methods, and for a webvh DID with no stored log).
|
|
93
|
+
const witnessCount = webvhMeta?.witness?.witnesses?.length ?? 0;
|
|
94
|
+
const watcherCount = webvhMeta?.watchers?.length ?? 0;
|
|
95
|
+
if (options.json) {
|
|
96
|
+
const output = {
|
|
97
|
+
did: docDid,
|
|
98
|
+
method: methodOf(docDid),
|
|
99
|
+
...(meta?.created && { created: meta.created }),
|
|
100
|
+
...(meta?.handle && { handle: meta.handle }),
|
|
101
|
+
...(meta?.description && { description: meta.description }),
|
|
102
|
+
keys: keyCount,
|
|
103
|
+
...(webvhMeta && {
|
|
104
|
+
versionId: webvhMeta.versionId,
|
|
105
|
+
updated: webvhMeta.updated,
|
|
106
|
+
portable: webvhMeta.portable,
|
|
107
|
+
prerotation: webvhMeta.prerotation,
|
|
108
|
+
deactivated: webvhMeta.deactivated,
|
|
109
|
+
updateKeys: webvhMeta.updateKeys.length,
|
|
110
|
+
witnesses: witnessCount,
|
|
111
|
+
watchers: watcherCount
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
console.log(JSON.stringify(output, null, 2));
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
const rows = [
|
|
118
|
+
['DID', docDid],
|
|
119
|
+
['Method', methodOf(docDid)],
|
|
120
|
+
['Handle', meta?.handle ?? ''],
|
|
121
|
+
['Created', meta?.created ?? ''],
|
|
122
|
+
['Description', meta?.description ?? ''],
|
|
123
|
+
['Keys', String(keyCount)]
|
|
124
|
+
];
|
|
125
|
+
if (webvhMeta) {
|
|
126
|
+
rows.push(['Version', webvhMeta.versionId], ['Updated', webvhMeta.updated], ['Portable', webvhMeta.portable ? 'yes' : 'no'], ['Prerotation', webvhMeta.prerotation ? 'yes' : 'no'], ['Deactivated', webvhMeta.deactivated ? 'yes' : 'no'], ['Update keys', String(webvhMeta.updateKeys.length)], ['Witnesses', String(witnessCount)], ['Watchers', String(watcherCount)]);
|
|
127
|
+
}
|
|
128
|
+
console.log(renderTable({
|
|
129
|
+
columns: [{ header: 'FIELD' }, { header: 'VALUE' }],
|
|
130
|
+
rows
|
|
131
|
+
}));
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
// The DID document holds no secret material -- signing keys live in the
|
|
135
|
+
// separate `<did>.keys.json` file -- so it is safe to print as-is.
|
|
136
|
+
console.log(JSON.stringify(didDocument, null, 2));
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* List locally stored DIDs with their metadata: one DID per line with
|
|
141
|
+
* `--plain`, a JSON array with `--json`, otherwise a column-aligned table.
|
|
142
|
+
*
|
|
143
|
+
* @param options {object}
|
|
144
|
+
* @param [options.json] {boolean} Output a JSON array of objects.
|
|
145
|
+
* @param [options.plain] {boolean} Output one DID per line, sorted.
|
|
146
|
+
* @returns {Promise<number>} The process exit code.
|
|
147
|
+
*/
|
|
148
|
+
export async function runList(options) {
|
|
149
|
+
const dids = await listDids();
|
|
150
|
+
if (options.plain) {
|
|
151
|
+
for (const did of dids) {
|
|
152
|
+
console.log(did);
|
|
153
|
+
}
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
const entries = [];
|
|
157
|
+
for (const did of dids) {
|
|
158
|
+
const meta = await loadDidMeta({ did });
|
|
159
|
+
entries.push({ did, method: methodOf(did), ...meta });
|
|
160
|
+
}
|
|
161
|
+
if (options.json) {
|
|
162
|
+
const output = entries.map(entry => ({
|
|
163
|
+
did: entry.did,
|
|
164
|
+
method: entry.method,
|
|
165
|
+
...(entry.created && { created: entry.created }),
|
|
166
|
+
...(entry.handle && { handle: entry.handle }),
|
|
167
|
+
...(entry.description && { description: entry.description })
|
|
168
|
+
}));
|
|
169
|
+
console.log(JSON.stringify(output, null, 2));
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
if (entries.length === 0) {
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
const rows = entries.map(entry => [
|
|
176
|
+
entry.handle ?? '',
|
|
177
|
+
entry.method,
|
|
178
|
+
entry.created?.slice(0, 10) ?? '',
|
|
179
|
+
entry.did,
|
|
180
|
+
entry.description ?? ''
|
|
181
|
+
]);
|
|
182
|
+
console.log(renderTable({
|
|
183
|
+
columns: [
|
|
184
|
+
{ header: 'HANDLE', maxWidth: 16 },
|
|
185
|
+
{ header: 'METHOD' },
|
|
186
|
+
{ header: 'CREATED' },
|
|
187
|
+
{ header: 'DID', maxWidth: 44 },
|
|
188
|
+
{ header: 'DESCRIPTION', maxWidth: 40 }
|
|
189
|
+
],
|
|
190
|
+
rows
|
|
191
|
+
}));
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Show or edit the metadata of a locally stored DID (by DID or handle). With no
|
|
196
|
+
* edits, prints the current metadata; otherwise applies the handle/description
|
|
197
|
+
* changes and saves the sidecar.
|
|
198
|
+
*
|
|
199
|
+
* @param options {object}
|
|
200
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
201
|
+
* @param [options.handle] {string} Set the handle (empty string clears it).
|
|
202
|
+
* @param [options.description] {string} Set the description (empty clears it).
|
|
203
|
+
* @returns {Promise<number>} The process exit code.
|
|
204
|
+
*/
|
|
205
|
+
export async function runMeta(options) {
|
|
206
|
+
const { didRef } = options;
|
|
207
|
+
let did;
|
|
208
|
+
try {
|
|
209
|
+
did = await resolveDidRef({ ref: didRef });
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
console.error(err.message);
|
|
213
|
+
return 1;
|
|
214
|
+
}
|
|
215
|
+
if (did) {
|
|
216
|
+
// Refuse to create metadata for DIDs that are not saved locally.
|
|
217
|
+
try {
|
|
218
|
+
await loadDidDocument(did);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
did = undefined;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!did) {
|
|
225
|
+
console.error(`No locally stored DID found for ${didRef}`);
|
|
226
|
+
return 1;
|
|
227
|
+
}
|
|
228
|
+
const existing = await loadDidMeta({ did });
|
|
229
|
+
const hasEdits = options.handle !== undefined || options.description !== undefined;
|
|
230
|
+
if (!hasEdits) {
|
|
231
|
+
console.log(JSON.stringify(existing ?? {}, null, 2));
|
|
232
|
+
return 0;
|
|
233
|
+
}
|
|
234
|
+
const meta = { ...(existing ?? {}) };
|
|
235
|
+
applyMetaEdits(meta, {
|
|
236
|
+
handle: options.handle,
|
|
237
|
+
description: options.description
|
|
238
|
+
});
|
|
239
|
+
const filePath = await saveDidMeta({ did, meta });
|
|
240
|
+
console.error(`Metadata saved to ${filePath}`);
|
|
241
|
+
console.log(JSON.stringify(meta, null, 2));
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Remove a locally stored DID document, its keys file, and its metadata
|
|
246
|
+
* sidecar (by DID or handle), scrubbing the cached key-to-DID associations.
|
|
247
|
+
*
|
|
248
|
+
* @param options {object}
|
|
249
|
+
* @param options.didRef {string} The DID or metadata handle.
|
|
250
|
+
* @returns {Promise<number>} The process exit code.
|
|
251
|
+
*/
|
|
252
|
+
export async function runRemove(options) {
|
|
253
|
+
const { didRef } = options;
|
|
254
|
+
let did;
|
|
255
|
+
try {
|
|
256
|
+
did = await resolveDidRef({ ref: didRef });
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
console.error(err.message);
|
|
260
|
+
return 1;
|
|
261
|
+
}
|
|
262
|
+
let didDocument;
|
|
263
|
+
try {
|
|
264
|
+
didDocument = await loadDidDocument(did ?? didRef);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
console.error(`No locally stored DID found for ${didRef}`);
|
|
268
|
+
return 1;
|
|
269
|
+
}
|
|
270
|
+
const docDid = did ?? didRef;
|
|
271
|
+
// Scrub the cached key-to-DID associations of any matching wallet keys
|
|
272
|
+
// before the DID document (the source of truth) is deleted.
|
|
273
|
+
for (const method of didDocument.verificationMethod ?? []) {
|
|
274
|
+
if (method.publicKeyMultibase) {
|
|
275
|
+
await removeKeyDidAssociation({
|
|
276
|
+
publicKeyMultibase: method.publicKeyMultibase,
|
|
277
|
+
did: docDid
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const removed = await removeDidFiles({ did: docDid });
|
|
282
|
+
for (const filePath of removed) {
|
|
283
|
+
console.error(`Removed ${filePath}`);
|
|
284
|
+
}
|
|
285
|
+
return 0;
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=manage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manage.js","sourceRoot":"","sources":["../../../src/commands/did/manage.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,WAAW,EAEZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA+B;IAC1D,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;IAC9B,IAAI,QAAiC,CAAA;IACrC,IAAI,CAAC;QACH,CAAC;QAAA,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,CAEjD,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,sBAAsB,UAAU,MAAO,GAAa,CAAC,OAAO,EAAE,CAC/D,CAAA;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9C,OAAO,CAAC,CAAA;AACV,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAI7B;IACC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAC1B,IAAI,GAAuB,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QAAQ,EAAE,CAAC,CAAA;IACtC,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service-entry management for did:web and did:webvh DIDs. Builds and edits the
|
|
3
|
+
* `service` array (add/remove by id, with id normalization) and routes a
|
|
4
|
+
* service-array transform to the right per-method runner: did:web is a direct
|
|
5
|
+
* document edit, did:webvh appends a sparse log entry (advancing the
|
|
6
|
+
* pre-rotation ratchet when one is armed). The webvh log machinery is reused
|
|
7
|
+
* from `./webvh-update.js`.
|
|
8
|
+
*/
|
|
9
|
+
import { type ServiceEndpoint } from '@interop/did-method-webvh';
|
|
10
|
+
/**
|
|
11
|
+
* Expand a service id to a full DID URL. A bare fragment (`files`) or a
|
|
12
|
+
* leading-`#` fragment (`#files`) is resolved against the DID; a value that is
|
|
13
|
+
* already a full DID URL, or any absolute URI carrying a fragment, is returned
|
|
14
|
+
* unchanged.
|
|
15
|
+
*
|
|
16
|
+
* @param options {object}
|
|
17
|
+
* @param options.did {string}
|
|
18
|
+
* @param options.id {string}
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeServiceId({ did, id }: {
|
|
22
|
+
did: string;
|
|
23
|
+
id: string;
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* Build a service-endpoint entry from add-service options. Exactly one of
|
|
27
|
+
* `endpoint` (one or more endpoint values -- a single value stays a string,
|
|
28
|
+
* several become an array) or `endpointJson` (a raw JSON value) supplies the
|
|
29
|
+
* serviceEndpoint; a single `type` likewise stays a string.
|
|
30
|
+
*
|
|
31
|
+
* @param options {object}
|
|
32
|
+
* @param options.did {string}
|
|
33
|
+
* @param options.id {string}
|
|
34
|
+
* @param options.type {string[]}
|
|
35
|
+
* @param [options.endpoint] {string[]}
|
|
36
|
+
* @param [options.endpointJson] {string}
|
|
37
|
+
* @returns {ServiceEndpoint}
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildServiceEntry({ did, id, type, endpoint, endpointJson }: {
|
|
40
|
+
did: string;
|
|
41
|
+
id: string;
|
|
42
|
+
type: string[];
|
|
43
|
+
endpoint?: string[];
|
|
44
|
+
endpointJson?: string;
|
|
45
|
+
}): ServiceEndpoint;
|
|
46
|
+
/**
|
|
47
|
+
* Append a service entry to the current array, rejecting a duplicate id.
|
|
48
|
+
*
|
|
49
|
+
* @param options {object}
|
|
50
|
+
* @param options.current {ServiceEndpoint[]}
|
|
51
|
+
* @param options.entry {ServiceEndpoint} its `id` is already normalized.
|
|
52
|
+
* @param options.did {string}
|
|
53
|
+
* @returns {ServiceEndpoint[]}
|
|
54
|
+
*/
|
|
55
|
+
export declare function addServiceEntry({ current, entry, did }: {
|
|
56
|
+
current: ServiceEndpoint[];
|
|
57
|
+
entry: ServiceEndpoint;
|
|
58
|
+
did: string;
|
|
59
|
+
}): ServiceEndpoint[];
|
|
60
|
+
/**
|
|
61
|
+
* Remove the service entry with the given (normalized) id, rejecting a missing
|
|
62
|
+
* id.
|
|
63
|
+
*
|
|
64
|
+
* @param options {object}
|
|
65
|
+
* @param options.current {ServiceEndpoint[]}
|
|
66
|
+
* @param options.id {string} the normalized id to remove.
|
|
67
|
+
* @param options.did {string}
|
|
68
|
+
* @returns {ServiceEndpoint[]}
|
|
69
|
+
*/
|
|
70
|
+
export declare function removeServiceEntry({ current, id, did }: {
|
|
71
|
+
current: ServiceEndpoint[];
|
|
72
|
+
id: string;
|
|
73
|
+
did: string;
|
|
74
|
+
}): ServiceEndpoint[];
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a DID reference, then route a service-array transform to the right
|
|
77
|
+
* per-method runner and return its exit code. did:web is a direct document
|
|
78
|
+
* edit; did:webvh appends a log entry.
|
|
79
|
+
*
|
|
80
|
+
* @param options {object}
|
|
81
|
+
* @param options.ref {string} a DID or a local metadata handle.
|
|
82
|
+
* @param options.transform {(current: ServiceEndpoint[], did: string) => ServiceEndpoint[]}
|
|
83
|
+
* @param [options.yes] {boolean} skip the did:webvh confirmation prompt.
|
|
84
|
+
* @param [options.keepOldKey] {boolean} did:webvh pre-rotation path only.
|
|
85
|
+
* @returns {Promise<number>} the process exit code
|
|
86
|
+
*/
|
|
87
|
+
export declare function dispatchServiceUpdate({ ref, transform, yes, keepOldKey }: {
|
|
88
|
+
ref: string;
|
|
89
|
+
transform: (current: ServiceEndpoint[], did: string) => ServiceEndpoint[];
|
|
90
|
+
yes?: boolean;
|
|
91
|
+
keepOldKey?: boolean;
|
|
92
|
+
}): Promise<number>;
|
|
93
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/commands/did/service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAqBlC;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,EAAE,EACH,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,MAAM,CAAA;CACX,GAAG,MAAM,CAQT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,YAAY,EACb,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,eAAe,CAsBlB;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,KAAK,EACL,GAAG,EACJ,EAAE;IACD,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,KAAK,EAAE,eAAe,CAAA;IACtB,GAAG,EAAE,MAAM,CAAA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