@interop/wallet-core 0.68.0 → 0.69.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 (124) hide show
  1. package/README.md +14 -13
  2. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +12 -1
  3. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  4. package/dist/clientAnnex/credentialAnchoredGenesis.js +9 -2
  5. package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
  6. package/dist/clientAnnex/establish.d.ts +10 -0
  7. package/dist/clientAnnex/establish.d.ts.map +1 -1
  8. package/dist/clientAnnex/establish.js +14 -2
  9. package/dist/clientAnnex/establish.js.map +1 -1
  10. package/dist/clientAnnex/mend.d.ts +19 -4
  11. package/dist/clientAnnex/mend.d.ts.map +1 -1
  12. package/dist/clientAnnex/mend.js +83 -35
  13. package/dist/clientAnnex/mend.js.map +1 -1
  14. package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -14
  15. package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
  16. package/dist/clientAnnex/rosterDeliveredEpochs.js +12 -12
  17. package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
  18. package/dist/descriptors/index.d.ts +21 -46
  19. package/dist/descriptors/index.d.ts.map +1 -1
  20. package/dist/descriptors/index.js +21 -45
  21. package/dist/descriptors/index.js.map +1 -1
  22. package/dist/descriptors/logSource.d.ts +45 -56
  23. package/dist/descriptors/logSource.d.ts.map +1 -1
  24. package/dist/descriptors/logSource.js +64 -74
  25. package/dist/descriptors/logSource.js.map +1 -1
  26. package/dist/genesis/accountGenesis.d.ts +13 -1
  27. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  28. package/dist/genesis/accountGenesis.js +11 -2
  29. package/dist/genesis/accountGenesis.js.map +1 -1
  30. package/dist/keys/collectionLogStore.d.ts +73 -0
  31. package/dist/keys/collectionLogStore.d.ts.map +1 -0
  32. package/dist/keys/collectionLogStore.js +60 -0
  33. package/dist/keys/collectionLogStore.js.map +1 -0
  34. package/dist/keys/index.d.ts +18 -6
  35. package/dist/keys/index.d.ts.map +1 -1
  36. package/dist/keys/index.js +18 -6
  37. package/dist/keys/index.js.map +1 -1
  38. package/dist/keys/rosterLogStore.d.ts +44 -6
  39. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  40. package/dist/keys/rosterLogStore.js +51 -238
  41. package/dist/keys/rosterLogStore.js.map +1 -1
  42. package/dist/keys/rosterStore.d.ts.map +1 -1
  43. package/dist/keys/rosterStore.js +2 -1
  44. package/dist/keys/rosterStore.js.map +1 -1
  45. package/dist/keys/spaceEpochs.d.ts +67 -34
  46. package/dist/keys/spaceEpochs.d.ts.map +1 -1
  47. package/dist/keys/spaceEpochs.js +80 -30
  48. package/dist/keys/spaceEpochs.js.map +1 -1
  49. package/dist/keys/userKeyCascade.d.ts +26 -1
  50. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  51. package/dist/keys/userKeyCascade.js +29 -2
  52. package/dist/keys/userKeyCascade.js.map +1 -1
  53. package/dist/keys/userKeyRoster.d.ts +5 -0
  54. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  55. package/dist/keys/userKeyRoster.js +5 -0
  56. package/dist/keys/userKeyRoster.js.map +1 -1
  57. package/dist/keys/userKeyRosterCascade.d.ts +54 -16
  58. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  59. package/dist/keys/userKeyRosterCascade.js +50 -22
  60. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  61. package/dist/resourceLog/controller.d.ts +18 -6
  62. package/dist/resourceLog/controller.d.ts.map +1 -1
  63. package/dist/resourceLog/controller.js +5 -3
  64. package/dist/resourceLog/controller.js.map +1 -1
  65. package/dist/resourceLog/errors.d.ts +17 -43
  66. package/dist/resourceLog/errors.d.ts.map +1 -1
  67. package/dist/resourceLog/errors.js +17 -50
  68. package/dist/resourceLog/errors.js.map +1 -1
  69. package/dist/resourceLog/index.d.ts +4 -1
  70. package/dist/resourceLog/index.d.ts.map +1 -1
  71. package/dist/resourceLog/index.js +4 -1
  72. package/dist/resourceLog/index.js.map +1 -1
  73. package/dist/resourceLog/logClass.d.ts +69 -0
  74. package/dist/resourceLog/logClass.d.ts.map +1 -0
  75. package/dist/resourceLog/logClass.js +43 -0
  76. package/dist/resourceLog/logClass.js.map +1 -0
  77. package/dist/space/collections.d.ts +22 -2
  78. package/dist/space/collections.d.ts.map +1 -1
  79. package/dist/space/collections.js +18 -0
  80. package/dist/space/collections.js.map +1 -1
  81. package/dist/space/index.d.ts +4 -3
  82. package/dist/space/index.d.ts.map +1 -1
  83. package/dist/space/index.js +4 -3
  84. package/dist/space/index.js.map +1 -1
  85. package/dist/space/provisioning.d.ts +16 -6
  86. package/dist/space/provisioning.d.ts.map +1 -1
  87. package/dist/space/provisioning.js +11 -7
  88. package/dist/space/provisioning.js.map +1 -1
  89. package/dist/sync/engine.d.ts +4 -2
  90. package/dist/sync/engine.d.ts.map +1 -1
  91. package/dist/sync/engine.js.map +1 -1
  92. package/dist/sync/index.d.ts +9 -6
  93. package/dist/sync/index.d.ts.map +1 -1
  94. package/dist/sync/index.js +8 -5
  95. package/dist/sync/index.js.map +1 -1
  96. package/dist/sync/push.d.ts +0 -29
  97. package/dist/sync/push.d.ts.map +1 -1
  98. package/dist/sync/push.js +30 -28
  99. package/dist/sync/push.js.map +1 -1
  100. package/dist/sync/types.d.ts +39 -21
  101. package/dist/sync/types.d.ts.map +1 -1
  102. package/dist/sync/types.js +13 -7
  103. package/dist/sync/types.js.map +1 -1
  104. package/dist/unlock/retire.d.ts +8 -1
  105. package/dist/unlock/retire.d.ts.map +1 -1
  106. package/dist/unlock/retire.js +8 -1
  107. package/dist/unlock/retire.js.map +1 -1
  108. package/package.json +4 -4
  109. package/dist/descriptors/acquire.d.ts +0 -122
  110. package/dist/descriptors/acquire.d.ts.map +0 -1
  111. package/dist/descriptors/acquire.js +0 -100
  112. package/dist/descriptors/acquire.js.map +0 -1
  113. package/dist/descriptors/cipher.d.ts +0 -71
  114. package/dist/descriptors/cipher.d.ts.map +0 -1
  115. package/dist/descriptors/cipher.js +0 -109
  116. package/dist/descriptors/cipher.js.map +0 -1
  117. package/dist/descriptors/errors.d.ts +0 -44
  118. package/dist/descriptors/errors.d.ts.map +0 -1
  119. package/dist/descriptors/errors.js +0 -46
  120. package/dist/descriptors/errors.js.map +0 -1
  121. package/dist/descriptors/refresh.d.ts +0 -62
  122. package/dist/descriptors/refresh.d.ts.map +0 -1
  123. package/dist/descriptors/refresh.js +0 -69
  124. package/dist/descriptors/refresh.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rosterStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAMzE,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAM3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,UAAU,EACX,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAC5D,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;IACzB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GAAG,iCAAiC,CAiBpC"}
