@interop/wallet-core 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clientAnnex/establish.d.ts +67 -4
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +145 -124
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +2 -6
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +26 -55
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +23 -20
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +63 -72
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +9 -0
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +27 -9
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +70 -81
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +3 -3
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +3 -3
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +27 -8
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +83 -18
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +119 -15
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +19 -61
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/keys/index.d.ts +13 -3
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +12 -2
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +3 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +6 -3
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +8 -5
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +7 -6
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +38 -1
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +56 -18
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts +110 -10
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +180 -40
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/recovery/index.d.ts +1 -1
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +1 -1
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +23 -0
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +45 -12
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/request/appKey.d.ts +35 -1
- package/dist/request/appKey.d.ts.map +1 -1
- package/dist/request/appKey.js +29 -10
- package/dist/request/appKey.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { webvhResourceLogController } from '../resourceLog/index.js';
|
|
2
2
|
import { cascadeCollectionsToUserKey } from './userKeyCascade.js';
|
|
3
3
|
import { isSealableDescriptorStore } from './rosterLogStore.js';
|
|
4
|
-
import { convergeUserKeyRosterToDocument, readUserKeyRoster } from './userKeyRoster.js';
|
|
4
|
+
import { convergeUserKeyRosterToDocument, readUserKeyRoster, rosterWrapsRecipient, rotateUserKeyRoster } from './userKeyRoster.js';
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the collection ids the fan-out covers, whether they are a fixed set
|
|
7
7
|
* or a listing the app performs.
|
|
@@ -16,6 +16,94 @@ async function collectionIdsOf({ collections }) {
|
|
|
16
16
|
? await collectionIds()
|
|
17
17
|
: collectionIds;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The post-edit anchoring guarantee, shared by both entry points: the roster
|
|
21
|
+
* appends -- and the seal backstop's removal detection -- must run under a
|
|
22
|
+
* controller view that includes the log the ceremony is anchoring at, or the
|
|
23
|
+
* rotation anchors before it (a revocation's rotation leaves the log
|
|
24
|
+
* unsealed with the seal blind to the removal; the last-client transition's
|
|
25
|
+
* ladder-signed rotation lands before its reinstall version and the
|
|
26
|
+
* ceremony-tail license refuses it). Rather than leaving that to the
|
|
27
|
+
* injected store's own controller wiring, the view built from the ceremony's
|
|
28
|
+
* log is set as the store's minimum controller version; a fresher resolved
|
|
29
|
+
* view still wins. A store that is not log-governed has no controller view
|
|
30
|
+
* to anchor and is left alone. Exported for the one caller that reads the
|
|
31
|
+
* roster before its anchoring entry exists (the last-client transition's
|
|
32
|
+
* pre-pair probe, anchored at the pre-transition head it verified).
|
|
33
|
+
*
|
|
34
|
+
* @param options {object}
|
|
35
|
+
* @param options.rosterStore {EncryptionDescriptorStore}
|
|
36
|
+
* @param options.did {string}
|
|
37
|
+
* @param options.log {DIDLog}
|
|
38
|
+
*/
|
|
39
|
+
export function anchorRosterStoreAt({ rosterStore, did, log }) {
|
|
40
|
+
if (isSealableDescriptorStore(rosterStore)) {
|
|
41
|
+
rosterStore.setMinimumControllerVersion({
|
|
42
|
+
controller: webvhResourceLogController({ did, log })
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The adopting read after a rotation: the roster read on the threaded
|
|
48
|
+
* descriptor (the continuity and possession checks still run on it), then
|
|
49
|
+
* the caller's `onUserKeyAdopted` when the key rotated on this run.
|
|
50
|
+
*
|
|
51
|
+
* @param options {object}
|
|
52
|
+
* @param options.rosterStore {EncryptionDescriptorStore}
|
|
53
|
+
* @param options.descriptor {CollectionEncryption} the rotation's own
|
|
54
|
+
* verified result, so one run acquires the roster once for both halves
|
|
55
|
+
* @param [options.userKey] {UserKey}
|
|
56
|
+
* @param options.readBackKeyAgreementKey {IKeyAgreementKey}
|
|
57
|
+
* @param [options.pinnedEpochId] {string}
|
|
58
|
+
* @param [options.onUserKeyAdopted] {Function}
|
|
59
|
+
* @returns {Promise<object>}
|
|
60
|
+
*/
|
|
61
|
+
async function adoptRotatedUserKey({ rosterStore, descriptor, userKey, readBackKeyAgreementKey, pinnedEpochId, onUserKeyAdopted }) {
|
|
62
|
+
const read = await readUserKeyRoster({
|
|
63
|
+
store: rosterStore,
|
|
64
|
+
descriptor,
|
|
65
|
+
...(userKey ? { userKey } : {}),
|
|
66
|
+
clientKeyAgreementKey: readBackKeyAgreementKey,
|
|
67
|
+
pinnedEpochId
|
|
68
|
+
});
|
|
69
|
+
if (read.rotated) {
|
|
70
|
+
await onUserKeyAdopted?.({
|
|
71
|
+
userKey: read.userKey,
|
|
72
|
+
latestEpochId: read.latestEpochId,
|
|
73
|
+
descriptor: read.descriptor
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
rotated: read.rotated,
|
|
78
|
+
userKey: read.userKey,
|
|
79
|
+
descriptor: read.descriptor
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The collection fan-out, in parallel -- run even when the roster was found
|
|
84
|
+
* already rotated (a re-run after a crash), because the staleness rule finds
|
|
85
|
+
* exactly the stranded collections.
|
|
86
|
+
*
|
|
87
|
+
* @param options {object}
|
|
88
|
+
* @param options.collections {CascadeCollections}
|
|
89
|
+
* @param options.rosterDescriptor {CollectionEncryption}
|
|
90
|
+
* @param options.clientKeyAgreementKey {IKeyAgreementKey} the key that
|
|
91
|
+
* unwraps the roster's generations for the per-collection re-epoch
|
|
92
|
+
* @param options.userKey {UserKey}
|
|
93
|
+
* @returns {Promise<UserKeyCascadeResult>}
|
|
94
|
+
*/
|
|
95
|
+
async function fanOutToCollections({ collections, rosterDescriptor, clientKeyAgreementKey, userKey }) {
|
|
96
|
+
return cascadeCollectionsToUserKey({
|
|
97
|
+
collectionIds: await collectionIdsOf({ collections }),
|
|
98
|
+
storeFor: collections.storeFor,
|
|
99
|
+
...(collections.isEncrypted
|
|
100
|
+
? { isEncrypted: collections.isEncrypted }
|
|
101
|
+
: {}),
|
|
102
|
+
rosterDescriptor,
|
|
103
|
+
clientKeyAgreementKey,
|
|
104
|
+
userKey
|
|
105
|
+
});
|
|
106
|
+
}
|
|
19
107
|
/**
|
|
20
108
|
* Runs the roster rotation (with its seal backstop) and the collection
|
|
21
109
|
* fan-out over the document a ceremony's own edit just published. See the
|
|
@@ -33,25 +121,13 @@ async function collectionIdsOf({ collections }) {
|
|
|
33
121
|
* (identity) key-agreement key -- its roster entry
|
|
34
122
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
35
123
|
* roster epoch
|
|
36
|
-
* @param [options.onUserKeyAdopted] {
|
|
37
|
-
*
|
|
38
|
-
* and BEFORE the fan-out. The key and the epoch pin must persist atomically
|
|
124
|
+
* @param [options.onUserKeyAdopted] {UserKeyAdoptedHook} persists a
|
|
125
|
+
* rotated key
|
|
39
126
|
* @param options.collections {CascadeCollections} the fan-out's work
|
|
40
127
|
* @returns {Promise<RosterCascadeResult>}
|
|
41
128
|
*/
|
|
42
129
|
export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc, log, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections }) {
|
|
43
|
-
|
|
44
|
-
// backstop's removal detection -- must run under a controller view that
|
|
45
|
-
// includes the edit the ceremony just published, or the rotation anchors
|
|
46
|
-
// pre-edit and the log stays unsealed with the seal blind to the removal.
|
|
47
|
-
// Rather than leaving that to the injected store's own controller wiring,
|
|
48
|
-
// the view built from the edit's post-edit log is set as the store's minimum
|
|
49
|
-
// controller version; a fresher resolved view still wins.
|
|
50
|
-
if (isSealableDescriptorStore(rosterStore)) {
|
|
51
|
-
rosterStore.setMinimumControllerVersion({
|
|
52
|
-
controller: webvhResourceLogController({ did, log })
|
|
53
|
-
});
|
|
54
|
-
}
|
|
130
|
+
anchorRosterStoreAt({ rosterStore, did, log });
|
|
55
131
|
// The roster rotation, recipients resolved from that same document.
|
|
56
132
|
// Whether there IS a roster is settled BY the convergence call itself: a
|
|
57
133
|
// `null` descriptor back means the account has no `key-map/user-key.jsonl`
|
|
@@ -70,23 +146,14 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
|
|
|
70
146
|
if (converged.descriptor === null) {
|
|
71
147
|
return { rotated: false, collections: { outcomes: {}, failed: [] } };
|
|
72
148
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// continuity and possession checks still run on the threaded descriptor).
|
|
76
|
-
const read = await readUserKeyRoster({
|
|
77
|
-
store: rosterStore,
|
|
149
|
+
const read = await adoptRotatedUserKey({
|
|
150
|
+
rosterStore,
|
|
78
151
|
descriptor: converged.descriptor,
|
|
79
|
-
|
|
80
|
-
clientKeyAgreementKey,
|
|
81
|
-
pinnedEpochId
|
|
152
|
+
userKey,
|
|
153
|
+
readBackKeyAgreementKey: clientKeyAgreementKey,
|
|
154
|
+
pinnedEpochId,
|
|
155
|
+
onUserKeyAdopted
|
|
82
156
|
});
|
|
83
|
-
if (read.rotated) {
|
|
84
|
-
await onUserKeyAdopted?.({
|
|
85
|
-
userKey: read.userKey,
|
|
86
|
-
latestEpochId: read.latestEpochId,
|
|
87
|
-
descriptor: read.descriptor
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
157
|
// The seal backstop: an ordinary rotation is the sealing append by
|
|
91
158
|
// construction, but a rotation that no-op'd (the removed party held no
|
|
92
159
|
// current-epoch wrap -- an orphan entry, or any re-run) appended nothing,
|
|
@@ -102,15 +169,8 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
|
|
|
102
169
|
rosterSeal = { outcome: 'failed', error: err };
|
|
103
170
|
}
|
|
104
171
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// rule finds exactly the stranded collections.
|
|
108
|
-
const cascade = await cascadeCollectionsToUserKey({
|
|
109
|
-
collectionIds: await collectionIdsOf({ collections }),
|
|
110
|
-
storeFor: collections.storeFor,
|
|
111
|
-
...(collections.isEncrypted
|
|
112
|
-
? { isEncrypted: collections.isEncrypted }
|
|
113
|
-
: {}),
|
|
172
|
+
const cascade = await fanOutToCollections({
|
|
173
|
+
collections,
|
|
114
174
|
rosterDescriptor: read.descriptor,
|
|
115
175
|
clientKeyAgreementKey,
|
|
116
176
|
userKey: read.userKey
|
|
@@ -123,4 +183,84 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
|
|
|
123
183
|
rosterDescriptor: read.descriptor
|
|
124
184
|
};
|
|
125
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* The recipient-naming entry point: retires ONE named roster recipient and
|
|
188
|
+
* runs the collection fan-out, for a ceremony that rotates BEFORE its own
|
|
189
|
+
* document edit (see the module doc). The document handed in still keys the
|
|
190
|
+
* retiring recipient, so the rotation names its kid explicitly; the fresh key
|
|
191
|
+
* is read back through `readBackKeyAgreementKey`, a recipient whose wrap
|
|
192
|
+
* survives the rotation (the standing credential's, on both forgets). No
|
|
193
|
+
* seal backstop runs here.
|
|
194
|
+
*
|
|
195
|
+
* Every stage detects its own completion from durable state: a recipient the
|
|
196
|
+
* current epoch no longer wraps to skips the append (so a re-run of a
|
|
197
|
+
* torn-after-rotation ceremony attempts no second append at the same anchor,
|
|
198
|
+
* which on a ladder-signed roster the one-shot license would refuse), the
|
|
199
|
+
* read-back adopts whatever the roster now delivers, and the fan-out is
|
|
200
|
+
* staleness-driven. An account with no roster yet reports `rotated: false`
|
|
201
|
+
* with an empty fan-out and no key.
|
|
202
|
+
*
|
|
203
|
+
* @param options {object}
|
|
204
|
+
* @param options.rosterStore {EncryptionDescriptorStore} the
|
|
205
|
+
* `key-map/user-key.jsonl` roster store
|
|
206
|
+
* @param options.did {string} the account's did:webvh
|
|
207
|
+
* @param options.doc {DIDDoc} the document the rotation's recipients are
|
|
208
|
+
* resolved from -- the one `log` resolves to
|
|
209
|
+
* @param options.log {DIDLog} the log the rotation anchors at, which the
|
|
210
|
+
* minimum controller version is built from: the pre-edit head for a plain
|
|
211
|
+
* forget, the post-reinstall head for the last-client transition
|
|
212
|
+
* @param options.retireRecipientId {string} the roster kid to retire
|
|
213
|
+
* @param [options.userKey] {UserKey} this client's cached user key
|
|
214
|
+
* @param options.readBackKeyAgreementKey {IKeyAgreementKey} the recipient
|
|
215
|
+
* whose wrap survives the rotation, reading the fresh key back and
|
|
216
|
+
* unwrapping the generations for the fan-out
|
|
217
|
+
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
218
|
+
* roster epoch
|
|
219
|
+
* @param [options.onUserKeyAdopted] {UserKeyAdoptedHook} persists a
|
|
220
|
+
* rotated key
|
|
221
|
+
* @param options.collections {CascadeCollections} the fan-out's work
|
|
222
|
+
* @returns {Promise<RosterCascadeResult>} `rotated` says whether THIS run
|
|
223
|
+
* retired the recipient's wrap; `rosterSeal` is never present
|
|
224
|
+
* @throws {UserKeyRosterIntegrityError} the roster's `currentEpoch` names
|
|
225
|
+
* no epoch in its own list
|
|
226
|
+
*/
|
|
227
|
+
export async function retireRosterRecipientAndCascade({ rosterStore, did, doc, log, retireRecipientId, userKey, readBackKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections }) {
|
|
228
|
+
anchorRosterStoreAt({ rosterStore, did, log });
|
|
229
|
+
const current = await rosterStore.read();
|
|
230
|
+
if (current === null) {
|
|
231
|
+
return { rotated: false, collections: { outcomes: {}, failed: [] } };
|
|
232
|
+
}
|
|
233
|
+
let descriptor = current.descriptor;
|
|
234
|
+
let rotated = false;
|
|
235
|
+
if (rosterWrapsRecipient({ descriptor, recipientId: retireRecipientId })) {
|
|
236
|
+
descriptor = await rotateUserKeyRoster({
|
|
237
|
+
store: rosterStore,
|
|
238
|
+
document: doc,
|
|
239
|
+
retireRecipientId
|
|
240
|
+
});
|
|
241
|
+
rotated = true;
|
|
242
|
+
}
|
|
243
|
+
// The fresh key comes back through the surviving recipient's wrap -- the
|
|
244
|
+
// retired one is gone from the current epoch.
|
|
245
|
+
const read = await adoptRotatedUserKey({
|
|
246
|
+
rosterStore,
|
|
247
|
+
descriptor,
|
|
248
|
+
userKey,
|
|
249
|
+
readBackKeyAgreementKey,
|
|
250
|
+
pinnedEpochId,
|
|
251
|
+
onUserKeyAdopted
|
|
252
|
+
});
|
|
253
|
+
const cascade = await fanOutToCollections({
|
|
254
|
+
collections,
|
|
255
|
+
rosterDescriptor: read.descriptor,
|
|
256
|
+
clientKeyAgreementKey: readBackKeyAgreementKey,
|
|
257
|
+
userKey: read.userKey
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
rotated,
|
|
261
|
+
collections: cascade,
|
|
262
|
+
userKey: read.userKey,
|
|
263
|
+
rosterDescriptor: read.descriptor
|
|
264
|
+
};
|
|
265
|
+
}
|
|
126
266
|
//# sourceMappingURL=userKeyRosterCascade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userKeyRosterCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyRosterCascade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"userKeyRosterCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyRosterCascade.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EACL,2BAA2B,EAE5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AA+C3B;;;;;;;GAOG;AACH,K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CAAC,CAAA;IAE9C,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;IACxC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAA;IACtE,CAAC;IACD,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;IACnC,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,oBAAoB,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;QACzE,UAAU,GAAG,MAAM,mBAAmB,CAAC;YACrC,KAAK,EAAE,WAAW;YAClB,QAAQ,EAAE,GAAG;YACb,iBAAiB;SAClB,CAAC,CAAA;QACF,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IACD,yEAAyE;IACzE,8CAA8C;IAC9C,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC;QACrC,WAAW;QACX,UAAU;QACV,OAAO;QACP,uBAAuB;QACvB,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC;QACxC,WAAW;QACX,gBAAgB,EAAE,IAAI,CAAC,UAAU;QACjC,qBAAqB,EAAE,uBAAuB;QAC9C,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,UAAU;KAClC,CAAA;AACH,CAAC"}
|
package/dist/recovery/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalize
|
|
|
45
45
|
export type { RecoveryClient } from './recoveryCode.js';
|
|
46
46
|
export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
|
|
47
47
|
export type { SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from '../unlock/unlockRecord.js';
|
|
48
|
-
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
48
|
+
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, recordedDelegationFields, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
49
49
|
export type { RecordRemintOutcome, RecoveryDelegationEntry } from './recoveryDelegation.js';
|
|
50
50
|
export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
|
|
51
51
|
export type { RecoveryLogStore, RecoveryPublicKeys, ReplacementRecoveryPublicKeys } from './recoveryWebvh.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,6BAA6B,EAC9B,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,6BAA6B,EAC9B,MAAM,oBAAoB,CAAA"}
|
package/dist/recovery/index.js
CHANGED
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
*/
|
|
44
44
|
export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
|
|
45
45
|
export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
|
|
46
|
-
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
46
|
+
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, recordedDelegationFields, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
47
47
|
export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
|
|
48
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAMhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAMhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
|
|
@@ -41,6 +41,29 @@ export declare function delegateLogWrite({ zcapClient, pointer, recoveryClientDi
|
|
|
41
41
|
now?: number;
|
|
42
42
|
}): Promise<IZcap>;
|
|
43
43
|
export { delegationProofKeyId };
|
|
44
|
+
/**
|
|
45
|
+
* The registry fields a record's delegations stand for -- which key signed
|
|
46
|
+
* the bridge and the `delegatedClients` sibling, and when each expires --
|
|
47
|
+
* built once here for the re-mint and for the credential-anchored
|
|
48
|
+
* establishment's standing fields. A member is present iff its source is:
|
|
49
|
+
* an absent delegation, a proof with no key id, or a caveat-less zcap
|
|
50
|
+
* contributes nothing.
|
|
51
|
+
*
|
|
52
|
+
* @param options {object}
|
|
53
|
+
* @param [options.delegation] {IZcap} the record's bridge delegation
|
|
54
|
+
* @param [options.delegatedClients] {IZcap} the record's sibling
|
|
55
|
+
* @returns {{ delegationKeyId?: string, delegationExpires?: string,
|
|
56
|
+
* delegatedClientsKeyId?: string, delegatedClientsExpires?: string }}
|
|
57
|
+
*/
|
|
58
|
+
export declare function recordedDelegationFields({ delegation, delegatedClients }: {
|
|
59
|
+
delegation?: IZcap;
|
|
60
|
+
delegatedClients?: IZcap;
|
|
61
|
+
}): {
|
|
62
|
+
delegationKeyId?: string;
|
|
63
|
+
delegationExpires?: string;
|
|
64
|
+
delegatedClientsKeyId?: string;
|
|
65
|
+
delegatedClientsExpires?: string;
|
|
66
|
+
};
|
|
44
67
|
/**
|
|
45
68
|
* The members of a recovery-code registry entry the re-mint reads: where the
|
|
46
69
|
* code's unlock Space and record are (`unlockSpaceId`, `manageCapability`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAIhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxE,OAAO,EACL,oBAAoB,EAGrB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,QAAuB,CAAA;AAI9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0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,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAC,CAoLD"}
|
|
@@ -112,6 +112,47 @@ export async function delegateLogWrite({ zcapClient, pointer, recoveryClientDid,
|
|
|
112
112
|
// Re-exported from its shared home (`webvh/standingZcap.ts`), so this
|
|
113
113
|
// module's public surface is unchanged.
|
|
114
114
|
export { delegationProofKeyId };
|
|
115
|
+
/**
|
|
116
|
+
* The registry fields a record's delegations stand for -- which key signed
|
|
117
|
+
* the bridge and the `delegatedClients` sibling, and when each expires --
|
|
118
|
+
* built once here for the re-mint and for the credential-anchored
|
|
119
|
+
* establishment's standing fields. A member is present iff its source is:
|
|
120
|
+
* an absent delegation, a proof with no key id, or a caveat-less zcap
|
|
121
|
+
* contributes nothing.
|
|
122
|
+
*
|
|
123
|
+
* @param options {object}
|
|
124
|
+
* @param [options.delegation] {IZcap} the record's bridge delegation
|
|
125
|
+
* @param [options.delegatedClients] {IZcap} the record's sibling
|
|
126
|
+
* @returns {{ delegationKeyId?: string, delegationExpires?: string,
|
|
127
|
+
* delegatedClientsKeyId?: string, delegatedClientsExpires?: string }}
|
|
128
|
+
*/
|
|
129
|
+
export function recordedDelegationFields({ delegation, delegatedClients }) {
|
|
130
|
+
const delegationKeyId = delegation
|
|
131
|
+
? delegationProofKeyId(delegation)
|
|
132
|
+
: undefined;
|
|
133
|
+
const delegationExpires = delegation ? zcapExpires(delegation) : undefined;
|
|
134
|
+
const delegatedClientsKeyId = delegatedClients
|
|
135
|
+
? delegationProofKeyId(delegatedClients)
|
|
136
|
+
: undefined;
|
|
137
|
+
const delegatedClientsExpires = delegatedClients
|
|
138
|
+
? zcapExpires(delegatedClients)
|
|
139
|
+
: undefined;
|
|
140
|
+
return {
|
|
141
|
+
...(delegationKeyId ? { delegationKeyId } : {}),
|
|
142
|
+
...(delegationExpires ? { delegationExpires } : {}),
|
|
143
|
+
...(delegatedClientsKeyId ? { delegatedClientsKeyId } : {}),
|
|
144
|
+
...(delegatedClientsExpires ? { delegatedClientsExpires } : {})
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A delegation's `expires` caveat, when it carries one.
|
|
149
|
+
*
|
|
150
|
+
* @param zcap {IZcap}
|
|
151
|
+
* @returns {string | undefined}
|
|
152
|
+
*/
|
|
153
|
+
function zcapExpires(zcap) {
|
|
154
|
+
return zcap.expires;
|
|
155
|
+
}
|
|
115
156
|
/**
|
|
116
157
|
* Re-mints the recovery delegations the current document no longer backs --
|
|
117
158
|
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
@@ -295,21 +336,13 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
|
|
|
295
336
|
record: wrapped,
|
|
296
337
|
capability: entry.manageCapability
|
|
297
338
|
});
|
|
298
|
-
const delegationKeyId = delegationProofKeyId(delegation);
|
|
299
|
-
const delegationExpires = delegation.expires;
|
|
300
|
-
const delegatedClientsKeyId = delegatedClients
|
|
301
|
-
? delegationProofKeyId(delegatedClients)
|
|
302
|
-
: undefined;
|
|
303
|
-
const delegatedClientsExpires = delegatedClients
|
|
304
|
-
? delegatedClients.expires
|
|
305
|
-
: undefined;
|
|
306
339
|
await recordEntry({
|
|
307
340
|
entry: {
|
|
308
341
|
...entry,
|
|
309
|
-
...(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
342
|
+
...recordedDelegationFields({
|
|
343
|
+
delegation,
|
|
344
|
+
...(delegatedClients ? { delegatedClients } : {})
|
|
345
|
+
})
|
|
313
346
|
}
|
|
314
347
|
});
|
|
315
348
|
reminted += 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAG7E,OAAO,EAAE,YAAY,EAAE,KAA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BAClB,GAAG;aACJ,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,CAAA;YACZ,QAAQ,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE,GAAG;aACX,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AACxC,CAAC"}
|
package/dist/request/appKey.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IVerifiableCredential } from '@interop/data-integrity-core';
|
|
1
|
+
import type { IDocumentLoader, IVerifiableCredential } from '@interop/data-integrity-core';
|
|
2
2
|
import { CONTEXT_URL_V1 as APP_CONNECT_CONTEXT_URL } from 'byoe-context';
|
|
3
3
|
import type { IAppConnectApp } from './types.js';
|
|
4
4
|
/**
|
|
@@ -160,6 +160,40 @@ export declare function findAppKeyCredential({ credentials, appUrl, origin }: {
|
|
|
160
160
|
appUrl: string;
|
|
161
161
|
origin: string;
|
|
162
162
|
}): Promise<IVerifiableCredential | undefined>;
|
|
163
|
+
/**
|
|
164
|
+
* Assembles and signs an app-key credential for a seed the caller supplies:
|
|
165
|
+
* the fixed two-entry type array, the hosted App Connect context URL, issuer
|
|
166
|
+
* and subject both the seed-derived DID, and the `seed` / `appUrl` / `origin`
|
|
167
|
+
* claims. `vc.issue` auto-fills `issuanceDate` in the canonical UTC form the
|
|
168
|
+
* ranking expects. Shared by the fresh mint and the legacy re-issue, and
|
|
169
|
+
* exported for an application's own self-issue path (dev-grant provisioning,
|
|
170
|
+
* tests), so the credential's shape is maintained in one place.
|
|
171
|
+
*
|
|
172
|
+
* @param options {object}
|
|
173
|
+
* @param options.seedBytes {Uint8Array} - The 32-byte master seed; the
|
|
174
|
+
* derived did:key is both issuer and subject.
|
|
175
|
+
* @param options.appName {string} - Shown on the credential (`name`, and the
|
|
176
|
+
* default `description`).
|
|
177
|
+
* @param options.appUrl {string} - The app's canonical URL, already in
|
|
178
|
+
* serialized form.
|
|
179
|
+
* @param options.origin {string} - The attested requesting origin.
|
|
180
|
+
* @param [options.description] {string} - Overrides the default consent
|
|
181
|
+
* sentence (the legacy re-issue carries the old credential's forward).
|
|
182
|
+
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
183
|
+
* to the shared security loader.
|
|
184
|
+
* @returns {Promise<{ credential: IVerifiableCredential; subjectDid: string }>}
|
|
185
|
+
*/
|
|
186
|
+
export declare function issueAppKeyCredential({ seedBytes, appName, appUrl, origin, description, documentLoader: loader }: {
|
|
187
|
+
seedBytes: Uint8Array;
|
|
188
|
+
appName: string;
|
|
189
|
+
appUrl: string;
|
|
190
|
+
origin: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
documentLoader?: IDocumentLoader;
|
|
193
|
+
}): Promise<{
|
|
194
|
+
credential: IVerifiableCredential;
|
|
195
|
+
subjectDid: string;
|
|
196
|
+
}>;
|
|
163
197
|
/**
|
|
164
198
|
* Mints a fresh app-key credential for an app + origin: generates a 32-byte
|
|
165
199
|
* seed, derives the seed's did:key, and self-issues the credential (issuer ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/request/appKey.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/request/appKey.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,8BAA8B,CAAA;AAMrC,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAShD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,YAAY,CAAA;AAIzC;;;;;;;;;;;;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wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAEpB;AA4BD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAMpB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAMpB"}
|
package/dist/request/appKey.js
CHANGED
|
@@ -289,14 +289,38 @@ export async function findAppKeyCredential({ credentials, appUrl, origin }) {
|
|
|
289
289
|
}
|
|
290
290
|
return undefined;
|
|
291
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* The `description` an app-key credential carries when the caller supplies
|
|
294
|
+
* none: the consent-surface sentence the wallet mints with.
|
|
295
|
+
*/
|
|
296
|
+
function defaultAppKeyDescription(appName) {
|
|
297
|
+
return (`The ${appName} app keeps this key in your wallet so it can open ` +
|
|
298
|
+
'your encrypted data on this and other devices.');
|
|
299
|
+
}
|
|
292
300
|
/**
|
|
293
301
|
* Assembles and signs an app-key credential for a seed the caller supplies:
|
|
294
302
|
* the fixed two-entry type array, the hosted App Connect context URL, issuer
|
|
295
303
|
* and subject both the seed-derived DID, and the `seed` / `appUrl` / `origin`
|
|
296
304
|
* claims. `vc.issue` auto-fills `issuanceDate` in the canonical UTC form the
|
|
297
|
-
* ranking expects. Shared by the fresh mint and the legacy re-issue
|
|
305
|
+
* ranking expects. Shared by the fresh mint and the legacy re-issue, and
|
|
306
|
+
* exported for an application's own self-issue path (dev-grant provisioning,
|
|
307
|
+
* tests), so the credential's shape is maintained in one place.
|
|
308
|
+
*
|
|
309
|
+
* @param options {object}
|
|
310
|
+
* @param options.seedBytes {Uint8Array} - The 32-byte master seed; the
|
|
311
|
+
* derived did:key is both issuer and subject.
|
|
312
|
+
* @param options.appName {string} - Shown on the credential (`name`, and the
|
|
313
|
+
* default `description`).
|
|
314
|
+
* @param options.appUrl {string} - The app's canonical URL, already in
|
|
315
|
+
* serialized form.
|
|
316
|
+
* @param options.origin {string} - The attested requesting origin.
|
|
317
|
+
* @param [options.description] {string} - Overrides the default consent
|
|
318
|
+
* sentence (the legacy re-issue carries the old credential's forward).
|
|
319
|
+
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
320
|
+
* to the shared security loader.
|
|
321
|
+
* @returns {Promise<{ credential: IVerifiableCredential; subjectDid: string }>}
|
|
298
322
|
*/
|
|
299
|
-
async function issueAppKeyCredential({ seedBytes, appName, appUrl, origin, description }) {
|
|
323
|
+
export async function issueAppKeyCredential({ seedBytes, appName, appUrl, origin, description = defaultAppKeyDescription(appName), documentLoader: loader = documentLoader }) {
|
|
300
324
|
const agent = await CapabilityAgent.fromSeed({
|
|
301
325
|
seed: seedBytes,
|
|
302
326
|
handle: APP_KEY_HANDLE,
|
|
@@ -321,7 +345,7 @@ async function issueAppKeyCredential({ seedBytes, appName, appUrl, origin, descr
|
|
|
321
345
|
const signed = (await vc.issue({
|
|
322
346
|
credential,
|
|
323
347
|
suite,
|
|
324
|
-
documentLoader
|
|
348
|
+
documentLoader: loader
|
|
325
349
|
}));
|
|
326
350
|
return { credential: signed, subjectDid: controllerDid };
|
|
327
351
|
}
|
|
@@ -347,9 +371,7 @@ export async function mintAppKeyCredential({ app, origin }) {
|
|
|
347
371
|
seedBytes,
|
|
348
372
|
appName: app.name,
|
|
349
373
|
appUrl: app.appUrl,
|
|
350
|
-
origin
|
|
351
|
-
description: `The ${app.name} app keeps this key in your wallet so it can open ` +
|
|
352
|
-
'your encrypted data on this and other devices.'
|
|
374
|
+
origin
|
|
353
375
|
});
|
|
354
376
|
}
|
|
355
377
|
/**
|
|
@@ -428,10 +450,7 @@ export async function reissueAppKeyCredential({ credential, app, origin }) {
|
|
|
428
450
|
appName: app.name,
|
|
429
451
|
appUrl: app.appUrl,
|
|
430
452
|
origin,
|
|
431
|
-
description: typeof legacyDescription === 'string'
|
|
432
|
-
? legacyDescription
|
|
433
|
-
: `The ${app.name} app keeps this key in your wallet so it can ` +
|
|
434
|
-
'open your encrypted data on this and other devices.'
|
|
453
|
+
description: typeof legacyDescription === 'string' ? legacyDescription : undefined
|
|
435
454
|
});
|
|
436
455
|
}
|
|
437
456
|
/**
|