@interop/wallet-core 0.101.1 → 0.104.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.
Files changed (135) hide show
  1. package/README.md +36 -17
  2. package/dist/audiences/audienceGrant.d.ts +49 -0
  3. package/dist/audiences/audienceGrant.d.ts.map +1 -0
  4. package/dist/audiences/audienceGrant.js +46 -0
  5. package/dist/audiences/audienceGrant.js.map +1 -0
  6. package/dist/audiences/index.d.ts +10 -0
  7. package/dist/audiences/index.d.ts.map +1 -0
  8. package/dist/audiences/index.js +10 -0
  9. package/dist/audiences/index.js.map +1 -0
  10. package/dist/clientAnnex/grantRevocation.d.ts +0 -18
  11. package/dist/clientAnnex/grantRevocation.d.ts.map +1 -1
  12. package/dist/clientAnnex/grantRevocation.js +2 -40
  13. package/dist/clientAnnex/grantRevocation.js.map +1 -1
  14. package/dist/clientAnnex/index.d.ts +2 -1
  15. package/dist/clientAnnex/index.d.ts.map +1 -1
  16. package/dist/clientAnnex/index.js +2 -1
  17. package/dist/clientAnnex/index.js.map +1 -1
  18. package/dist/clientAnnex/log.d.ts +4 -42
  19. package/dist/clientAnnex/log.d.ts.map +1 -1
  20. package/dist/clientAnnex/log.js +10 -65
  21. package/dist/clientAnnex/log.js.map +1 -1
  22. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  23. package/dist/clients/rosterPolicy.js +3 -1
  24. package/dist/clients/rosterPolicy.js.map +1 -1
  25. package/dist/connections/didKey.d.ts +27 -0
  26. package/dist/connections/didKey.d.ts.map +1 -1
  27. package/dist/connections/didKey.js +42 -6
  28. package/dist/connections/didKey.js.map +1 -1
  29. package/dist/connections/entry.d.ts +95 -13
  30. package/dist/connections/entry.d.ts.map +1 -1
  31. package/dist/connections/entry.js +102 -16
  32. package/dist/connections/entry.js.map +1 -1
  33. package/dist/connections/grantProof.d.ts +64 -0
  34. package/dist/connections/grantProof.d.ts.map +1 -0
  35. package/dist/connections/grantProof.js +195 -0
  36. package/dist/connections/grantProof.js.map +1 -0
  37. package/dist/connections/grants.d.ts +225 -3
  38. package/dist/connections/grants.d.ts.map +1 -1
  39. package/dist/connections/grants.js +293 -8
  40. package/dist/connections/grants.js.map +1 -1
  41. package/dist/connections/index.d.ts +22 -8
  42. package/dist/connections/index.d.ts.map +1 -1
  43. package/dist/connections/index.js +19 -6
  44. package/dist/connections/index.js.map +1 -1
  45. package/dist/connections/read.d.ts.map +1 -1
  46. package/dist/connections/read.js +2 -1
  47. package/dist/connections/read.js.map +1 -1
  48. package/dist/connections/resourceId.d.ts +33 -0
  49. package/dist/connections/resourceId.d.ts.map +1 -1
  50. package/dist/connections/resourceId.js +88 -8
  51. package/dist/connections/resourceId.js.map +1 -1
  52. package/dist/connections/upsert.d.ts +252 -7
  53. package/dist/connections/upsert.d.ts.map +1 -1
  54. package/dist/connections/upsert.js +674 -41
  55. package/dist/connections/upsert.js.map +1 -1
  56. package/dist/connections/writers.js +2 -1
  57. package/dist/connections/writers.js.map +1 -1
  58. package/dist/descriptors/index.d.ts +5 -0
  59. package/dist/descriptors/index.d.ts.map +1 -1
  60. package/dist/descriptors/index.js +5 -0
  61. package/dist/descriptors/index.js.map +1 -1
  62. package/dist/descriptors/logSource.d.ts +9 -4
  63. package/dist/descriptors/logSource.d.ts.map +1 -1
  64. package/dist/descriptors/logSource.js +13 -6
  65. package/dist/descriptors/logSource.js.map +1 -1
  66. package/dist/jsonObject.d.ts +16 -0
  67. package/dist/jsonObject.d.ts.map +1 -0
  68. package/dist/jsonObject.js +18 -0
  69. package/dist/jsonObject.js.map +1 -0
  70. package/dist/keys/index.d.ts +13 -9
  71. package/dist/keys/index.d.ts.map +1 -1
  72. package/dist/keys/index.js +11 -7
  73. package/dist/keys/index.js.map +1 -1
  74. package/dist/keys/userKeyCascade.d.ts +46 -0
  75. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  76. package/dist/keys/userKeyCascade.js +153 -65
  77. package/dist/keys/userKeyCascade.js.map +1 -1
  78. package/dist/keys/userKeyRoster.d.ts +60 -7
  79. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  80. package/dist/keys/userKeyRoster.js +165 -47
  81. package/dist/keys/userKeyRoster.js.map +1 -1
  82. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  83. package/dist/keys/userKeyRosterCascade.js +1 -0
  84. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  85. package/dist/menders/ids.d.ts +1 -1
  86. package/dist/menders/ids.d.ts.map +1 -1
  87. package/dist/menders/ids.js +20 -4
  88. package/dist/menders/ids.js.map +1 -1
  89. package/dist/resourceLog/controller.d.ts +11 -7
  90. package/dist/resourceLog/controller.d.ts.map +1 -1
  91. package/dist/resourceLog/controller.js +15 -31
  92. package/dist/resourceLog/controller.js.map +1 -1
  93. package/dist/resourceLog/document.d.ts +9 -11
  94. package/dist/resourceLog/document.d.ts.map +1 -1
  95. package/dist/resourceLog/document.js +9 -11
  96. package/dist/resourceLog/document.js.map +1 -1
  97. package/dist/space/collections.d.ts +23 -3
  98. package/dist/space/collections.d.ts.map +1 -1
  99. package/dist/space/collections.js +26 -2
  100. package/dist/space/collections.js.map +1 -1
  101. package/dist/space/inboxMessage.d.ts +47 -0
  102. package/dist/space/inboxMessage.d.ts.map +1 -0
  103. package/dist/space/inboxMessage.js +86 -0
  104. package/dist/space/inboxMessage.js.map +1 -0
  105. package/dist/space/index.d.ts +6 -1
  106. package/dist/space/index.d.ts.map +1 -1
  107. package/dist/space/index.js +5 -1
  108. package/dist/space/index.js.map +1 -1
  109. package/dist/sync/contactsConflict.d.ts +23 -10
  110. package/dist/sync/contactsConflict.d.ts.map +1 -1
  111. package/dist/sync/contactsConflict.js +40 -21
  112. package/dist/sync/contactsConflict.js.map +1 -1
  113. package/dist/unlock/index.d.ts +1 -1
  114. package/dist/unlock/index.d.ts.map +1 -1
  115. package/dist/unlock/index.js +1 -1
  116. package/dist/unlock/index.js.map +1 -1
  117. package/dist/webvh/clientAnnexDid.d.ts +76 -0
  118. package/dist/webvh/clientAnnexDid.d.ts.map +1 -0
  119. package/dist/webvh/clientAnnexDid.js +117 -0
  120. package/dist/webvh/clientAnnexDid.js.map +1 -0
  121. package/dist/webvh/didWebProjection.d.ts +38 -5
  122. package/dist/webvh/didWebProjection.d.ts.map +1 -1
  123. package/dist/webvh/didWebProjection.js +35 -22
  124. package/dist/webvh/didWebProjection.js.map +1 -1
  125. package/dist/webvh/documentDids.d.ts +3 -3
  126. package/dist/webvh/documentDids.js +3 -3
  127. package/dist/webvh/index.d.ts +4 -3
  128. package/dist/webvh/index.d.ts.map +1 -1
  129. package/dist/webvh/index.js +4 -3
  130. package/dist/webvh/index.js.map +1 -1
  131. package/dist/webvh/standingZcap.d.ts +27 -2
  132. package/dist/webvh/standingZcap.d.ts.map +1 -1
  133. package/dist/webvh/standingZcap.js +42 -4
  134. package/dist/webvh/standingZcap.js.map +1 -1
  135. package/package.json +14 -7