1
+ {"version":3,"file":"rosterStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAMzE,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAM3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,UAAU,EACX,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAC5D,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;IACzB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GAAG,iCAAiC,CAkBpC"}
@@ -74,7 +74,8 @@ export function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spa
74
74
  resolveController,
75
75
  pinStore,
76
76
  logId: userKeyRosterPinId({ spaceId }),
77
- signer
77
+ signer,
78
+ logClass: 'user-key-roster'
78
79
  });
79
80
  }
80
81
  //# sourceMappingURL=rosterStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rosterStore.js","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,gBAAgB,EAGjB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EACL,0BAA0B,EAE3B,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAuB;IACjE,OAAO,gBAAgB,CAAC;QACtB,OAAO;QACP,YAAY,EAAE,kBAAkB,CAAC,EAAE;QACnC,UAAU,EAAE,4BAA4B;KACzC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,UAAU,EASX;IACC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,MAAM,UAAU,GAAG,mBAAmB,CAAC;QACrC,GAAG;QACH,OAAO;QACP,YAAY,EAAE,kBAAkB,CAAC,EAAE;QACnC,UAAU;KACX,CAAC,CAAA;IACF,OAAO,0BAA0B,CAAC;QACh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QACnC,UAAU;KACX,CAAC,CAAA;IACF,OAAO,0BAA0B,CAAC;QAChC,GAAG,EAAE,gBAAgB,CAAC;YACpB,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,4BAA4B,CAAC;SAC5D,CAAC;QACF,iBAAiB;QACjB,QAAQ;QACR,KAAK,EAAE,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC;QACtC,MAAM;QACN,QAAQ,EAAE,iBAAiB;KAC5B,CAAC,CAAA;AACJ,CAAC"}
@@ -5,13 +5,21 @@
5
5
  * Provision-time key-epoch install for the wallet Space's encrypted
6
6
  * collections: every encrypted collection's descriptor carries an epoch roster
7
7
  * from birth (epoch[0] a fresh random epoch key, never a user-key generation),
8
- * and reads/writes are refused fail-closed until it does. `provisionWalletSpace`
9
- * (the crypto-free container ensure in `space`) declares the collections; this
10
- * EDV-bearing second step installs each one's epoch[0], wrapped to the user key
11
- * (recipient zero). It lives in `keys` rather than `space` so the root barrel,
12
- * which re-exports `space`, stays free of the EDV crypto graph -- the same
13
- * split was-client makes between `ensureSpaceAndCollection` and
14
- * `ensureFirstEpoch`.
8
+ * and reads/writes are refused fail-closed until it does.
9
+ * `provisionWalletSpace` (the crypto-free container ensure in `space`) creates
10
+ * the collections bare; this EDV-bearing second step is where each one is both
11
+ * DECLARED encrypted and given its epoch[0], wrapped to the user key
12
+ * (recipient zero). On a governed collection the install is the genesis of the
13
+ * collection's own history log -- one guarded create whose head state is the
14
+ * descriptor -- so the declaration and the first epoch land as one write. It
15
+ * lives in `keys` rather than `space` so the root barrel, which re-exports
16
+ * `space`, stays free of the EDV crypto graph -- the same split was-client
17
+ * makes between `ensureSpaceAndCollection` and `ensureFirstEpoch`.
18
+ *
19
+ * The install is store-shaped rather than handle-shaped: the caller supplies
20
+ * a `storeFor` lookup, exactly as the cascade's `CascadeCollections.storeFor`
21
+ * does, so the same fan-out drives a log-governed store and a
22
+ * Description-backed one with no branch here.
15
23
  *
