@interop/wallet-core 0.17.1 → 0.18.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/README.md +13 -13
- package/dist/clients/index.d.ts +4 -3
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +3 -2
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/policy.d.ts +3 -3
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +1 -1
- package/dist/clients/revocation.d.ts +15 -15
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +19 -19
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +26 -25
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +29 -29
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +16 -16
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +19 -19
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/enrollment/index.d.ts +1 -1
- package/dist/enrollment/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/keys/clientKeyRecord.d.ts +16 -16
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +39 -35
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +19 -17
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +16 -14
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -3
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +13 -13
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKey.d.ts +43 -0
- package/dist/keys/userKey.d.ts.map +1 -0
- package/dist/keys/{puk.js → userKey.js} +23 -21
- package/dist/keys/userKey.js.map +1 -0
- package/dist/keys/{pukCascade.d.ts → userKeyCascade.d.ts} +69 -69
- package/dist/keys/userKeyCascade.d.ts.map +1 -0
- package/dist/keys/{pukCascade.js → userKeyCascade.js} +67 -64
- package/dist/keys/userKeyCascade.js.map +1 -0
- package/dist/keys/{pukRoster.d.ts → userKeyRoster.d.ts} +73 -74
- package/dist/keys/userKeyRoster.d.ts.map +1 -0
- package/dist/keys/{pukRoster.js → userKeyRoster.js} +86 -83
- package/dist/keys/userKeyRoster.js.map +1 -0
- package/dist/recovery/index.d.ts +1 -1
- package/dist/recovery/index.js +1 -1
- package/dist/recovery/recoveryCode.d.ts +1 -1
- package/dist/recovery/recoveryCode.js +6 -6
- package/dist/recovery/recoveryRecord.d.ts +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +1 -1
- package/dist/recovery/recoveryWebvh.js +1 -1
- package/dist/space/activity.d.ts +1 -1
- package/dist/space/activity.js +1 -1
- package/dist/space/collections.d.ts +17 -17
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +16 -16
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +2 -2
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +2 -2
- package/dist/space/index.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +1 -1
- package/dist/webvh/didWebvh.js +6 -6
- package/package.json +1 -1
- package/dist/keys/puk.d.ts +0 -42
- package/dist/keys/puk.d.ts.map +0 -1
- package/dist/keys/puk.js.map +0 -1
- package/dist/keys/pukCascade.d.ts.map +0 -1
- package/dist/keys/pukCascade.js.map +0 -1
- package/dist/keys/pukRoster.d.ts.map +0 -1
- package/dist/keys/pukRoster.js.map +0 -1
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
* `CollectionEncryption` descriptor verbatim, whose current epoch IS the
|
|
7
|
-
* current
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
12
|
-
* epoch stamp marks a cached copy stale.
|
|
5
|
+
* The user key wrap set: the `key-map/user-key.json` roster resource. Its body
|
|
6
|
+
* is a `CollectionEncryption` descriptor verbatim, whose current epoch IS the
|
|
7
|
+
* current user key -- the epoch id is the user key's did:key and the wrapped
|
|
8
|
+
* secret is the user key's raw 32-byte key, wrapped to each enrolled client's
|
|
9
|
+
* key-agreement key. The roster is the delivery channel for user key rotation:
|
|
10
|
+
* each client keeps the user key in its own local state under the unlock layer,
|
|
11
|
+
* and the roster's epoch stamp marks a cached copy stale.
|
|
13
12
|
*
|
|
14
13
|
* Everything mutates through was-client's descriptor-store seam (the
|
|
15
14
|
* plain-resource adapter): read-with-etag, compare-and-swap writes, and a
|
|
@@ -23,27 +22,27 @@
|
|
|
23
22
|
*
|
|
24
23
|
* - **`epochsMac`** -- the epoch configuration is authenticated under the
|
|
25
24
|
* current epoch's secret, which the server never holds; a fabricated
|
|
26
|
-
* configuration fails the MAC (`
|
|
25
|
+
* configuration fails the MAC (`UserKeyRosterIntegrityError`).
|
|
27
26
|
* - **The epoch pin** -- the latest-seen roster epoch is pinned locally by the
|
|
28
27
|
* consuming app (beside the account-pointer pin); a served
|
|
29
28
|
* roster that rolls back behind the pin is refused
|
|
30
|
-
* (`
|
|
29
|
+
* (`UserKeyRosterContinuityError`) rather than followed. Stale-roster replay
|
|
31
30
|
* thereby lands in the same accepted continuity class as a substituted
|
|
32
31
|
* account pointer.
|
|
33
32
|
* - **The roster delivers, never sources** -- the recipient-key source of
|
|
34
33
|
* record is the locally verified did:webvh document (one `keyAgreement`
|
|
35
34
|
* verification method per enrolled client). When an epoch rotates, each
|
|
36
35
|
* remaining recipient's key is resolved from that document
|
|
37
|
-
* (`
|
|
36
|
+
* (`userKeyRosterRecipientResolver`); a roster entry with no matching document
|
|
38
37
|
* verification method is dropped and never receives a wrap, so a
|
|
39
38
|
* server-injected entry sits ignored. Wraps are minted only by enrolled
|
|
40
39
|
* clients, against log-verified keys.
|
|
41
40
|
* - **`epochsSig`** -- the epoch configuration is additionally SIGNED by the
|
|
42
|
-
* writing client's enrolled Ed25519 key (`
|
|
41
|
+
* writing client's enrolled Ed25519 key (`userKeyRosterEpochsSigner`), and a
|
|
43
42
|
* read that adopts an epoch this client has not vouched for itself (a
|
|
44
43
|
* rotated read, or a freshly enrolled client's first read) verifies that
|
|
45
44
|
* signature against the locally verified did:webvh document
|
|
46
|
-
* (`
|
|
45
|
+
* (`verifyUserKeyRosterEpochsSig`). This is the check the `epochsMac` alone
|
|
47
46
|
* cannot make on those paths: the MAC is keyed by a secret unwrapped from
|
|
48
47
|
* the served descriptor itself, so a host that mints its own epoch, wraps
|
|
49
48
|
* it to this client's world-readable key-agreement key, and MACs the
|
|
@@ -54,14 +53,14 @@ import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
|
54
53
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
55
54
|
import { type EncryptionDescriptorStore, type EpochsSigner, type RecipientPublicKey } from '@interop/was-client/edv';
|
|
56
55
|
import { type ICapabilityAgent } from '../webvh/zcap.js';
|
|
57
|
-
import type {
|
|
56
|
+
import type { UserKey } from './userKey.js';
|
|
58
57
|
/**
|
|
59
58
|
* Thrown when a served roster fails its client-side authentication: a
|
|
60
59
|
* missing/unsupported/invalid `epochsMac`, or a descriptor whose `currentEpoch`
|
|
61
60
|
* names no epoch in its own list. The server (or whoever can write to it) has
|
|
62
61
|
* produced a configuration no enrolled client authenticated.
|
|
63
62
|
*/
|
|
64
|
-
export declare class
|
|
63
|
+
export declare class UserKeyRosterIntegrityError extends Error {
|
|
65
64
|
constructor(message: string);
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
@@ -71,7 +70,7 @@ export declare class PukRosterIntegrityError extends Error {
|
|
|
71
70
|
* an older consistent configuration, which a valid `epochsMac` alone cannot
|
|
72
71
|
* catch; refused rather than followed.
|
|
73
72
|
*/
|
|
74
|
-
export declare class
|
|
73
|
+
export declare class UserKeyRosterContinuityError extends Error {
|
|
75
74
|
pinnedEpochId: string;
|
|
76
75
|
constructor({ pinnedEpochId }: {
|
|
77
76
|
pinnedEpochId: string;
|
|
@@ -80,10 +79,10 @@ export declare class PukRosterContinuityError extends Error {
|
|
|
80
79
|
/**
|
|
81
80
|
* Thrown when this client holds no usable wrap in the roster's current epoch
|
|
82
81
|
* (no recipient entry for its key-agreement key, or the entry fails to
|
|
83
|
-
* unwrap). The client cannot obtain the current
|
|
82
|
+
* unwrap). The client cannot obtain the current user key -- it may have been
|
|
84
83
|
* rotated off the roster.
|
|
85
84
|
*/
|
|
86
|
-
export declare class
|
|
85
|
+
export declare class UserKeyRosterUnwrapError extends Error {
|
|
87
86
|
constructor(message: string);
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
@@ -114,7 +113,7 @@ export interface RosterRecipientDocument {
|
|
|
114
113
|
* agent (the `keyAgent` of `agentsFromSeed`)
|
|
115
114
|
* @returns {EpochsSigner} the `signEpochs` hook for roster writes
|
|
116
115
|
*/
|
|
117
|
-
export declare function
|
|
116
|
+
export declare function userKeyRosterEpochsSigner({ keyAgent }: {
|
|
118
117
|
keyAgent: ICapabilityAgent;
|
|
119
118
|
}): EpochsSigner;
|
|
120
119
|
/**
|
|
@@ -123,7 +122,7 @@ export declare function pukRosterEpochsSigner({ keyAgent }: {
|
|
|
123
122
|
* signature must be present and supported, its `kid` must be the public
|
|
124
123
|
* multibase of one of the document's verification methods (an enrolled
|
|
125
124
|
* client's signing key), and it must verify over the canonical
|
|
126
|
-
* epoch-configuration payload. Throws {@link
|
|
125
|
+
* epoch-configuration payload. Throws {@link UserKeyRosterIntegrityError}
|
|
127
126
|
* otherwise: a configuration no enrolled client signed.
|
|
128
127
|
*
|
|
129
128
|
* @param options {object}
|
|
@@ -132,7 +131,7 @@ export declare function pukRosterEpochsSigner({ keyAgent }: {
|
|
|
132
131
|
* did:webvh document (never a server-supplied roster field)
|
|
133
132
|
* @returns {Promise<void>}
|
|
134
133
|
*/
|
|
135
|
-
export declare function
|
|
134
|
+
export declare function verifyUserKeyRosterEpochsSig({ descriptor, document }: {
|
|
136
135
|
descriptor: CollectionEncryption;
|
|
137
136
|
document: RosterRecipientDocument;
|
|
138
137
|
}): Promise<void>;
|
|
@@ -169,36 +168,36 @@ export declare function rosterRecipientKid({ signingKeyMultibase, keyAgreementKe
|
|
|
169
168
|
* did:webvh document (never a server-supplied roster field)
|
|
170
169
|
* @returns {function} a `resolveRecipientKey` for `removeRecipient`
|
|
171
170
|
*/
|
|
172
|
-
export declare function
|
|
171
|
+
export declare function userKeyRosterRecipientResolver({ document }: {
|
|
173
172
|
document: RosterRecipientDocument;
|
|
174
173
|
}): (kid: string) => Promise<RecipientPublicKey | null>;
|
|
175
174
|
/**
|
|
176
|
-
* Ensures the roster exists, create-if-absent: an absent roster is
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
175
|
+
* Ensures the roster exists, create-if-absent: an absent roster is initialized
|
|
176
|
+
* with the account's existing user key installed as the first epoch, wrapped to
|
|
177
|
+
* this client's key-agreement key; an existing roster is returned as-is
|
|
178
|
+
* (authentication is the read path's job, and provisioning must never clobber
|
|
179
|
+
* an established roster). Idempotent -- losing the guarded-create race to a
|
|
180
|
+
* concurrent first init converges on the winner's roster.
|
|
182
181
|
*
|
|
183
182
|
* @param options {object}
|
|
184
183
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
185
184
|
* store
|
|
186
|
-
* @param options.
|
|
185
|
+
* @param options.userKey {UserKey} the account's user key
|
|
187
186
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
188
187
|
* (identity) key-agreement key -- the roster recipient
|
|
189
188
|
* @param options.signEpochs {EpochsSigner} this client's epoch-configuration
|
|
190
|
-
* signer ({@link
|
|
189
|
+
* signer ({@link userKeyRosterEpochsSigner}), so the first configuration is
|
|
191
190
|
* vouched for by an enrollable key rather than only its own MAC
|
|
192
191
|
* @returns {Promise<CollectionEncryption>} the roster descriptor
|
|
193
192
|
*/
|
|
194
|
-
export declare function
|
|
193
|
+
export declare function ensureUserKeyRoster({ store, userKey, clientKeyAgreementKey, signEpochs }: {
|
|
195
194
|
store: EncryptionDescriptorStore;
|
|
196
|
-
|
|
195
|
+
userKey: UserKey;
|
|
197
196
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
198
197
|
signEpochs: EpochsSigner;
|
|
199
198
|
}): Promise<CollectionEncryption>;
|
|
200
199
|
/**
|
|
201
|
-
* Wraps the
|
|
200
|
+
* Wraps the user key to a client being enrolled -- the roster half of the
|
|
202
201
|
* enrollment ceremony, and deliberately its FIRST write (decryption material
|
|
203
202
|
* before authorization, the push order): the wrap lands before the did:webvh
|
|
204
203
|
* log entries, so no enrolled client is ever authorized but blind, and a tear
|
|
@@ -223,22 +222,22 @@ export declare function ensurePukRoster({ store, puk, clientKeyAgreementKey, sig
|
|
|
223
222
|
* re-wrapping
|
|
224
223
|
* @returns {Promise<CollectionEncryption>} the refreshed roster descriptor
|
|
225
224
|
*/
|
|
226
|
-
export declare function
|
|
225
|
+
export declare function addUserKeyRosterRecipient({ store, recipient, ownerKeyAgreementKey }: {
|
|
227
226
|
store: EncryptionDescriptorStore;
|
|
228
227
|
recipient: RecipientPublicKey;
|
|
229
228
|
ownerKeyAgreementKey: IKeyAgreementKey;
|
|
230
229
|
}): Promise<CollectionEncryption>;
|
|
231
230
|
/**
|
|
232
|
-
* Rotates the
|
|
233
|
-
* enrolled wallet client or a recovery code. A thin, deliberate composition
|
|
231
|
+
* Rotates the user key roster off one recipient -- the roster half of revoking
|
|
232
|
+
* an enrolled wallet client or a recovery code. A thin, deliberate composition
|
|
234
233
|
* of was-client's `removeRecipient` with the two roster-specific choices
|
|
235
|
-
* spelled once: the remaining recipients are resolved from the locally
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
234
|
+
* spelled once: the remaining recipients are resolved from the locally verified
|
|
235
|
+
* did:webvh document ("the roster delivers, never sources" -- an entry with no
|
|
236
|
+
* matching `keyAgreement` verification method is dropped and never receives a
|
|
237
|
+
* wrap), and the pull axis is a no-op, because for a roster recipient the pull
|
|
238
|
+
* axis IS the document edit the caller performed first -- under the
|
|
239
|
+
* current-key-set rule the removed party's server-side access died the moment
|
|
240
|
+
* its verification method left the document.
|
|
242
241
|
*
|
|
243
242
|
* @param options {object}
|
|
244
243
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
@@ -248,11 +247,11 @@ export declare function addPukRosterRecipient({ store, recipient, ownerKeyAgreem
|
|
|
248
247
|
* @param options.retireRecipientId {string} the removed recipient's roster
|
|
249
248
|
* kid
|
|
250
249
|
* @param options.signEpochs {EpochsSigner} the rotating client's
|
|
251
|
-
* epoch-configuration signer ({@link
|
|
250
|
+
* epoch-configuration signer ({@link userKeyRosterEpochsSigner}), vouching for
|
|
252
251
|
* the fresh epoch so other clients' rotated reads accept it
|
|
253
252
|
* @returns {Promise<CollectionEncryption>} the rotated roster descriptor
|
|
254
253
|
*/
|
|
255
|
-
export declare function
|
|
254
|
+
export declare function rotateUserKeyRoster({ store, document, retireRecipientId, signEpochs }: {
|
|
256
255
|
store: EncryptionDescriptorStore;
|
|
257
256
|
document: RosterRecipientDocument;
|
|
258
257
|
retireRecipientId: string;
|
|
@@ -262,7 +261,7 @@ export declare function rotatePukRoster({ store, document, retireRecipientId, si
|
|
|
262
261
|
* Converges the roster onto the account document: the standing detector for a
|
|
263
262
|
* revocation cascade torn between its two halves. The cascade edits the
|
|
264
263
|
* document first and rotates the roster second, so a client that crashes in
|
|
265
|
-
* between leaves a roster that keeps wrapping the CURRENT
|
|
264
|
+
* between leaves a roster that keeps wrapping the CURRENT user key to a
|
|
266
265
|
* recipient the document no longer keys -- durable, silent, and permanent,
|
|
267
266
|
* since the revoked client's document edit will never be re-run.
|
|
268
267
|
*
|
|
@@ -270,7 +269,7 @@ export declare function rotatePukRoster({ store, document, retireRecipientId, si
|
|
|
270
269
|
* document-backed resolver cannot answer for is exactly a recipient the
|
|
271
270
|
* document no longer keys, so a healthy account reads the descriptor and
|
|
272
271
|
* writes nothing. When any such recipient is found the roster is rotated away
|
|
273
|
-
* from ALL of them at once -- a single {@link
|
|
272
|
+
* from ALL of them at once -- a single {@link rotateUserKeyRoster} suffices,
|
|
274
273
|
* because the resolver drops every unbacked entry from the fresh epoch, not
|
|
275
274
|
* just the one named as retiring.
|
|
276
275
|
*
|
|
@@ -279,8 +278,8 @@ export declare function rotatePukRoster({ store, document, retireRecipientId, si
|
|
|
279
278
|
* account), not a cascade to finish, and completing it would lock every
|
|
280
279
|
* client out of the account.
|
|
281
280
|
*
|
|
282
|
-
* The fresh
|
|
283
|
-
* ordinary way, by re-reading the roster ({@link
|
|
281
|
+
* The fresh user key itself is not returned: the caller adopts it the
|
|
282
|
+
* ordinary way, by re-reading the roster ({@link readUserKeyRoster}) once
|
|
284
283
|
* `rotated` says there is something to adopt, and then runs the collection
|
|
285
284
|
* fan-out.
|
|
286
285
|
*
|
|
@@ -293,13 +292,13 @@ export declare function rotatePukRoster({ store, document, retireRecipientId, si
|
|
|
293
292
|
* has just read (a login-time roster read), to save a re-read; omitted, the
|
|
294
293
|
* roster is read fresh
|
|
295
294
|
* @param options.signEpochs {EpochsSigner} the converging client's
|
|
296
|
-
* epoch-configuration signer ({@link
|
|
295
|
+
* epoch-configuration signer ({@link userKeyRosterEpochsSigner}), for the
|
|
297
296
|
* rotation this call may perform
|
|
298
297
|
* @returns {Promise<object>} whether the roster rotated on this call, the
|
|
299
298
|
* stale recipient kids found, and the roster descriptor as it now stands
|
|
300
299
|
* (`null` when the account has no roster yet)
|
|
301
300
|
*/
|
|
302
|
-
export declare function
|
|
301
|
+
export declare function convergeUserKeyRosterToDocument({ store, document, descriptor, signEpochs }: {
|
|
303
302
|
store: EncryptionDescriptorStore;
|
|
304
303
|
document: RosterRecipientDocument;
|
|
305
304
|
descriptor?: CollectionEncryption;
|
|
@@ -311,13 +310,13 @@ export declare function convergePukRosterToDocument({ store, document, descripto
|
|
|
311
310
|
}>;
|
|
312
311
|
/**
|
|
313
312
|
* What a roster read resolves to: the authenticated descriptor, the current
|
|
314
|
-
*
|
|
313
|
+
* user key (the cached one confirmed current, or a fresh one unwrapped from a
|
|
315
314
|
* rotated epoch -- `rotated` says which), and the epoch id the caller must pin
|
|
316
315
|
* as the new latest-seen.
|
|
317
316
|
*/
|
|
318
|
-
export interface
|
|
317
|
+
export interface UserKeyRosterReadResult {
|
|
319
318
|
descriptor: CollectionEncryption;
|
|
320
|
-
|
|
319
|
+
userKey: UserKey;
|
|
321
320
|
rotated: boolean;
|
|
322
321
|
latestEpochId: string;
|
|
323
322
|
}
|
|
@@ -328,39 +327,39 @@ export interface PukRosterReadResult {
|
|
|
328
327
|
*
|
|
329
328
|
* 1. **Continuity**: the served epochs must contain the pinned latest-seen
|
|
330
329
|
* epoch, and `currentEpoch` must not precede it in the append-only list
|
|
331
|
-
* (`
|
|
332
|
-
* 2. **Possession**: `currentEpoch ===
|
|
330
|
+
* (`UserKeyRosterContinuityError` -- the rollback/replay refusal).
|
|
331
|
+
* 2. **Possession**: `currentEpoch === userKey.id` confirms the cached user key
|
|
333
332
|
* current; otherwise the current epoch was rotated by another client and
|
|
334
333
|
* this client's wrap is unwrapped with its own key-agreement key
|
|
335
|
-
* (`
|
|
334
|
+
* (`UserKeyRosterUnwrapError` when it holds none).
|
|
336
335
|
* 3. **Provenance** (the rotated/first-read path only): the epoch
|
|
337
336
|
* configuration's `epochsSig` is verified against the locally verified
|
|
338
|
-
* did:webvh document ({@link
|
|
337
|
+
* did:webvh document ({@link verifyUserKeyRosterEpochsSig}) BEFORE the epoch
|
|
339
338
|
* it delivers is adopted. On this path the `epochsMac` alone proves
|
|
340
339
|
* nothing against the host -- its key is unwrapped from the served
|
|
341
340
|
* descriptor itself -- so an epoch no enrolled client signed is refused
|
|
342
|
-
* (`
|
|
341
|
+
* (`UserKeyRosterIntegrityError`). The cached-current path needs no signature:
|
|
343
342
|
* there the MAC is keyed by a secret this client already trusts.
|
|
344
343
|
* 4. **Authentication**: the descriptor's `epochsMac` is verified under the
|
|
345
|
-
* current epoch's secret (`
|
|
344
|
+
* current epoch's secret (`UserKeyRosterIntegrityError` on any mismatch -- a
|
|
346
345
|
* fabricated configuration).
|
|
347
346
|
*
|
|
348
|
-
* A rotated read returns the fresh
|
|
347
|
+
* A rotated read returns the fresh user key; its Ed25519 signing seed does not
|
|
349
348
|
* travel through the roster (the roster wraps the key-agreement secret
|
|
350
|
-
* alone), so the returned
|
|
349
|
+
* alone), so the returned user key carries none.
|
|
351
350
|
*
|
|
352
|
-
* A caller with no cached
|
|
353
|
-
* first post-enrollment read -- omits `
|
|
354
|
-
* the result's `rotated` is then true (the
|
|
355
|
-
* Every unwrap-path caller must therefore supply the account document
|
|
356
|
-
* way to resolve it): `document` when it already holds a verified copy,
|
|
357
|
-
* `resolveDocument` to fetch-and-verify lazily, only when the read actually
|
|
351
|
+
* A caller with no cached user key at all -- a freshly enrolled client making
|
|
352
|
+
* its first post-enrollment read -- omits `userKey` and always takes the unwrap
|
|
353
|
+
* path; the result's `rotated` is then true (the user key was adopted from the
|
|
354
|
+
* roster). Every unwrap-path caller must therefore supply the account document
|
|
355
|
+
* (or a way to resolve it): `document` when it already holds a verified copy,
|
|
356
|
+
* or `resolveDocument` to fetch-and-verify lazily, only when the read actually
|
|
358
357
|
* rotates.
|
|
359
358
|
*
|
|
360
359
|
* @param options {object}
|
|
361
360
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
362
361
|
* store
|
|
363
|
-
* @param [options.
|
|
362
|
+
* @param [options.userKey] {UserKey} this client's cached user key, when it holds one
|
|
364
363
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
365
364
|
* (identity) key-agreement key, unwrapping a rotated epoch
|
|
366
365
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
@@ -370,14 +369,14 @@ export interface PukRosterReadResult {
|
|
|
370
369
|
* @param [options.resolveDocument] {function} resolves the locally verified
|
|
371
370
|
* did:webvh document on demand; called only when the read takes the
|
|
372
371
|
* rotated/first-read path
|
|
373
|
-
* @returns {Promise<
|
|
372
|
+
* @returns {Promise<UserKeyRosterReadResult | null>}
|
|
374
373
|
*/
|
|
375
|
-
export declare function
|
|
374
|
+
export declare function readUserKeyRoster({ store, userKey, clientKeyAgreementKey, pinnedEpochId, document, resolveDocument }: {
|
|
376
375
|
store: EncryptionDescriptorStore;
|
|
377
|
-
|
|
376
|
+
userKey?: UserKey;
|
|
378
377
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
379
378
|
pinnedEpochId?: string | null;
|
|
380
379
|
document?: RosterRecipientDocument;
|
|
381
380
|
resolveDocument?: () => Promise<RosterRecipientDocument>;
|
|
382
|
-
}): Promise<
|
|
383
|
-
//# sourceMappingURL=
|
|
381
|
+
}): Promise<UserKeyRosterReadResult | null>;
|
|
382
|
+
//# sourceMappingURL=userKeyRoster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userKeyRoster.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAQL,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,qBAAa,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