@@ -1,8 +1,108 @@
1
1
  import { addRecipient, epochKeyIdFor, hasKeyEpochs, replaceRecipient, trustRosterDidKeys } from '@interop/was-client/edv/core';
2
2
  import { isSealableDescriptorStore } from './rosterLogStore.js';
3
- import { currentEpochOf } from './userKeyRoster.js';
3
+ import { currentEpochOf, UserKeyRosterIntegrityError } from './userKeyRoster.js';
4
4
  import { userKeyVaultKeys } from './userKey.js';
5
5
  import { unwrapUserKeyGenerations, userKeyAsRecipient } from './userKeyGenerations.js';
6
+ /**
7
+ * Whether ONE encrypted collection's epoch roster is on the current user key:
8
+ * the decide-half of {@link rotateCollectionEpochsToUserKey}, extracted so the
9
+ * cascade and any auditor of the collection-epochs-name-the-current-user-key
10
+ * invariant apply one rule. Pure: it reads the descriptor and the generation
11
+ * ids alone, holds no key material, and writes nothing.
12
+ *
13
+ * The verdicts, tested in this order:
14
+ *
15
+ * - `unresolved-current-epoch` -- the descriptor carries no key epochs, or its
16
+ * `currentEpoch` names no epoch in its own list. The cascade refuses both
17
+ * fail-closed; an auditor attributes the state to the invariant that owns
18
+ * it (that every encrypted collection carries an epoch roster).
19
+ * - `stale-current-epoch` -- the current epoch names a superseded user key
20
+ * generation: the cascade's rotate branch.
21
+ * - `current-key-missing` -- the current epoch names neither the current
22
+ * generation nor a superseded one: a roster this cascade cannot heal.
23
+ * - `escrow-incomplete` -- the current epoch is on the current user key, but
24
+ * some epoch in the history lacks its wrap: the cascade's escrow branch.
25
+ * - `current` -- the current epoch names the current generation and no
26
+ * superseded one, and every epoch carries the current generation's wrap. The
27
+ * cascade's no-op branch, and nothing else, follows from it.
28
+ *
29
+ * The kids compared are `epochKeyIdFor`'s over the generation ids, as the
30
+ * cascade builds them.
31
+ *
32
+ * @param options {object}
33
+ * @param options.descriptor {CollectionEncryption} the collection's
34
+ * descriptor
35
+ * @param options.currentGeneration {string} the roster's current epoch id
36
+ * (the current user key's id)
37
+ * @param options.generations {string[]} every user key generation id the
38
+ * roster carries, the current one included
39
+ * @returns {CollectionEpochsVerdict}
40
+ */
41
+ export function collectionEpochsCurrent(options) {
42
+ return readCollectionEpochs(options).verdict;
43
+ }
44
+ /**
45
+ * The one rule {@link collectionEpochsCurrent} and the cascade share, with
46
+ * each verdict's payload (see {@link CollectionEpochsReading}).
47
+ *
48
+ * @param options {object}
49
+ * @param options.descriptor {CollectionEncryption}
50
+ * @param options.currentGeneration {string}
51
+ * @param options.generations {string[]}
52
+ * @returns {CollectionEpochsReading}
53
+ */
54
+ function readCollectionEpochs({ descriptor, currentGeneration, generations }) {
55
+ if (!hasKeyEpochs(descriptor)) {
56
+ return {
57
+ verdict: 'unresolved-current-epoch',
58
+ refusal: new Error('The collection descriptor carries no key epochs. Every encrypted ' +
59
+ 'collection installs its epoch[0] at provision time, so an ' +
60
+ 'epoch-less descriptor can only come from a tampering or ' +
61
+ 'pre-provisioning host; refusing to rotate it.')
62
+ };
63
+ }
64
+ let currentEpoch;
65
+ try {
66
+ currentEpoch = currentEpochOf({
67
+ descriptor,
68
+ label: 'The collection descriptor'
69
+ });
70
+ }
71
+ catch (err) {
72
+ if (err instanceof UserKeyRosterIntegrityError) {
73
+ return { verdict: 'unresolved-current-epoch', refusal: err };
74
+ }
75
+ throw err;
76
+ }
77
+ const currentKids = new Set(currentEpoch.recipients.map(entry => entry.header.kid));
78
+ const userKeyKid = epochKeyIdFor(currentGeneration);
79
+ const keyed = generations.map(id => ({ id, kid: epochKeyIdFor(id) }));
80
+ const staleNamed = keyed.filter(generation => generation.id !== currentGeneration && currentKids.has(generation.kid));
81
+ if (staleNamed.length > 0) {
82
+ // The escrow owner: the newest stale generation still named by the
83
+ // current epoch, which the cascade invariant escrowed into every prior
84
+ // epoch -- so it unwraps the whole history for the fresh user key's
85
+ // escrow.
86
+ return {
87
+ verdict: 'stale-current-epoch',
88
+ staleKids: staleNamed.map(generation => generation.kid),
89
+ ownerGenerationId: staleNamed[staleNamed.length - 1].id
90
+ };
91
+ }
92
+ if (!currentKids.has(userKeyKid)) {
93
+ return { verdict: 'current-key-missing' };
94
+ }
95
+ const incomplete = (descriptor.epochs ?? []).filter(epoch => !epoch.recipients.some(entry => entry.header.kid === userKeyKid));
96
+ if (incomplete.length === 0) {
97
+ return { verdict: 'current' };
98
+ }
99
+ // The escrow owner must unwrap exactly the incomplete epochs: the newest
100
+ // generation named by every one of them.
101
+ const escrowOwner = [...keyed]
102
+ .reverse()
103
+ .find(generation => incomplete.every(epoch => epoch.recipients.some(entry => entry.header.kid === generation.kid)));
104
+ return { verdict: 'escrow-incomplete', escrowOwnerId: escrowOwner?.id };
105
+ }
6
106
  /**
7
107
  * Brings ONE encrypted collection's epoch roster onto the current user key --
8
108
  * the per-collection op of the revocation cascade and of the completion sweep:
@@ -50,78 +150,66 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
50
150
  return 'noop';
51
151
  }
52
152
  const descriptor = current.descriptor;
53
- const staleGenerations = generations.filter(generation => generation.id !== userKey.id);
54
- if (!hasKeyEpochs(descriptor)) {
55
- throw new Error('The collection descriptor carries no key epochs. Every encrypted ' +
56
- 'collection installs its epoch[0] at provision time, so an ' +
57
- 'epoch-less descriptor can only come from a tampering or ' +
58
- 'pre-provisioning host; refusing to rotate it.');
59
- }
60
- const currentEpoch = currentEpochOf({
153
+ // The decision is the reading's: this cascade dispatches on its verdict and
154
+ // acts on its payload alone, so it and any auditor of the collection cannot
155
+ // disagree.
156
+ const reading = readCollectionEpochs({
61
157
  descriptor,
62
- label: 'The collection descriptor'
158
+ currentGeneration: userKey.id,
159
+ generations: generations.map(generation => generation.id)
63
160
  });
64
- const currentKids = new Set(currentEpoch.recipients.map(entry => entry.header.kid));
65
- const staleKids = staleGenerations
66
- .map(generation => epochKeyIdFor(generation.id))
67
- .filter(kid => currentKids.has(kid));
68
- const userKeyKid = epochKeyIdFor(userKey.id);
69
- if (staleKids.length === 0) {
70
- const escrowComplete = (descriptor.epochs ?? []).every(epoch => epoch.recipients.some(entry => entry.header.kid === userKeyKid));
71
- if (currentKids.has(userKeyKid) && escrowComplete) {
161
+ switch (reading.verdict) {
162
+ case 'unresolved-current-epoch': {
163
+ throw reading.refusal;
164
+ }
165
+ case 'current': {
72
166
  if (isSealableDescriptorStore(store)) {
73
167
  return (await store.seal()) === 'sealed' ? 'sealed' : 'noop';
74
168
  }
75
169
  return 'noop';
76
170
  }
171
+ case 'stale-current-epoch': {
172
+ const ownerGeneration = generations.find(generation => generation.id === reading.ownerGenerationId);
173
+ const owner = userKeyVaultKeys({ userKey: ownerGeneration });
174
+ await replaceRecipient({
175
+ store,
176
+ retire: reading.staleKids,
177
+ recipient: userKeyAsRecipient({ userKey }),
178
+ owner: { keyAgreementKey: owner.keyAgreementKey },
179
+ resolveRecipientKey: isSealableDescriptorStore(store)
180
+ ? trustRosterDidKeys
181
+ : vouchNoSurvivor,
182
+ pull: async () => { }
183
+ });
184
+ return 'rotated';
185
+ }
186
+ case 'current-key-missing': {
187
+ // No stale generation to retire, but the current user key is not a
188
+ // recipient at all: this collection's roster is not user-key-owned in a
189
+ // shape this cascade can heal -- surface it rather than silently minting
190
+ // an epoch whose history the account cannot read.
191
+ throw new Error('The collection current epoch names no user key generation this ' +
192
+ 'client can recognize; its roster cannot be rotated to the current ' +
193
+ 'user key.');
194
+ }
195
+ case 'escrow-incomplete': {
196
+ // Escrow completion only: the current epoch is already on the current
197
+ // user key, but some historical epoch is missing its wrap.
198
+ const escrowOwner = generations.find(generation => generation.id === reading.escrowOwnerId);
199
+ if (!escrowOwner) {
200
+ throw new Error("The current user key cannot be escrowed into this collection's " +
201
+ 'history: no held user key generation is a recipient of every ' +
202
+ 'incomplete epoch.');
203
+ }
204
+ const owner = userKeyVaultKeys({ userKey: escrowOwner });
205
+ await addRecipient({
206
+ store,
207
+ recipient: userKeyAsRecipient({ userKey }),
208
+ owner: { keyAgreementKey: owner.keyAgreementKey }
209
+ });
210
+ return 'escrowed';
211
+ }
77
212
  }
78
- if (staleKids.length > 0) {
79
- // The escrow owner: the newest stale generation still named by the
80
- // current epoch, which the cascade invariant escrowed into every prior
81
- // epoch -- so it unwraps the whole history for the fresh user key's escrow.
82
- const ownerGeneration = [...staleGenerations]
83
- .reverse()
84
- .find(generation => currentKids.has(epochKeyIdFor(generation.id)));
85
- const owner = userKeyVaultKeys({ userKey: ownerGeneration });
86
- await replaceRecipient({
87
- store,
88
- retire: staleKids,
89
- recipient: userKeyAsRecipient({ userKey }),
90
- owner: { keyAgreementKey: owner.keyAgreementKey },
91
- resolveRecipientKey: isSealableDescriptorStore(store)
92
- ? trustRosterDidKeys
93
- : vouchNoSurvivor,
94
- pull: async () => { }
95
- });
96
- return 'rotated';
97
- }
98
- if (!currentKids.has(userKeyKid)) {
99
- // No stale generation to retire, but the current user key is not a recipient
100
- // at all: this collection's roster is not user-key-owned in a shape this
101
- // cascade can heal -- surface it rather than silently minting an epoch
102
- // whose history the account cannot read.
103
- throw new Error('The collection current epoch names no user key generation this client ' +
104
- 'can recognize; its roster cannot be rotated to the current user key.');
105
- }
106
- // Escrow completion only: the current epoch is already on the current user key,
107
- // but some historical epoch is missing its wrap. The owner must unwrap
108
- // exactly those epochs -- the newest generation named by every incomplete
109
- // epoch.
110
- const incomplete = (descriptor.epochs ?? []).filter(epoch => !epoch.recipients.some(entry => entry.header.kid === userKeyKid));
111
- const escrowOwner = [...generations]
112
- .reverse()
113
- .find(generation => incomplete.every(epoch => epoch.recipients.some(entry => entry.header.kid === epochKeyIdFor(generation.id))));
114
- if (!escrowOwner) {
115
- throw new Error("The current user key cannot be escrowed into this collection's history: " +
116
- 'no held user key generation is a recipient of every incomplete epoch.');
117
- }
118
- const owner = userKeyVaultKeys({ userKey: escrowOwner });
119
- await addRecipient({
120
- store,
121
- recipient: userKeyAsRecipient({ userKey }),
122
- owner: { keyAgreementKey: owner.keyAgreementKey }
123
- });
124
- return 'escrowed';
125
213
  }
126
214
  /**
127
215
  * The survivor resolver for a store whose roster is not authenticated: it
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[],"mappings":"AAqCA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAGnB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,cAAc,CAAA;AAC7D,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAahC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,EACpD,KAAK,EACL,OAAO,EACP,WAAW,EAKZ;IACC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;IAClC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,MAAM,CAAA;IACf,CAAC;IACD,MAAM,UAAU,GAAG,OAA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AAG,EAAE,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AAC7B,CAAC"}
@@ -369,6 +369,55 @@ export declare function rosterRecipientsToRetire({ descriptor, keepRecipientIds
369
369
  export declare function enrolledClientRosterRecipients({ document }: {
370
370
  document: KeyAgreementDocument;
371
371
  }): RecipientPublicKey[];
372
+ /**
373
+ * What the user key roster's current epoch and the account document disagree
374
+ * on, read from the two alone: the decide-half of
375
+ * {@link convergeUserKeyRosterToDocument}, extracted so the converger and any
376
+ * auditor of the roster-wraps-exactly-the-document-key-set invariant apply one
377
+ * rule. Pure: no I/O, no key material, no write.
378
+ *
379
+ * - `staleRecipientIds` -- the current epoch's kids no document verification
380
+ * method backs ({@link userKeyRosterRecipientResolver}'s rule): the retire
381
+ * direction's input.
382
+ * - `unwrappedClientRecipients` -- the enrolled clients the document keys that
383
+ * hold no wrap in the current epoch
384
+ * ({@link enrolledClientRosterRecipients}, less the wrapped kids): the
385
+ * escrow direction's input, as the recipients to escrow.
386
+ * - `unwrappedCredentialMethodIds` -- the credential-class `keyAgreement`
387
+ * method ids (`credentialKeyAgreementMethods`) no current-epoch wrap
388
+ * answers for: a verbatim method whose `publicKeyMultibase` no wrapped kid
389
+ * names, or a `MultikeyCommitment` that commits to no wrapped kid's key. The
390
+ * converger never acts on this member (a credential's roster kid is not
391
+ * rebuildable from the document, so the ceremony holding the credential
392
+ * mends its wrap), but an auditor reads it, and the one predicate reports
393
+ * every direction of the drift.
394
+ *
395
+ * A healthy roster reads as three empty lists.
396
+ *
397
+ * @param options {object}
398
+ * @param options.descriptor {CollectionEncryption} the roster descriptor
399
+ * @param options.document {KeyAgreementDocument} the locally verified
400
+ * did:webvh document
401
+ * @param options.did {string} the account DID the document resolves to,
402
+ * which tells a credential-class method from an enrolled client's
403
+ * @returns {UserKeyRosterDrift}
404
+ * @throws {UserKeyRosterIntegrityError} the descriptor's `currentEpoch`
405
+ * names no epoch in its own list
406
+ */
407
+ export declare function userKeyRosterDrift({ descriptor, document, did }: {
408
+ descriptor: CollectionEncryption;
409
+ document: KeyAgreementDocument;
410
+ did: string;
411
+ }): UserKeyRosterDrift;
412
+ /**
413
+ * {@link userKeyRosterDrift}'s result: the three directions the roster's
414
+ * current epoch can disagree with the account document in.
415
+ */
416
+ export interface UserKeyRosterDrift {
417
+ staleRecipientIds: string[];
418
+ unwrappedClientRecipients: RecipientPublicKey[];
419
+ unwrappedCredentialMethodIds: string[];
420
+ }
372
421
  /**
373
422
  * Converges the roster onto the account document: the standing detector for a
374
423
  * revocation cascade torn between its two halves. The cascade edits the
@@ -377,12 +426,13 @@ export declare function enrolledClientRosterRecipients({ document }: {
377
426
  * recipient the document no longer keys -- durable, silent, and permanent,
378
427
  * since the revoked client's document edit will never be re-run.
379
428
  *
380
- * The detection is pure durable state: a current-epoch recipient the
381
- * document-backed resolver cannot answer for is exactly a recipient the
382
- * document no longer keys, so a healthy account reads the descriptor and
383
- * writes nothing. When any such recipient is found the roster is rotated away
384
- * from ALL of them at once, because the resolver drops every unbacked entry
385
- * from the fresh epoch, not just the one named as retiring.
429
+ * The detection is pure durable state, and it is {@link userKeyRosterDrift}'s
430
+ * alone: a current-epoch recipient the document-backed resolver cannot answer
431
+ * for is exactly a recipient the document no longer keys, so a healthy account
432
+ * reads the descriptor and writes nothing. When any such recipient is found
433
+ * the roster is rotated away from ALL of them at once, because the resolver
434
+ * drops every unbacked entry from the fresh epoch, not just the one named as
435
+ * retiring.
386
436
  *
387
437
  * The convergence runs in TWO directions, in one append. The retire direction
388
438
  * is above. The escrow direction is its mirror: an enrolled client the
@@ -421,6 +471,8 @@ export declare function enrolledClientRosterRecipients({ document }: {
421
471
  * store
422
472
  * @param options.document {KeyAgreementDocument} the locally verified
423
473
  * did:webvh document -- the recipient source of record
474
+ * @param options.did {string} the account DID the document resolves to
475
+ * (the drift predicate's credential-class reading takes it)
424
476
  * @param [options.descriptor] {CollectionEncryption} a descriptor the caller
425
477
  * has just read (a login-time roster read), to save a re-read; omitted, the
426
478
  * roster is read fresh
@@ -435,9 +487,10 @@ export declare function enrolledClientRosterRecipients({ document }: {
435
487
  * stale recipient kids found, the kids escrowed, and the roster descriptor
436
488
  * as it now stands (`null` when the account has no roster yet)
437
489
  */
438
- export declare function convergeUserKeyRosterToDocument({ store, document, descriptor, etag, ownerKeyAgreementKey }: {
490
+ export declare function convergeUserKeyRosterToDocument({ store, document, did, descriptor, etag, ownerKeyAgreementKey }: {
439
491
  store: EncryptionDescriptorStore;
440
492
  document: KeyAgreementDocument;
493
+ did: string;
441
494
  descriptor?: CollectionEncryption;
442
495
  etag?: string;
443
496
  ownerKeyAgreementKey?: IKeyAgreementKey;
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyRoster.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAOL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAO/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU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