16
24
  * The install is re-provisioning, never a content migration: `ensureFirstEpoch`
17
25
  * installs a fresh epoch[0] onto ANY epoch-less descriptor, with no check for
@@ -24,8 +32,8 @@
24
32
  * the supported answer for them, as it is for a pre-release keyring or recovery
25
33
  * record.
26
34
  */
27
- import type { Collection, CollectionEncryption, IZcap, WasClient } from '@interop/was-client';
28
- import { type RecipientPublicKey } from '@interop/was-client/edv';
35
+ import type { CollectionEncryption, WasClient } from '@interop/was-client';
36
+ import { type EncryptionDescriptorStore, type RecipientPublicKey } from '@interop/was-client/edv';
29
37
  import type { UserKey } from './userKey.js';
30
38
  /**
31
39
  * What the epoch[0] fan-out did, per collection id: the settled epoch-bearing
@@ -61,6 +69,13 @@ export interface WalletSpaceEpochsResult {
61
69
  * key, so an encrypted collection is indexable at birth: the HMAC key is minted
62
70
  * alongside the epoch and wrapped to the same initial recipients.
63
71
  *
72
+ * On a log-governed store this install IS the collection's governing-log
73
+ * genesis: the guarded create (`If-None-Match: *`) that both declares the
74
+ * Collection governed and lands the first epoch. A re-run over a log that
75
+ * already exists adopts its head untouched (`installed: false`), and a lost
76
+ * create race resolves the winner's descriptor the same way, so exactly one
77
+ * epoch[0] ever exists per collection.
78
+ *
64
79
  * The blinded-index key is installed at provisioning or never. A collection
65
80
  * provisioned before blind-index support carries an epoch roster with no `hmac`
66
81
  * member, and asking for one there is refused (`EncryptionError`); such a
@@ -69,8 +84,9 @@ export interface WalletSpaceEpochsResult {
69
84
  * rethrown unchanged.
70
85
  *
71
86
  * @param options {object}
72
- * @param options.collection {Collection} the (already declared encrypted)
73
- * collection whose Description hosts the descriptor
87
+ * @param options.store {EncryptionDescriptorStore} the collection's
88
+ * descriptor store -- the log-governed one
89
+ * (`collectionDescriptorLogStore`) on a governed collection
74
90
  * @param options.recipients {RecipientPublicKey[]} the initial readers'
75
91
  * public key-agreement keys, recipients of epoch[0] and of the blinded-index
76
92
  * key alike
@@ -78,8 +94,8 @@ export interface WalletSpaceEpochsResult {
78
94
  * the collection's epoch-bearing descriptor, and whether this call installed
79
95
  * its epoch[0]
80
96
  */
