@interop/did-cli 0.9.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 +149 -0
- package/README.md +192 -4
- 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 +9 -0
- package/dist/commands/did.d.ts.map +1 -1
- package/dist/commands/did.js +107 -597
- 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 +17 -0
- package/dist/commands/was/space.d.ts.map +1 -1
- package/dist/commands/was/space.js +47 -18
- 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 +1 -1
- package/dist/commands/was.d.ts.map +1 -1
- package/dist/commands/was.js +71 -76
- 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/keys/webvh-signer.d.ts +29 -0
- package/dist/keys/webvh-signer.d.ts.map +1 -0
- package/dist/keys/webvh-signer.js +44 -0
- package/dist/keys/webvh-signer.js.map +1 -0
- package/dist/keys/webvh-update.d.ts +33 -0
- package/dist/keys/webvh-update.d.ts.map +1 -0
- package/dist/keys/webvh-update.js +62 -0
- package/dist/keys/webvh-update.js.map +1 -0
- 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 +122 -13
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +105 -13
- 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 +2 -1
- package/dist/was/registry.d.ts.map +1 -1
- package/dist/was/registry.js +25 -7
- 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 +8 -6
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for the wallet "collection" command families (`vc`, `key`,
|
|
3
|
+
* and `zcap`), whose `list` / `show` / `meta` / `remove` subcommands and
|
|
4
|
+
* metadata handling are otherwise near-identical clones. Each command file
|
|
5
|
+
* declares its collection name and supplies the per-collection projection
|
|
6
|
+
* (how to load an item, turn it into a table row / JSON object, and resolve a
|
|
7
|
+
* reference); the control flow -- plain/json/empty/table listing, the
|
|
8
|
+
* set-or-clear metadata edits, and the resolve-then-validate preamble -- lives
|
|
9
|
+
* here once.
|
|
10
|
+
*/
|
|
11
|
+
import { listCollection, loadFromCollection, loadMetaFromCollection, removeFromCollection, saveMetaToCollection } from '../storage.js';
|
|
12
|
+
import { renderTable } from '../table.js';
|
|
13
|
+
/**
|
|
14
|
+
* Guards the `--handle` / `--description` metadata flags against being given
|
|
15
|
+
* without `--save`. Prints the standard message to stderr and returns false
|
|
16
|
+
* when the combination is invalid; the caller chooses the exit code.
|
|
17
|
+
*
|
|
18
|
+
* @param options {object}
|
|
19
|
+
* @param [options.save] {boolean}
|
|
20
|
+
* @param [options.handle] {string}
|
|
21
|
+
* @param [options.description] {string}
|
|
22
|
+
* @returns {boolean} true when the flags are valid.
|
|
23
|
+
*/
|
|
24
|
+
export function requireSaveForMetaFlags({ save, handle, description }) {
|
|
25
|
+
if ((handle !== undefined || description !== undefined) && !save) {
|
|
26
|
+
console.error('--handle and --description require --save');
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Apply the `--handle` / `--description` set-or-clear edits to a metadata
|
|
33
|
+
* object in place: a defined non-empty value sets the field, an empty string
|
|
34
|
+
* clears it, and an undefined value leaves it untouched.
|
|
35
|
+
*
|
|
36
|
+
* @param meta {ItemMetadata} The metadata object to mutate.
|
|
37
|
+
* @param edits {object}
|
|
38
|
+
* @param [edits.handle] {string}
|
|
39
|
+
* @param [edits.description] {string}
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
export function applyMetaEdits(meta, { handle, description }) {
|
|
43
|
+
if (handle !== undefined) {
|
|
44
|
+
if (handle === '') {
|
|
45
|
+
delete meta.handle;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
meta.handle = handle;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (description !== undefined) {
|
|
52
|
+
if (description === '') {
|
|
53
|
+
delete meta.description;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
meta.description = description;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Write the `.meta.json` metadata sidecar of a freshly saved wallet item: the
|
|
62
|
+
* creation timestamp plus the handle and description when given. When
|
|
63
|
+
* `mergeExisting` is set, any existing sidecar is loaded first and its fields
|
|
64
|
+
* take precedence over `created` (so re-saving an already-stored item keeps
|
|
65
|
+
* its original timestamp) -- used by `vc import` / `vc issue --save`, which may
|
|
66
|
+
* re-store a credential that is already in the wallet.
|
|
67
|
+
*
|
|
68
|
+
* @param options {object}
|
|
69
|
+
* @param options.collection {string}
|
|
70
|
+
* @param options.storageId {string}
|
|
71
|
+
* @param options.created {string}
|
|
72
|
+
* @param [options.handle] {string}
|
|
73
|
+
* @param [options.description] {string}
|
|
74
|
+
* @param [options.mergeExisting] {boolean}
|
|
75
|
+
* @returns {Promise<void>}
|
|
76
|
+
*/
|
|
77
|
+
export async function writeCreateMeta({ collection, storageId, created, handle, description, mergeExisting }) {
|
|
78
|
+
const existing = mergeExisting
|
|
79
|
+
? await loadMetaFromCollection({ collection, storageId })
|
|
80
|
+
: undefined;
|
|
81
|
+
const meta = { created, ...existing };
|
|
82
|
+
if (handle) {
|
|
83
|
+
meta.handle = handle;
|
|
84
|
+
}
|
|
85
|
+
if (description) {
|
|
86
|
+
meta.description = description;
|
|
87
|
+
}
|
|
88
|
+
await saveMetaToCollection({ collection, storageId, meta });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Resolve a wallet item reference, reporting failures to stderr and returning
|
|
92
|
+
* undefined: prints the thrown error message on an ambiguous handle, or the
|
|
93
|
+
* standard "No locally stored <noun> found for <ref>" message when nothing
|
|
94
|
+
* matches. Collapses the resolve-then-validate preamble shared by the
|
|
95
|
+
* `show` / `meta` / `remove` subcommands; callers do `if (!resolved) return 1`.
|
|
96
|
+
*
|
|
97
|
+
* @param options {object}
|
|
98
|
+
* @param options.resolve {(ref: string) => Promise<T | undefined>}
|
|
99
|
+
* @param options.ref {string}
|
|
100
|
+
* @param options.noun {string} The item noun for the not-found message.
|
|
101
|
+
* @returns {Promise<T | undefined>}
|
|
102
|
+
*/
|
|
103
|
+
export async function resolveRefOrReport({ resolve, ref, noun }) {
|
|
104
|
+
let resolved;
|
|
105
|
+
try {
|
|
106
|
+
resolved = await resolve(ref);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
console.error(err.message);
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
if (!resolved) {
|
|
113
|
+
console.error(`No locally stored ${noun} found for ${ref}`);
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return resolved;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Render a wallet collection listing: one id per line with `plain`, a JSON
|
|
120
|
+
* array with `json`, an empty result as no output, otherwise a column-aligned
|
|
121
|
+
* table. Shared by `vc list`, `key list`, and `zcap list`; each caller
|
|
122
|
+
* supplies how to load an item, project it to a row / JSON object, and the
|
|
123
|
+
* table columns. A `toEntry` returning undefined drops the item from the
|
|
124
|
+
* non-plain output (e.g. an id-less zcap).
|
|
125
|
+
*
|
|
126
|
+
* @param options {object}
|
|
127
|
+
* @param options.collection {string}
|
|
128
|
+
* @param [options.plain] {boolean}
|
|
129
|
+
* @param [options.json] {boolean}
|
|
130
|
+
* @param options.plainId {(item: Item, storageId: string) => string | undefined}
|
|
131
|
+
* The id to print in `--plain` mode; undefined skips the item.
|
|
132
|
+
* @param options.toEntry {(args: {storageId: string, item: Item, meta?: KeyMetadata}) => Entry | undefined | Promise<Entry | undefined>}
|
|
133
|
+
* @param options.toJson {(entry: Entry) => object}
|
|
134
|
+
* @param options.columns {Column[]}
|
|
135
|
+
* @param options.toRow {(entry: Entry) => string[]}
|
|
136
|
+
* @returns {Promise<number>} The process exit code.
|
|
137
|
+
*/
|
|
138
|
+
export async function runListCollection({ collection, plain, json, plainId, toEntry, toJson, columns, toRow }) {
|
|
139
|
+
const storageIds = await listCollection(collection);
|
|
140
|
+
if (plain) {
|
|
141
|
+
const ids = [];
|
|
142
|
+
for (const storageId of storageIds) {
|
|
143
|
+
const item = await loadFromCollection({ collection, storageId });
|
|
144
|
+
const id = plainId(item, storageId);
|
|
145
|
+
if (id !== undefined) {
|
|
146
|
+
ids.push(id);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
ids.sort();
|
|
150
|
+
for (const id of ids) {
|
|
151
|
+
console.log(id);
|
|
152
|
+
}
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
const entries = [];
|
|
156
|
+
for (const storageId of storageIds) {
|
|
157
|
+
const item = await loadFromCollection({ collection, storageId });
|
|
158
|
+
const meta = await loadMetaFromCollection({
|
|
159
|
+
collection,
|
|
160
|
+
storageId
|
|
161
|
+
});
|
|
162
|
+
const entry = await toEntry({ storageId, item, meta });
|
|
163
|
+
if (entry !== undefined) {
|
|
164
|
+
entries.push(entry);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (json) {
|
|
168
|
+
console.log(JSON.stringify(entries.map(toJson), null, 2));
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
if (entries.length === 0) {
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
console.log(renderTable({ columns, rows: entries.map(toRow) }));
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Show or edit the metadata of a wallet item (by id or handle): with no
|
|
179
|
+
* `--handle` / `--description` edits, prints the current metadata; otherwise
|
|
180
|
+
* applies the set-or-clear edits, saves the sidecar, and prints the result.
|
|
181
|
+
* Shared by `vc meta` and `zcap meta`. (`key meta` keeps its own runner: it
|
|
182
|
+
* additionally backfills the created date and refreshes the cached DID
|
|
183
|
+
* associations.)
|
|
184
|
+
*
|
|
185
|
+
* @param options {object}
|
|
186
|
+
* @param options.collection {string}
|
|
187
|
+
* @param options.noun {string}
|
|
188
|
+
* @param options.resolve {(ref: string) => Promise<{storageId: string, meta?: ItemMetadata} | undefined>}
|
|
189
|
+
* @param options.ref {string}
|
|
190
|
+
* @param [options.handle] {string}
|
|
191
|
+
* @param [options.description] {string}
|
|
192
|
+
* @returns {Promise<number>} The process exit code.
|
|
193
|
+
*/
|
|
194
|
+
export async function runMetaCollection({ collection, noun, resolve, ref, handle, description }) {
|
|
195
|
+
const resolved = await resolveRefOrReport({ resolve, ref, noun });
|
|
196
|
+
if (!resolved) {
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
const hasEdits = handle !== undefined || description !== undefined;
|
|
200
|
+
if (!hasEdits) {
|
|
201
|
+
console.log(JSON.stringify(resolved.meta ?? {}, null, 2));
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
const meta = { ...(resolved.meta ?? {}) };
|
|
205
|
+
applyMetaEdits(meta, { handle, description });
|
|
206
|
+
const filePath = await saveMetaToCollection({
|
|
207
|
+
collection,
|
|
208
|
+
storageId: resolved.storageId,
|
|
209
|
+
meta
|
|
210
|
+
});
|
|
211
|
+
console.error(`Metadata saved to ${filePath}`);
|
|
212
|
+
console.log(JSON.stringify(meta, null, 2));
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve a wallet item by reference and remove it (and its metadata sidecar),
|
|
217
|
+
* printing each removed file path to stderr. Shared by `vc remove`,
|
|
218
|
+
* `key remove`, and `zcap remove`.
|
|
219
|
+
*
|
|
220
|
+
* @param options {object}
|
|
221
|
+
* @param options.collection {string}
|
|
222
|
+
* @param options.noun {string}
|
|
223
|
+
* @param options.resolve {(ref: string) => Promise<{storageId: string} | undefined>}
|
|
224
|
+
* @param options.ref {string}
|
|
225
|
+
* @returns {Promise<number>} The process exit code.
|
|
226
|
+
*/
|
|
227
|
+
export async function runRemoveCollection({ collection, noun, resolve, ref }) {
|
|
228
|
+
const resolved = await resolveRefOrReport({ resolve, ref, noun });
|
|
229
|
+
if (!resolved) {
|
|
230
|
+
return 1;
|
|
231
|
+
}
|
|
232
|
+
const removed = await removeFromCollection({
|
|
233
|
+
collection,
|
|
234
|
+
storageId: resolved.storageId
|
|
235
|
+
});
|
|
236
|
+
for (const filePath of removed) {
|
|
237
|
+
console.error(`Removed ${filePath}`);
|
|
238
|
+
}
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=collection-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-command.js","sourceRoot":"","sources":["../../src/commands/collection-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EAGrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,WAAW,EAAe,MAAM,aAAa,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,IAAI,EACJ,MAAM,EACN,WAAW,EAKZ;IACC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAC1D,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAkB,EAClB,EAAE,MAAM,EAAE,WAAW,EAA6C;IAElE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACtB,CAAC;IACH,CAAC;IACD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,WAAW,CAAA;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAChC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;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CAAA;IACF,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAA;IAC9C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1C,OAAO,CAAC,CAAA;AACV,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,UAAU,EACV,IAAI,EACJ,OAAO,EACP,GAAG,EAMJ;IACC,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;IACjE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,CAAA;IACV,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC;QACzC,UAAU;QACV,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC,CAAA;IACF,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,WAAW,QAAQ,EAAE,CAAC,CAAA;IACtC,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification relationships a newly created did:webvh document key is wired
|
|
3
|
+
* into -- everything but keyAgreement, which needs an X25519 key. Also the
|
|
4
|
+
* `add-key` default purpose set (described in its help text).
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_VERIFICATION_PURPOSES: readonly ["authentication", "assertionMethod", "capabilityDelegation", "capabilityInvocation"];
|
|
7
|
+
/**
|
|
8
|
+
* Create a new DID of the given method (key, web, or webvh), optionally saving
|
|
9
|
+
* its document, keys, and metadata to local storage, and print it to stdout.
|
|
10
|
+
*
|
|
11
|
+
* @param options {object}
|
|
12
|
+
* @param [options.method] {string} DID method: key (default), web, or webvh.
|
|
13
|
+
* @param options.type {string} Key type (ed25519 or ecdsa).
|
|
14
|
+
* @param options.curve {string} ECDSA curve, for --type ecdsa.
|
|
15
|
+
* @param [options.url] {string} HTTPS url (required for did:web/did:webvh).
|
|
16
|
+
* @param [options.prerotation] {boolean} Arm did:webvh key pre-rotation.
|
|
17
|
+
* @param [options.portable] {boolean} Create a portable did:webvh.
|
|
18
|
+
* @param [options.witness] {string[]} did:webvh witness did:key DIDs.
|
|
19
|
+
* @param [options.witnessThreshold] {string} Required witness approvals.
|
|
20
|
+
* @param [options.watcher] {string[]} did:webvh watcher URLs.
|
|
21
|
+
* @param [options.withSeed] {boolean} Include/derive the secret key seed.
|
|
22
|
+
* @param [options.save] {boolean} Save the DID to local storage.
|
|
23
|
+
* @param [options.handle] {string} Short tag stored in the metadata sidecar.
|
|
24
|
+
* @param [options.description] {string} Longer description for the sidecar.
|
|
25
|
+
* @returns {Promise<number>} The process exit code.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runCreate(options: {
|
|
28
|
+
method?: string;
|
|
29
|
+
type: string;
|
|
30
|
+
curve: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
prerotation?: boolean;
|
|
33
|
+
portable?: boolean;
|
|
34
|
+
witness?: string[];
|
|
35
|
+
witnessThreshold?: string;
|
|
36
|
+
watcher?: string[];
|
|
37
|
+
withSeed?: boolean;
|
|
38
|
+
save?: boolean;
|
|
39
|
+
handle?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
}): Promise<number>;
|
|
42
|
+
/**
|
|
43
|
+
* Add a verification key to an existing (locally stored) did:web document,
|
|
44
|
+
* re-save the document and keys file, and print the updated document.
|
|
45
|
+
*
|
|
46
|
+
* @param options {object}
|
|
47
|
+
* @param options.did {string} The did:web DID to add a key to.
|
|
48
|
+
* @param options.type {string} Key type: ed25519, ecdsa, or x25519.
|
|
49
|
+
* @param options.curve {string} ECDSA curve, for --type ecdsa.
|
|
50
|
+
* @param [options.purpose] {string[]} Verification relationship(s) to wire
|
|
51
|
+
* the key into.
|
|
52
|
+
* @param [options.withSeed] {boolean} Include/derive the secret key seed
|
|
53
|
+
* (ed25519 only).
|
|
54
|
+
* @returns {Promise<number>} The process exit code.
|
|
55
|
+
*/
|
|
56
|
+
export declare function runAddKey(options: {
|
|
57
|
+
did: string;
|
|
58
|
+
type: string;
|
|
59
|
+
curve: string;
|
|
60
|
+
purpose?: string[];
|
|
61
|
+
withSeed?: boolean;
|
|
62
|
+
}): Promise<number>;
|
|
63
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/did/create.ts"],"names":[],"mappings":"AAsCA;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,gGAKhC,CAAA;AAuJV;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6XlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIlB"}
|