81
- export declare function ensureIndexedFirstEpoch({ collection, recipients }: {
82
- collection: Collection;
97
+ export declare function ensureIndexedFirstEpoch({ store, recipients }: {
98
+ store: EncryptionDescriptorStore;
83
99
  recipients: RecipientPublicKey[];
84
100
  }): Promise<{
85
101
  descriptor: CollectionEncryption;
@@ -92,9 +108,11 @@ export declare function ensureIndexedFirstEpoch({ collection, recipients }: {
92
108
  * `ensureIndexedFirstEpoch`: create-if-absent through the
93
109
  * descriptor-store seam, adopting (never overwriting) a roster another
94
110
  * provisioner already landed -- so re-running after a tear converges, and
95
- * exactly one epoch[0] ever exists per collection. Run it after
96
- * `provisionWalletSpace` has declared the collections; the wallet Space's
97
- * provisioning is complete only once both steps have.
111
+ * exactly one epoch[0] ever exists per collection. On a governed collection
112
+ * that install is also the DECLARATION: the genesis of the collection's own
113
+ * history log, from which the server derives its Description's `encryption`
114
+ * member. Run it after `provisionWalletSpace` has created the collections;
115
+ * the wallet Space's provisioning is complete only once both steps have.
98
116
  *
99
117
  * Run both steps from the sync engine's `ensureProvisioned` seam
100
118
  * ({@link walletSpaceProvisioner} builds that closure) or, for a driver of its
@@ -107,6 +125,18 @@ export declare function ensureIndexedFirstEpoch({ collection, recipients }: {
107
125
  * full re-run converges, since the collections that did settle are adopted
108
126
  * untouched.
109
127
  *
128
+ * **A verified-log refusal is a failure entry, carried verbatim.** A
129
+ * collection whose governing log is fabricated or forked
130
+ * (`isResourceLogRefusal`: a `ResourceLogIntegrityError`, or a
131
+ * `ResourceLogContinuityError` whose reason is not `rollback`) lands in
132
+ * `failed` like any other collection, but its `error` is the refusal itself
133
+ * rather than the wrapped per-collection message, so a caller reading the
134
+ * report tells it by `err.name`. The fan-out never throws for it: the
135
+ * collections that did settle are still reported (and still reach
136
+ * `walletSpaceProvisioner`'s `onSettled`), and the geneses' resumable-success
137
+ * contract holds. A retry against the same served log cannot help that one
138
+ * collection, and the report says so.
139
+ *
110
140
  * **Re-minting after adoption.** `installed: false` is not on its own the eager
111
141
  * minter's re-mint trigger: it is equally the steady state of every re-run,
112
142
  * where nothing changed. The returned `descriptor` is what matters -- an eager
@@ -131,8 +161,11 @@ export declare function ensureIndexedFirstEpoch({ collection, recipients }: {
131
161
  * login just adopted from the roster) runs ungated.
132
162
  *
133
163
  * @param options {object}
134
- * @param options.was {WasClient}
135
- * @param options.spaceId {string}
164
+ * @param options.storeFor {function} `(collectionId) =>
165
+ * EncryptionDescriptorStore` -- each collection's descriptor store, the
166
+ * same lookup shape the cascade's `CascadeCollections.storeFor` takes. The
167
+ * caller's wiring decides the authority every request rides and, on a
168
+ * governed collection, the log signer its genesis append is proved by
136
169
  * @param options.userKey {UserKey} the account's user key, epoch[0]'s one
137
170
  * initial recipient
138
171
  * @param [options.rosterDescriptor] {CollectionEncryption} the settled
@@ -141,22 +174,20 @@ export declare function ensureIndexedFirstEpoch({ collection, recipients }: {
141
174
  * @param [options.collectionIds] {string[]} the encrypted collections to
142
175
  * cover; defaults to the wallet Space roster's encrypted collections. A
143
176
  * caller naming its own ids (e.g. `contacts`) must name only collections
144
- * declared encrypted
145
- * @param [options.capability] {IZcap} an invocation capability attached to
146
- * every collection request (a delegated Space-subtree zcap -- the transient
147
- * session's generation delegation, for the tear heal on a promoted
148
- * ladder-anchored account); absent, requests invoke the root capability
177
+ * the wallet stores EDV envelopes in
178
+ * @param [options.spaceId] {string} the account Space id, named in the
179
+ * per-collection failure messages
149
180
  * @returns {Promise<WalletSpaceEpochsResult>} per collection id, the settled
150
181
  * descriptor and whether this call installed its epoch[0] (`false` means an
151
182
  * existing roster was adopted), plus the collections that failed
183
+ * @throws {TypeError} when `storeFor` is not a function, before any write
152
184
  */
153
- export declare function ensureWalletSpaceEpochs({ was, spaceId, userKey, rosterDescriptor, collectionIds, capability }: {
154
- was: WasClient;
155
- spaceId: string;
185
+ export declare function ensureWalletSpaceEpochs({ storeFor, userKey, rosterDescriptor, collectionIds, spaceId }: {
186
+ storeFor: (collectionId: string) => EncryptionDescriptorStore;
156
187
  userKey: UserKey;
157
188
  rosterDescriptor?: CollectionEncryption;
158
189
  collectionIds?: string[];
159
- capability?: IZcap;
190
+ spaceId?: string;
160
191
  }): Promise<WalletSpaceEpochsResult>;
161
192
  /**
162
193
  * Thrown by a {@link walletSpaceProvisioner} closure when the epoch[0] install
@@ -172,9 +203,10 @@ export declare class WalletSpaceProvisioningError extends Error {
172
203
  }
173
204
  /**
174
205
  * Builds the sync engine's `ensureProvisioned` closure for a wallet Space: the
175
- * provisioning two-step as one call -- `provisionWalletSpace` declares the
176
- * roster, then {@link ensureWalletSpaceEpochs} installs epoch[0] on every
177
- * encrypted collection -- with the memoization the engine adds on top.
206
+ * provisioning two-step as one call -- `provisionWalletSpace` creates the
207
+ * roster's collections, then {@link ensureWalletSpaceEpochs} declares each
208
+ * encrypted one and installs its epoch[0] -- with the memoization the engine
209
+ * adds on top.
178
210
  *
179
211
  * The closure is single-flight: one app runs one engine per synced
180
212
  * collection, and every engine's first cycle asks for the same provisioning,
@@ -199,22 +231,23 @@ export declare class WalletSpaceProvisioningError extends Error {
199
231
  * the Space does not exist yet
200
232
  * @param options.userKey {UserKey} the account's user key, epoch[0]'s one
201
233
  * initial recipient
234
+ * @param options.storeFor {function} `(collectionId) =>
235
+ * EncryptionDescriptorStore` -- each encrypted collection's descriptor
236
+ * store, threaded to {@link ensureWalletSpaceEpochs}
202
237
  * @param [options.collectionIds] {string[]} the encrypted collections to
203
238
  * cover; defaults to the wallet Space roster's encrypted collections
204
- * @param [options.capability] {IZcap} an invocation capability attached to
205
- * every epoch-install request (see {@link ensureWalletSpaceEpochs})
206
239
  * @param [options.onSettled] {function}
207
240
  * `(result: WalletSpaceEpochsResult) => void | Promise<void>`, called after
208
241
  * each run's epoch install with its report, before a partial run's refusal
209
242
  * @returns {() => Promise<void>} the engine's `ensureProvisioned` seam
210
243
  */
211
- export declare function walletSpaceProvisioner({ was, spaceId, controllerDid, userKey, collectionIds, capability, onSettled }: {
244
+ export declare function walletSpaceProvisioner({ was, spaceId, controllerDid, userKey, storeFor, collectionIds, onSettled }: {
212
245
  was: WasClient;
213
246
  spaceId: string;
214
247
  controllerDid: string;
215
248
  userKey: UserKey;
249
+ storeFor: (collectionId: string) => EncryptionDescriptorStore;
216
250
  collectionIds?: string[];
217
- capability?: IZcap;
218
251
  onSettled?: (result: WalletSpaceEpochsResult) => void | Promise<void>;
219
252
  }): () => Promise<void>;
220
253
  //# sourceMappingURL=spaceEpochs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spaceEpochs.d.ts","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,KAAK,EACL,SAAS,EACV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAKhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CACd,MAAM,EACN;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,oBAAoB,CAAA;KAAE,CACzD,CAAA;IACD,MAAM,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACvD;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,UAAU,EACV,UAAU,EACX,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,kBAAkB,EAAE,CAAA;CACjC,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,oBAAoB,CA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MAAM,KAAK,yBAAyB,CAAA;IAC7D,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2CnC;AAwBD;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAA;gBAC7B,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAA;KAAE;CAUtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,GAAG,EACH,OAAO,EACP,aAAa,EACb,OAAO,EACP,QAAQ,EACR,aAAa,EACb,SAAS,EACV,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,yBAAyB,CAAA;IAC7D,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAwBtB"}
@@ -1,4 +1,5 @@
1
1
  import { ensureFirstEpoch } from '@interop/was-client/edv';
2
+ import { isResourceLogRefusal } from '../resourceLog/errors.js';
2
3
  import { encryptedWalletCollectionIds } from '../space/collections.js';
3
4
  import { provisionWalletSpace } from '../space/provisioning.js';
4
5
  import { userKeyAsRecipient } from './userKeyCascade.js';
@@ -7,6 +8,13 @@ import { userKeyAsRecipient } from './userKeyCascade.js';
7
8
  * key, so an encrypted collection is indexable at birth: the HMAC key is minted
8
9
  * alongside the epoch and wrapped to the same initial recipients.
9
10
  *
11
+ * On a log-governed store this install IS the collection's governing-log
12
+ * genesis: the guarded create (`If-None-Match: *`) that both declares the
13
+ * Collection governed and lands the first epoch. A re-run over a log that
14
+ * already exists adopts its head untouched (`installed: false`), and a lost
15
+ * create race resolves the winner's descriptor the same way, so exactly one
16
+ * epoch[0] ever exists per collection.
17
+ *
10
18
  * The blinded-index key is installed at provisioning or never. A collection
11
19
  * provisioned before blind-index support carries an epoch roster with no `hmac`
12
20
  * member, and asking for one there is refused (`EncryptionError`); such a
@@ -15,8 +23,9 @@ import { userKeyAsRecipient } from './userKeyCascade.js';
15
23
  * rethrown unchanged.
16
24
  *
17
25
  * @param options {object}
18
- * @param options.collection {Collection} the (already declared encrypted)
19
- * collection whose Description hosts the descriptor
26
+ * @param options.store {EncryptionDescriptorStore} the collection's
27
+ * descriptor store -- the log-governed one
28
+ * (`collectionDescriptorLogStore`) on a governed collection
20
29
  * @param options.recipients {RecipientPublicKey[]} the initial readers'
21
30
  * public key-agreement keys, recipients of epoch[0] and of the blinded-index
22
31
  * key alike
@@ -24,10 +33,10 @@ import { userKeyAsRecipient } from './userKeyCascade.js';
24
33
  * the collection's epoch-bearing descriptor, and whether this call installed
25
34
  * its epoch[0]
26
35
  */
27
- export async function ensureIndexedFirstEpoch({ collection, recipients }) {
36
+ export async function ensureIndexedFirstEpoch({ store, recipients }) {
28
37
  try {
29
38
  return await ensureFirstEpoch({
30
- collection,
39
+ store,
31
40
  recipients,
32
41
  blindedIndex: true
33
42
  });
@@ -38,7 +47,7 @@ export async function ensureIndexedFirstEpoch({ collection, recipients }) {
38
47
  if (err?.name !== 'EncryptionError') {
39
48
  throw err;
40
49
  }
41
- return await ensureFirstEpoch({ collection, recipients });
50
+ return await ensureFirstEpoch({ store, recipients });
42
51
  }
43
52
  }
44
53
  /**
@@ -48,9 +57,11 @@ export async function ensureIndexedFirstEpoch({ collection, recipients }) {
48
57
  * `ensureIndexedFirstEpoch`: create-if-absent through the
49
58
  * descriptor-store seam, adopting (never overwriting) a roster another
50
59
  * provisioner already landed -- so re-running after a tear converges, and
51
- * exactly one epoch[0] ever exists per collection. Run it after
52
- * `provisionWalletSpace` has declared the collections; the wallet Space's
53
- * provisioning is complete only once both steps have.
60
+ * exactly one epoch[0] ever exists per collection. On a governed collection
61
+ * that install is also the DECLARATION: the genesis of the collection's own
62
+ * history log, from which the server derives its Description's `encryption`
63
+ * member. Run it after `provisionWalletSpace` has created the collections;
64
+ * the wallet Space's provisioning is complete only once both steps have.
54
65
  *
55
66
  * Run both steps from the sync engine's `ensureProvisioned` seam
56
67
  * ({@link walletSpaceProvisioner} builds that closure) or, for a driver of its
@@ -63,6 +74,18 @@ export async function ensureIndexedFirstEpoch({ collection, recipients }) {
63
74
  * full re-run converges, since the collections that did settle are adopted
64
75
  * untouched.
65
76
  *
77
+ * **A verified-log refusal is a failure entry, carried verbatim.** A
78
+ * collection whose governing log is fabricated or forked
79
+ * (`isResourceLogRefusal`: a `ResourceLogIntegrityError`, or a
80
+ * `ResourceLogContinuityError` whose reason is not `rollback`) lands in
81
+ * `failed` like any other collection, but its `error` is the refusal itself
82
+ * rather than the wrapped per-collection message, so a caller reading the
83
+ * report tells it by `err.name`. The fan-out never throws for it: the
84
+ * collections that did settle are still reported (and still reach
85
+ * `walletSpaceProvisioner`'s `onSettled`), and the geneses' resumable-success
86
+ * contract holds. A retry against the same served log cannot help that one
87
+ * collection, and the report says so.
88
+ *
66
89
  * **Re-minting after adoption.** `installed: false` is not on its own the eager
67
90
  * minter's re-mint trigger: it is equally the steady state of every re-run,
68
91
  * where nothing changed. The returned `descriptor` is what matters -- an eager
@@ -87,8 +110,11 @@ export async function ensureIndexedFirstEpoch({ collection, recipients }) {
87
110
  * login just adopted from the roster) runs ungated.
88
111
  *
89
112
  * @param options {object}
90
- * @param options.was {WasClient}
91
- * @param options.spaceId {string}
113
+ * @param options.storeFor {function} `(collectionId) =>
114
+ * EncryptionDescriptorStore` -- each collection's descriptor store, the
115
+ * same lookup shape the cascade's `CascadeCollections.storeFor` takes. The
116
+ * caller's wiring decides the authority every request rides and, on a
117
+ * governed collection, the log signer its genesis append is proved by
92
118
  * @param options.userKey {UserKey} the account's user key, epoch[0]'s one
93
119
  * initial recipient
94
120
  * @param [options.rosterDescriptor] {CollectionEncryption} the settled
@@ -97,16 +123,16 @@ export async function ensureIndexedFirstEpoch({ collection, recipients }) {
97
123
  * @param [options.collectionIds] {string[]} the encrypted collections to
98
124
  * cover; defaults to the wallet Space roster's encrypted collections. A
99
125
  * caller naming its own ids (e.g. `contacts`) must name only collections
100
- * declared encrypted
101
- * @param [options.capability] {IZcap} an invocation capability attached to
102
- * every collection request (a delegated Space-subtree zcap -- the transient
103
- * session's generation delegation, for the tear heal on a promoted
104
- * ladder-anchored account); absent, requests invoke the root capability
126
+ * the wallet stores EDV envelopes in
127
+ * @param [options.spaceId] {string} the account Space id, named in the
128
+ * per-collection failure messages
105
129
  * @returns {Promise<WalletSpaceEpochsResult>} per collection id, the settled
106
130
  * descriptor and whether this call installed its epoch[0] (`false` means an
107
131
  * existing roster was adopted), plus the collections that failed
132
+ * @throws {TypeError} when `storeFor` is not a function, before any write
108
133
  */
109
- export async function ensureWalletSpaceEpochs({ was, spaceId, userKey, rosterDescriptor, collectionIds, capability }) {
134
+ export async function ensureWalletSpaceEpochs({ storeFor, userKey, rosterDescriptor, collectionIds, spaceId }) {
135
+ assertStoreFor(storeFor);
110
136
  if (rosterDescriptor && rosterDescriptor.currentEpoch !== userKey.id) {
111
137
  return {
112
138
  outcomes: {},
@@ -122,23 +148,45 @@ export async function ensureWalletSpaceEpochs({ was, spaceId, userKey, rosterDes
122
148
  await Promise.all(ids.map(async (collectionId) => {
123
149
  try {
124
150
  const { installed, descriptor } = await ensureIndexedFirstEpoch({
125
- collection: was
126
- .space(spaceId, { capability })
127
- .collection(collectionId),
151
+ store: storeFor(collectionId),
128
152
  recipients: [userKeyAsRecipient({ userKey })]
129
153
  });
130
154
  outcomes[collectionId] = { installed, descriptor };
131
155
  }
132
156
  catch (err) {
157
+ if (isResourceLogRefusal(err)) {
158
+ // Verbatim, so the report carries the refusal's own `name`.
159
+ failed.push({ collectionId, error: err });
160
+ return;
161
+ }
133
162
  failed.push({
134
163
  collectionId,
135
164
  error: new Error(`Error installing the first key epoch for collection ` +
136
- `"${collectionId}" in space "${spaceId}".`, { cause: err })
165
+ `"${collectionId}"` +
166
+ (spaceId === undefined ? '' : ` in space "${spaceId}"`) +
167
+ '.', { cause: err })
137
168
  });
138
169
  }
139
170
  }));
140
171
  return { outcomes, failed };
141
172
  }
173
+ /**
174
+ * Refuses a missing store lookup with a synchronous `TypeError`, the way the
175
+ * geneses and the mend refuse a missing `collectionStoreFor`: a caller on the
176
+ * former handle-shaped signature would otherwise see every collection land in
177
+ * `failed` and a resolving call, which an app that stamps its profile
178
+ * provisioned on return would never re-run.
179
+ *
180
+ * @param storeFor {unknown}
181
+ * @returns {void}
182
+ */
183
+ function assertStoreFor(storeFor) {
184
+ if (typeof storeFor !== 'function') {
185
+ throw new TypeError('ensureWalletSpaceEpochs requires storeFor: ' +
186
+ '(collectionId) => EncryptionDescriptorStore, each encrypted ' +
187
+ "collection's descriptor store.");
188
+ }
189
+ }
142
190
  /**
143
191
  * Thrown by a {@link walletSpaceProvisioner} closure when the epoch[0] install
144
192
  * left any collection behind: the collections that did settle are adopted, and
@@ -158,9 +206,10 @@ export class WalletSpaceProvisioningError extends Error {
158
206
  }
159
207
  /**
160
208
  * Builds the sync engine's `ensureProvisioned` closure for a wallet Space: the
161
- * provisioning two-step as one call -- `provisionWalletSpace` declares the
162
- * roster, then {@link ensureWalletSpaceEpochs} installs epoch[0] on every
163
- * encrypted collection -- with the memoization the engine adds on top.
209
+ * provisioning two-step as one call -- `provisionWalletSpace` creates the
210
+ * roster's collections, then {@link ensureWalletSpaceEpochs} declares each
211
+ * encrypted one and installs its epoch[0] -- with the memoization the engine
212
+ * adds on top.
164
213
  *
165
214
  * The closure is single-flight: one app runs one engine per synced
166
215
  * collection, and every engine's first cycle asks for the same provisioning,
@@ -185,25 +234,26 @@ export class WalletSpaceProvisioningError extends Error {
185
234
  * the Space does not exist yet
186
235
  * @param options.userKey {UserKey} the account's user key, epoch[0]'s one
187
236
  * initial recipient
237
+ * @param options.storeFor {function} `(collectionId) =>
238
+ * EncryptionDescriptorStore` -- each encrypted collection's descriptor
239
+ * store, threaded to {@link ensureWalletSpaceEpochs}
188
240
  * @param [options.collectionIds] {string[]} the encrypted collections to
189
241
  * cover; defaults to the wallet Space roster's encrypted collections
190
- * @param [options.capability] {IZcap} an invocation capability attached to
191
- * every epoch-install request (see {@link ensureWalletSpaceEpochs})
192
242
  * @param [options.onSettled] {function}
193
243
  * `(result: WalletSpaceEpochsResult) => void | Promise<void>`, called after
194
244
  * each run's epoch install with its report, before a partial run's refusal
195
245
  * @returns {() => Promise<void>} the engine's `ensureProvisioned` seam
196
246
  */
197
- export function walletSpaceProvisioner({ was, spaceId, controllerDid, userKey, collectionIds, capability, onSettled }) {
247
+ export function walletSpaceProvisioner({ was, spaceId, controllerDid, userKey, storeFor, collectionIds, onSettled }) {
248
+ assertStoreFor(storeFor);
198
249
  let inFlight = null;
199
250
  const run = async () => {
200
251
  await provisionWalletSpace({ was, spaceId, controllerDid });
201
252
  const result = await ensureWalletSpaceEpochs({
202
- was,
203
- spaceId,
253
+ storeFor,
204
254
  userKey,
205
- collectionIds,
206
- capability
255
+ spaceId,
256
+ collectionIds
207
257
  });
208
258
  await onSettled?.(result);
209
259
  if (result.failed.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"spaceEpochs.js","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"AAgCA,OAAO,EACL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,oBAA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C;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAA;AACH,CAAC"}
@@ -36,6 +36,7 @@
36
36
  import type { IKeyAgreementKey } from '@interop/data-integrity-core';
37
37
  import type { CollectionEncryption } from '@interop/was-client';
38
38
  import { type EncryptionDescriptorStore, type RecipientPublicKey } from '@interop/was-client/edv';
39
+ import type { WebvhResourceLogController } from '../resourceLog/index.js';
39
40
  import { type UserKey } from './userKey.js';
40
41
  /**
41
42
  * A user key presented as an epoch-roster recipient: the kid is the
@@ -145,6 +146,20 @@ export interface UserKeyCascadeResult {
145
146
  * standing backstop, and the staleness rule makes a naive full re-run
146
147
  * converge with zero redundant epochs).
147
148
  *
149
+ * **A verified-log refusal is a failure entry, carried verbatim.** A
150
+ * collection whose governing log is fabricated or forked
151
+ * ({@link isResourceLogRefusal}: a `ResourceLogIntegrityError`, or a
152
+ * `ResourceLogContinuityError` whose reason is not `rollback`) lands in
153
+ * `failed` like any other collection, with the refusal as its `error`
154
+ * unwrapped, so a caller reading the report can tell it by `err.name`. The
155
+ * fan-out never throws for it: every caller here is a ceremony past its pivot
156
+ * (a client revoked, a credential retired, a client forgotten), whose later
157
+ * stages -- the generation delegation re-mint, the session's adoption of the
158
+ * fresh key -- must still run, and whose contract is that a fan-out failure
159
+ * is a resumable success. A retry against the same served log cannot help
160
+ * that one collection, and the report says so; it must not cost the account
161
+ * the stages that follow.
162
+ *
148
163
  * @param options {object}
149
164
  * @param options.collectionIds {string[]} the encrypted collections to
150
165
  * cover, deduplicated by the caller
@@ -159,14 +174,24 @@ export interface UserKeyCascadeResult {
159
174
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
160
175
  * (identity) key-agreement key, unwrapping the generations
161
176
  * @param options.userKey {UserKey} the roster's current user key
177
+ * @param [options.controller] {WebvhResourceLogController} the ceremony's
178
+ * post-edit controller view, set as each log-governed collection store's
179
+ * minimum controller version before that collection's first append. A
180
+ * collection's governing log takes the same post-edit anchoring the roster
181
+ * log does: a store resolving a stale cached view would anchor its rotation
182
+ * before the document edit, so a ladder-signed append would be refused and
183
+ * a no-op rotation's seal would be blind to the membership change. Absent
184
+ * (a caller with no post-edit log in hand -- the login sweep), the injected
185
+ * resolver's own freshness is what the appends anchor at
162
186
  * @returns {Promise<UserKeyCascadeResult>}
163
187
  */
164
- export declare function cascadeCollectionsToUserKey({ collectionIds, storeFor, isEncrypted, rosterDescriptor, clientKeyAgreementKey, userKey }: {
188
+ export declare function cascadeCollectionsToUserKey({ collectionIds, storeFor, isEncrypted, rosterDescriptor, clientKeyAgreementKey, userKey, controller }: {
165
189
  collectionIds: string[];
166
190
  storeFor: (collectionId: string) => EncryptionDescriptorStore;
167
191
  isEncrypted?: (collectionId: string) => Promise<boolean>;
168
192
  rosterDescriptor: CollectionEncryption;
169
193
  clientKeyAgreementKey: IKeyAgreementKey;
170
194
  userKey: UserKey;
195
+ controller?: WebvhResourceLogController;
171
196
  }): Promise<UserKeyCascadeResult>;
172
197
  //# sourceMappingURL=userKeyCascade.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAML,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,kBAAkB,CAKrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAAC,EAC7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,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAA;IAC1D,MAAM,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,2BAA2B,CAAC,EAChD,aAAa,EACb,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,OAAO,EACP,UAAU,EACX,EAAE;IACD,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,yBAAyB,CAAA;IAC7D,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACxD,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,0BAA0B,CAAA;CACxC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4BhC"}
@@ -176,6 +176,20 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
176
176
  * standing backstop, and the staleness rule makes a naive full re-run
177
177
  * converge with zero redundant epochs).
178
178
  *
179
+ * **A verified-log refusal is a failure entry, carried verbatim.** A
180
+ * collection whose governing log is fabricated or forked
181
+ * ({@link isResourceLogRefusal}: a `ResourceLogIntegrityError`, or a
182
+ * `ResourceLogContinuityError` whose reason is not `rollback`) lands in
183
+ * `failed` like any other collection, with the refusal as its `error`
184
+ * unwrapped, so a caller reading the report can tell it by `err.name`. The
185
+ * fan-out never throws for it: every caller here is a ceremony past its pivot
186
+ * (a client revoked, a credential retired, a client forgotten), whose later
187
+ * stages -- the generation delegation re-mint, the session's adoption of the
188
+ * fresh key -- must still run, and whose contract is that a fan-out failure
189
+ * is a resumable success. A retry against the same served log cannot help
190
+ * that one collection, and the report says so; it must not cost the account
191
+ * the stages that follow.
192
+ *
179
193
  * @param options {object}
180
194
  * @param options.collectionIds {string[]} the encrypted collections to
181
195
  * cover, deduplicated by the caller
@@ -190,9 +204,18 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
190
204
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
191
205
  * (identity) key-agreement key, unwrapping the generations
192
206
  * @param options.userKey {UserKey} the roster's current user key
207
+ * @param [options.controller] {WebvhResourceLogController} the ceremony's
208
+ * post-edit controller view, set as each log-governed collection store's
209
+ * minimum controller version before that collection's first append. A
210
+ * collection's governing log takes the same post-edit anchoring the roster
211
+ * log does: a store resolving a stale cached view would anchor its rotation
212
+ * before the document edit, so a ladder-signed append would be refused and
213
+ * a no-op rotation's seal would be blind to the membership change. Absent
214
+ * (a caller with no post-edit log in hand -- the login sweep), the injected
215
+ * resolver's own freshness is what the appends anchor at
193
216
  * @returns {Promise<UserKeyCascadeResult>}
194
217
  */
195
- export async function cascadeCollectionsToUserKey({ collectionIds, storeFor, isEncrypted, rosterDescriptor, clientKeyAgreementKey, userKey }) {
218
+ export async function cascadeCollectionsToUserKey({ collectionIds, storeFor, isEncrypted, rosterDescriptor, clientKeyAgreementKey, userKey, controller }) {
196
219
  const generations = await unwrapUserKeyGenerations({
197
220
  descriptor: rosterDescriptor,
198
221
  clientKeyAgreementKey
@@ -204,8 +227,12 @@ export async function cascadeCollectionsToUserKey({ collectionIds, storeFor, isE
204
227
  if (isEncrypted && !(await isEncrypted(collectionId))) {
205
228
  return;
206
229
  }
230
+ const store = storeFor(collectionId);
231
+ if (controller !== undefined && isSealableDescriptorStore(store)) {
232
+ store.setMinimumControllerVersion({ controller });
233
+ }
207
234
  outcomes[collectionId] = await rotateCollectionEpochsToUserKey({
208
- store: storeFor(collectionId),
235
+ store,
209
236
  userKey,
210
237
  generations
211
238
  });
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.js","s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