@interop/wallet-core 0.62.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/README.md +41 -16
  2. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +46 -26
  3. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  4. package/dist/clientAnnex/credentialAnchoredGenesis.js +91 -39
  5. package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
  6. package/dist/clientAnnex/establish.d.ts +119 -35
  7. package/dist/clientAnnex/establish.d.ts.map +1 -1
  8. package/dist/clientAnnex/establish.js +227 -160
  9. package/dist/clientAnnex/establish.js.map +1 -1
  10. package/dist/clientAnnex/forget.d.ts +18 -8
  11. package/dist/clientAnnex/forget.d.ts.map +1 -1
  12. package/dist/clientAnnex/forget.js +37 -64
  13. package/dist/clientAnnex/forget.js.map +1 -1
  14. package/dist/clientAnnex/forgetLast.d.ts +85 -38
  15. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  16. package/dist/clientAnnex/forgetLast.js +155 -98
  17. package/dist/clientAnnex/forgetLast.js.map +1 -1
  18. package/dist/clientAnnex/gc.d.ts +3 -2
  19. package/dist/clientAnnex/gc.d.ts.map +1 -1
  20. package/dist/clientAnnex/gc.js +16 -7
  21. package/dist/clientAnnex/gc.js.map +1 -1
  22. package/dist/clientAnnex/heal.d.ts +65 -14
  23. package/dist/clientAnnex/heal.d.ts.map +1 -1
  24. package/dist/clientAnnex/heal.js +397 -298
  25. package/dist/clientAnnex/heal.js.map +1 -1
  26. package/dist/clientAnnex/index.d.ts +23 -7
  27. package/dist/clientAnnex/index.d.ts.map +1 -1
  28. package/dist/clientAnnex/index.js +26 -7
  29. package/dist/clientAnnex/index.js.map +1 -1
  30. package/dist/clientAnnex/ladder.d.ts +58 -0
  31. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  32. package/dist/clientAnnex/ladder.js +249 -41
  33. package/dist/clientAnnex/ladder.js.map +1 -1
  34. package/dist/clientAnnex/ladderAnchored.d.ts +148 -22
  35. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  36. package/dist/clientAnnex/ladderAnchored.js +391 -346
  37. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  38. package/dist/clientAnnex/log.d.ts +237 -53
  39. package/dist/clientAnnex/log.d.ts.map +1 -1
  40. package/dist/clientAnnex/log.js +533 -198
  41. package/dist/clientAnnex/log.js.map +1 -1
  42. package/dist/clientAnnex/mend.d.ts +12 -6
  43. package/dist/clientAnnex/mend.d.ts.map +1 -1
  44. package/dist/clientAnnex/mend.js +44 -72
  45. package/dist/clientAnnex/mend.js.map +1 -1
  46. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +6 -4
  47. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  48. package/dist/clientAnnex/recoveryLadderAnchored.js +56 -35
  49. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  50. package/dist/clientAnnex/spaceCapability.d.ts +123 -0
  51. package/dist/clientAnnex/spaceCapability.d.ts.map +1 -0
  52. package/dist/clientAnnex/spaceCapability.js +152 -0
  53. package/dist/clientAnnex/spaceCapability.js.map +1 -0
  54. package/dist/clientAnnex/stages.d.ts +63 -0
  55. package/dist/clientAnnex/stages.d.ts.map +1 -0
  56. package/dist/clientAnnex/stages.js +64 -0
  57. package/dist/clientAnnex/stages.js.map +1 -0
  58. package/dist/clientAnnex/zcap.d.ts +1 -1
  59. package/dist/clientAnnex/zcap.d.ts.map +1 -1
  60. package/dist/clientAnnex/zcap.js +42 -35
  61. package/dist/clientAnnex/zcap.js.map +1 -1
  62. package/dist/clients/policy.d.ts +15 -1
  63. package/dist/clients/policy.d.ts.map +1 -1
  64. package/dist/clients/policy.js +12 -6
  65. package/dist/clients/policy.js.map +1 -1
  66. package/dist/clients/revocation.d.ts +18 -10
  67. package/dist/clients/revocation.d.ts.map +1 -1
  68. package/dist/clients/revocation.js +13 -5
  69. package/dist/clients/revocation.js.map +1 -1
  70. package/dist/clients/rosterPolicy.d.ts +10 -2
  71. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  72. package/dist/clients/rosterPolicy.js +41 -24
  73. package/dist/clients/rosterPolicy.js.map +1 -1
  74. package/dist/descriptors/acquire.d.ts.map +1 -1
  75. package/dist/descriptors/acquire.js +6 -23
  76. package/dist/descriptors/acquire.js.map +1 -1
  77. package/dist/descriptors/cipher.d.ts.map +1 -1
  78. package/dist/descriptors/cipher.js +5 -0
  79. package/dist/descriptors/cipher.js.map +1 -1
  80. package/dist/descriptors/errors.d.ts +43 -0
  81. package/dist/descriptors/errors.d.ts.map +1 -0
  82. package/dist/descriptors/errors.js +45 -0
  83. package/dist/descriptors/errors.js.map +1 -0
  84. package/dist/descriptors/index.d.ts +5 -0
  85. package/dist/descriptors/index.d.ts.map +1 -1
  86. package/dist/descriptors/index.js +5 -0
  87. package/dist/descriptors/index.js.map +1 -1
  88. package/dist/enrollment/enrollment.d.ts +37 -10
  89. package/dist/enrollment/enrollment.d.ts.map +1 -1
  90. package/dist/enrollment/enrollment.js +52 -15
  91. package/dist/enrollment/enrollment.js.map +1 -1
  92. package/dist/genesis/accountGenesis.d.ts +42 -11
  93. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  94. package/dist/genesis/accountGenesis.js +80 -22
  95. package/dist/genesis/accountGenesis.js.map +1 -1
  96. package/dist/genesis/index.d.ts +3 -1
  97. package/dist/genesis/index.d.ts.map +1 -1
  98. package/dist/genesis/index.js +3 -1
  99. package/dist/genesis/index.js.map +1 -1
  100. package/dist/identity/agents.d.ts +17 -1
  101. package/dist/identity/agents.d.ts.map +1 -1
  102. package/dist/identity/agents.js +23 -7
  103. package/dist/identity/agents.js.map +1 -1
  104. package/dist/identity/index.d.ts +3 -1
  105. package/dist/identity/index.d.ts.map +1 -1
  106. package/dist/identity/index.js +3 -1
  107. package/dist/identity/index.js.map +1 -1
  108. package/dist/index.d.ts +6 -3
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +6 -3
  111. package/dist/index.js.map +1 -1
  112. package/dist/keyring/index.d.ts +2 -1
  113. package/dist/keyring/index.d.ts.map +1 -1
  114. package/dist/keyring/index.js +2 -1
  115. package/dist/keyring/index.js.map +1 -1
  116. package/dist/keyring/record.d.ts.map +1 -1
  117. package/dist/keyring/record.js +3 -6
  118. package/dist/keyring/record.js.map +1 -1
  119. package/dist/keyring/unlockSpace.d.ts +14 -5
  120. package/dist/keyring/unlockSpace.d.ts.map +1 -1
  121. package/dist/keyring/unlockSpace.js +31 -36
  122. package/dist/keyring/unlockSpace.js.map +1 -1
  123. package/dist/keys/index.d.ts +22 -8
  124. package/dist/keys/index.d.ts.map +1 -1
  125. package/dist/keys/index.js +20 -6
  126. package/dist/keys/index.js.map +1 -1
  127. package/dist/keys/rosterLogStore.d.ts +15 -12
  128. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  129. package/dist/keys/rosterLogStore.js +21 -16
  130. package/dist/keys/rosterLogStore.js.map +1 -1
  131. package/dist/keys/rosterStore.d.ts +3 -6
  132. package/dist/keys/rosterStore.d.ts.map +1 -1
  133. package/dist/keys/rosterStore.js +10 -9
  134. package/dist/keys/rosterStore.js.map +1 -1
  135. package/dist/keys/spaceEpochs.d.ts.map +1 -1
  136. package/dist/keys/spaceEpochs.js +2 -3
  137. package/dist/keys/spaceEpochs.js.map +1 -1
  138. package/dist/keys/userKeyCascade.d.ts +8 -5
  139. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  140. package/dist/keys/userKeyCascade.js +7 -6
  141. package/dist/keys/userKeyCascade.js.map +1 -1
  142. package/dist/keys/userKeyRoster.d.ts +95 -8
  143. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  144. package/dist/keys/userKeyRoster.js +278 -35
  145. package/dist/keys/userKeyRoster.js.map +1 -1
  146. package/dist/keys/userKeyRosterCascade.d.ts +117 -16
  147. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  148. package/dist/keys/userKeyRosterCascade.js +184 -43
  149. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  150. package/dist/keys/wasLabelsStore.d.ts +9 -2
  151. package/dist/keys/wasLabelsStore.d.ts.map +1 -1
  152. package/dist/keys/wasLabelsStore.js +14 -6
  153. package/dist/keys/wasLabelsStore.js.map +1 -1
  154. package/dist/log.d.ts +7 -2
  155. package/dist/log.d.ts.map +1 -1
  156. package/dist/log.js +6 -1
  157. package/dist/log.js.map +1 -1
  158. package/dist/recovery/index.d.ts +13 -9
  159. package/dist/recovery/index.d.ts.map +1 -1
  160. package/dist/recovery/index.js +12 -8
  161. package/dist/recovery/index.js.map +1 -1
  162. package/dist/recovery/recoveryCode.d.ts +27 -7
  163. package/dist/recovery/recoveryCode.d.ts.map +1 -1
  164. package/dist/recovery/recoveryCode.js +18 -6
  165. package/dist/recovery/recoveryCode.js.map +1 -1
  166. package/dist/recovery/recoveryDelegation.d.ts +23 -0
  167. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  168. package/dist/recovery/recoveryDelegation.js +66 -46
  169. package/dist/recovery/recoveryDelegation.js.map +1 -1
  170. package/dist/recovery/recoveryWebvh.d.ts +75 -63
  171. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  172. package/dist/recovery/recoveryWebvh.js +127 -116
  173. package/dist/recovery/recoveryWebvh.js.map +1 -1
  174. package/dist/request/appKey.d.ts +35 -1
  175. package/dist/request/appKey.d.ts.map +1 -1
  176. package/dist/request/appKey.js +29 -10
  177. package/dist/request/appKey.js.map +1 -1
  178. package/dist/request/classify.d.ts +32 -8
  179. package/dist/request/classify.d.ts.map +1 -1
  180. package/dist/request/classify.js +39 -14
  181. package/dist/request/classify.js.map +1 -1
  182. package/dist/request/ephemeralExchange.d.ts +1 -6
  183. package/dist/request/ephemeralExchange.d.ts.map +1 -1
  184. package/dist/request/ephemeralExchange.js.map +1 -1
  185. package/dist/request/onboarding.d.ts.map +1 -1
  186. package/dist/request/onboarding.js +2 -2
  187. package/dist/request/onboarding.js.map +1 -1
  188. package/dist/request/parse.d.ts.map +1 -1
  189. package/dist/request/parse.js +2 -3
  190. package/dist/request/parse.js.map +1 -1
  191. package/dist/resourceLog/controller.d.ts +34 -12
  192. package/dist/resourceLog/controller.d.ts.map +1 -1
  193. package/dist/resourceLog/controller.js +79 -86
  194. package/dist/resourceLog/controller.js.map +1 -1
  195. package/dist/resourceLog/document.d.ts +182 -0
  196. package/dist/resourceLog/document.d.ts.map +1 -0
  197. package/dist/resourceLog/document.js +159 -0
  198. package/dist/resourceLog/document.js.map +1 -0
  199. package/dist/resourceLog/errors.d.ts +47 -8
  200. package/dist/resourceLog/errors.d.ts.map +1 -1
  201. package/dist/resourceLog/errors.js +54 -8
  202. package/dist/resourceLog/errors.js.map +1 -1
  203. package/dist/resourceLog/index.d.ts +7 -3
  204. package/dist/resourceLog/index.d.ts.map +1 -1
  205. package/dist/resourceLog/index.js +7 -3
  206. package/dist/resourceLog/index.js.map +1 -1
  207. package/dist/resourceLog/ladderRungs.d.ts +35 -0
  208. package/dist/resourceLog/ladderRungs.d.ts.map +1 -0
  209. package/dist/resourceLog/ladderRungs.js +352 -0
  210. package/dist/resourceLog/ladderRungs.js.map +1 -0
  211. package/dist/resourceLog/license.d.ts +42 -17
  212. package/dist/resourceLog/license.d.ts.map +1 -1
  213. package/dist/resourceLog/license.js +38 -24
  214. package/dist/resourceLog/license.js.map +1 -1
  215. package/dist/space/activity.d.ts +15 -15
  216. package/dist/space/activity.d.ts.map +1 -1
  217. package/dist/space/activity.js +15 -15
  218. package/dist/space/activity.js.map +1 -1
  219. package/dist/space/collections.d.ts +11 -0
  220. package/dist/space/collections.d.ts.map +1 -1
  221. package/dist/space/collections.js +13 -0
  222. package/dist/space/collections.js.map +1 -1
  223. package/dist/space/deleteSpace.d.ts +28 -0
  224. package/dist/space/deleteSpace.d.ts.map +1 -0
  225. package/dist/space/deleteSpace.js +44 -0
  226. package/dist/space/deleteSpace.js.map +1 -0
  227. package/dist/space/errors.d.ts.map +1 -1
  228. package/dist/space/errors.js +0 -1
  229. package/dist/space/errors.js.map +1 -1
  230. package/dist/space/index.d.ts +6 -0
  231. package/dist/space/index.d.ts.map +1 -1
  232. package/dist/space/index.js +6 -0
  233. package/dist/space/index.js.map +1 -1
  234. package/dist/space/plaintextCollection.d.ts +43 -0
  235. package/dist/space/plaintextCollection.d.ts.map +1 -0
  236. package/dist/space/plaintextCollection.js +17 -0
  237. package/dist/space/plaintextCollection.js.map +1 -0
  238. package/dist/stages.d.ts +23 -0
  239. package/dist/stages.d.ts.map +1 -0
  240. package/dist/stages.js +23 -0
  241. package/dist/stages.js.map +1 -0
  242. package/dist/sync/index.d.ts +7 -0
  243. package/dist/sync/index.d.ts.map +1 -1
  244. package/dist/sync/index.js +7 -0
  245. package/dist/sync/index.js.map +1 -1
  246. package/dist/sync/push.js +4 -4
  247. package/dist/sync/push.js.map +1 -1
  248. package/dist/sync/remint.js +2 -2
  249. package/dist/sync/remint.js.map +1 -1
  250. package/dist/sync/types.d.ts +41 -1
  251. package/dist/sync/types.d.ts.map +1 -1
  252. package/dist/sync/types.js +47 -1
  253. package/dist/sync/types.js.map +1 -1
  254. package/dist/unlock/index.d.ts +5 -1
  255. package/dist/unlock/index.d.ts.map +1 -1
  256. package/dist/unlock/index.js +5 -1
  257. package/dist/unlock/index.js.map +1 -1
  258. package/dist/unlock/retire.d.ts +35 -7
  259. package/dist/unlock/retire.d.ts.map +1 -1
  260. package/dist/unlock/retire.js +52 -14
  261. package/dist/unlock/retire.js.map +1 -1
  262. package/dist/unlock/standingClient.d.ts.map +1 -1
  263. package/dist/unlock/standingClient.js +5 -1
  264. package/dist/unlock/standingClient.js.map +1 -1
  265. package/dist/unlock/standingWebvh.d.ts +217 -35
  266. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  267. package/dist/unlock/standingWebvh.js +469 -210
  268. package/dist/unlock/standingWebvh.js.map +1 -1
  269. package/dist/webvh/accountEntry.d.ts +146 -0
  270. package/dist/webvh/accountEntry.d.ts.map +1 -0
  271. package/dist/webvh/accountEntry.js +239 -0
  272. package/dist/webvh/accountEntry.js.map +1 -0
  273. package/dist/webvh/didWeb.d.ts +12 -7
  274. package/dist/webvh/didWeb.d.ts.map +1 -1
  275. package/dist/webvh/didWeb.js +2 -2
  276. package/dist/webvh/didWeb.js.map +1 -1
  277. package/dist/webvh/didWebProjection.d.ts +164 -0
  278. package/dist/webvh/didWebProjection.d.ts.map +1 -0
  279. package/dist/webvh/didWebProjection.js +230 -0
  280. package/dist/webvh/didWebProjection.js.map +1 -0
  281. package/dist/webvh/didWebvh.d.ts +275 -136
  282. package/dist/webvh/didWebvh.d.ts.map +1 -1
  283. package/dist/webvh/didWebvh.js +307 -340
  284. package/dist/webvh/didWebvh.js.map +1 -1
  285. package/dist/webvh/enrollClient.d.ts +65 -0
  286. package/dist/webvh/enrollClient.d.ts.map +1 -0
  287. package/dist/webvh/enrollClient.js +172 -0
  288. package/dist/webvh/enrollClient.js.map +1 -0
  289. package/dist/webvh/index.d.ts +37 -12
  290. package/dist/webvh/index.d.ts.map +1 -1
  291. package/dist/webvh/index.js +33 -10
  292. package/dist/webvh/index.js.map +1 -1
  293. package/dist/webvh/listClients.d.ts +1 -35
  294. package/dist/webvh/listClients.d.ts.map +1 -1
  295. package/dist/webvh/listClients.js +2 -30
  296. package/dist/webvh/listClients.js.map +1 -1
  297. package/dist/webvh/revokeClient.d.ts +41 -11
  298. package/dist/webvh/revokeClient.d.ts.map +1 -1
  299. package/dist/webvh/revokeClient.js +99 -48
  300. package/dist/webvh/revokeClient.js.map +1 -1
  301. package/dist/webvh/standingZcap.d.ts +61 -14
  302. package/dist/webvh/standingZcap.d.ts.map +1 -1
  303. package/dist/webvh/standingZcap.js +91 -0
  304. package/dist/webvh/standingZcap.js.map +1 -1
  305. package/dist/webvh/verifyLog.d.ts +59 -5
  306. package/dist/webvh/verifyLog.d.ts.map +1 -1
  307. package/dist/webvh/verifyLog.js +76 -11
  308. package/dist/webvh/verifyLog.js.map +1 -1
  309. package/dist/webvh/wasIdStore.d.ts +8 -8
  310. package/dist/webvh/wasIdStore.d.ts.map +1 -1
  311. package/dist/webvh/wasIdStore.js +39 -14
  312. package/dist/webvh/wasIdStore.js.map +1 -1
  313. package/dist/webvh/zcap.d.ts +14 -1
  314. package/dist/webvh/zcap.d.ts.map +1 -1
  315. package/dist/webvh/zcap.js +3 -27
  316. package/dist/webvh/zcap.js.map +1 -1
  317. package/package.json +2 -2
  318. package/dist/webvh/keyAgreement.d.ts +0 -97
  319. package/dist/webvh/keyAgreement.d.ts.map +0 -1
  320. package/dist/webvh/keyAgreement.js +0 -71
  321. package/dist/webvh/keyAgreement.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { webvhResourceLogController } from '../resourceLog/index.js';
2
2
  import { cascadeCollectionsToUserKey } from './userKeyCascade.js';
3
3
  import { isSealableDescriptorStore } from './rosterLogStore.js';
4
- import { convergeUserKeyRosterToDocument, readUserKeyRoster } from './userKeyRoster.js';
4
+ import { convergeUserKeyRosterToDocument, readUserKeyRoster, rosterWrapsRecipient, rotateUserKeyRoster } from './userKeyRoster.js';
5
5
  /**
6
6
  * Resolves the collection ids the fan-out covers, whether they are a fixed set
7
7
  * or a listing the app performs.
@@ -16,6 +16,94 @@ async function collectionIdsOf({ collections }) {
16
16
  ? await collectionIds()
17
17
  : collectionIds;
18
18
  }
19
+ /**
20
+ * The post-edit anchoring guarantee, shared by both entry points: the roster
21
+ * appends -- and the seal backstop's removal detection -- must run under a
22
+ * controller view that includes the log the ceremony is anchoring at, or the
23
+ * rotation anchors before it (a revocation's rotation leaves the log
24
+ * unsealed with the seal blind to the removal; the last-client transition's
25
+ * ladder-signed rotation lands before its reinstall version and the
26
+ * ceremony-tail license refuses it). Rather than leaving that to the
27
+ * injected store's own controller wiring, the view built from the ceremony's
28
+ * log is set as the store's minimum controller version; a fresher resolved
29
+ * view still wins. A store that is not log-governed has no controller view
30
+ * to anchor and is left alone. Exported for the one caller that reads the
31
+ * roster before its anchoring entry exists (the last-client transition's
32
+ * pre-pair probe, anchored at the pre-transition head it verified).
33
+ *
34
+ * @param options {object}
35
+ * @param options.rosterStore {EncryptionDescriptorStore}
36
+ * @param options.did {string}
37
+ * @param options.log {DIDLog}
38
+ */
39
+ export function anchorRosterStoreAt({ rosterStore, did, log }) {
40
+ if (isSealableDescriptorStore(rosterStore)) {
41
+ rosterStore.setMinimumControllerVersion({
42
+ controller: webvhResourceLogController({ did, log })
43
+ });
44
+ }
45
+ }
46
+ /**
47
+ * The adopting read after a rotation: the roster read on the threaded
48
+ * descriptor (the continuity and possession checks still run on it), then
49
+ * the caller's `onUserKeyAdopted` when the key rotated on this run.
50
+ *
51
+ * @param options {object}
52
+ * @param options.rosterStore {EncryptionDescriptorStore}
53
+ * @param options.descriptor {CollectionEncryption} the rotation's own
54
+ * verified result, so one run acquires the roster once for both halves
55
+ * @param [options.userKey] {UserKey}
56
+ * @param options.readBackKeyAgreementKey {IKeyAgreementKey}
57
+ * @param [options.pinnedEpochId] {string}
58
+ * @param [options.onUserKeyAdopted] {Function}
59
+ * @returns {Promise<object>}
60
+ */
61
+ async function adoptRotatedUserKey({ rosterStore, descriptor, userKey, readBackKeyAgreementKey, pinnedEpochId, onUserKeyAdopted }) {
62
+ const read = await readUserKeyRoster({
63
+ store: rosterStore,
64
+ descriptor,
65
+ ...(userKey ? { userKey } : {}),
66
+ clientKeyAgreementKey: readBackKeyAgreementKey,
67
+ pinnedEpochId
68
+ });
69
+ if (read.rotated) {
70
+ await onUserKeyAdopted?.({
71
+ userKey: read.userKey,
72
+ latestEpochId: read.latestEpochId,
73
+ descriptor: read.descriptor
74
+ });
75
+ }
76
+ return {
77
+ rotated: read.rotated,
78
+ userKey: read.userKey,
79
+ descriptor: read.descriptor
80
+ };
81
+ }
82
+ /**
83
+ * The collection fan-out, in parallel -- run even when the roster was found
84
+ * already rotated (a re-run after a crash), because the staleness rule finds
85
+ * exactly the stranded collections.
86
+ *
87
+ * @param options {object}
88
+ * @param options.collections {CascadeCollections}
89
+ * @param options.rosterDescriptor {CollectionEncryption}
90
+ * @param options.clientKeyAgreementKey {IKeyAgreementKey} the key that
91
+ * unwraps the roster's generations for the per-collection re-epoch
92
+ * @param options.userKey {UserKey}
93
+ * @returns {Promise<UserKeyCascadeResult>}
94
+ */
95
+ async function fanOutToCollections({ collections, rosterDescriptor, clientKeyAgreementKey, userKey }) {
96
+ return cascadeCollectionsToUserKey({
97
+ collectionIds: await collectionIdsOf({ collections }),
98
+ storeFor: collections.storeFor,
99
+ ...(collections.isEncrypted
100
+ ? { isEncrypted: collections.isEncrypted }
101
+ : {}),
102
+ rosterDescriptor,
103
+ clientKeyAgreementKey,
104
+ userKey
105
+ });
106
+ }
19
107
  /**
20
108
  * Runs the roster rotation (with its seal backstop) and the collection
21
109
  * fan-out over the document a ceremony's own edit just published. See the
@@ -26,32 +114,20 @@ async function collectionIdsOf({ collections }) {
26
114
  * `key-map/user-key.jsonl` roster store
27
115
  * @param options.did {string} the account's did:webvh
28
116
  * @param options.doc {DIDDoc} the document as the ceremony's edit left it
29
- * @param options.log {DIDLog} the post-edit log, which the controller floor
30
- * is built from
117
+ * @param options.log {DIDLog} the post-edit log, which the minimum
118
+ * controller version is built from
31
119
  * @param [options.userKey] {UserKey} this client's cached user key
32
120
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
33
121
  * (identity) key-agreement key -- its roster entry
34
122
  * @param [options.pinnedEpochId] {string} the locally pinned latest-seen
35
123
  * roster epoch
36
- * @param [options.onUserKeyAdopted] {Function} persists a rotated key:
37
- * called with `{ userKey, latestEpochId, descriptor }` after the roster read
38
- * and BEFORE the fan-out. The key and the epoch pin must persist atomically
124
+ * @param [options.onUserKeyAdopted] {UserKeyAdoptedHook} persists a
125
+ * rotated key
39
126
  * @param options.collections {CascadeCollections} the fan-out's work
40
127
  * @returns {Promise<RosterCascadeResult>}
41
128
  */
42
129
  export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc, log, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections }) {
43
- // The post-edit anchoring guarantee: the roster appends -- and the seal
44
- // backstop's removal detection -- must run under a controller view that
45
- // includes the edit the ceremony just published, or the rotation anchors
46
- // pre-edit and the log stays unsealed with the seal blind to the removal.
47
- // Rather than leaving that to the injected store's own controller wiring,
48
- // the view built from the edit's post-edit log is set as the store's floor;
49
- // a fresher resolved view still wins.
50
- if (isSealableDescriptorStore(rosterStore)) {
51
- rosterStore.setControllerFloor({
52
- controller: webvhResourceLogController({ did, log })
53
- });
54
- }
130
+ anchorRosterStoreAt({ rosterStore, did, log });
55
131
  // The roster rotation, recipients resolved from that same document.
56
132
  // Whether there IS a roster is settled BY the convergence call itself: a
57
133
  // `null` descriptor back means the account has no `key-map/user-key.jsonl`
@@ -64,28 +140,20 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
64
140
  // run left behind, in one rotation.
65
141
  const converged = await convergeUserKeyRosterToDocument({
66
142
  store: rosterStore,
67
- document: doc
143
+ document: doc,
144
+ ownerKeyAgreementKey: clientKeyAgreementKey
68
145
  });
69
146
  if (converged.descriptor === null) {
70
147
  return { rotated: false, collections: { outcomes: {}, failed: [] } };
71
148
  }
72
- // The rotation's own verified result is threaded into the adopting read, so
73
- // one run acquires the roster once for both halves of the stage (the
74
- // continuity and possession checks still run on the threaded descriptor).
75
- const read = await readUserKeyRoster({
76
- store: rosterStore,
149
+ const read = await adoptRotatedUserKey({
150
+ rosterStore,
77
151
  descriptor: converged.descriptor,
78
- ...(userKey ? { userKey } : {}),
79
- clientKeyAgreementKey,
80
- pinnedEpochId
152
+ userKey,
153
+ readBackKeyAgreementKey: clientKeyAgreementKey,
154
+ pinnedEpochId,
155
+ onUserKeyAdopted
81
156
  });
82
- if (read.rotated) {
83
- await onUserKeyAdopted?.({
84
- userKey: read.userKey,
85
- latestEpochId: read.latestEpochId,
86
- descriptor: read.descriptor
87
- });
88
- }
89
157
  // The seal backstop: an ordinary rotation is the sealing append by
90
158
  // construction, but a rotation that no-op'd (the removed party held no
91
159
  // current-epoch wrap -- an orphan entry, or any re-run) appended nothing,
@@ -101,15 +169,8 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
101
169
  rosterSeal = { outcome: 'failed', error: err };
102
170
  }
103
171
  }
104
- // The collection fan-out, in parallel -- run even when this call found the
105
- // roster already rotated (a re-run after a crash), because the staleness
106
- // rule finds exactly the stranded collections.
107
- const cascade = await cascadeCollectionsToUserKey({
108
- collectionIds: await collectionIdsOf({ collections }),
109
- storeFor: collections.storeFor,
110
- ...(collections.isEncrypted
111
- ? { isEncrypted: collections.isEncrypted }
112
- : {}),
172
+ const cascade = await fanOutToCollections({
173
+ collections,
113
174
  rosterDescriptor: read.descriptor,
114
175
  clientKeyAgreementKey,
115
176
  userKey: read.userKey
@@ -122,4 +183,84 @@ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc,
122
183
  rosterDescriptor: read.descriptor
123
184
  };
124
185
  }
186
+ /**
187
+ * The recipient-naming entry point: retires ONE named roster recipient and
188
+ * runs the collection fan-out, for a ceremony that rotates BEFORE its own
189
+ * document edit (see the module doc). The document handed in still keys the
190
+ * retiring recipient, so the rotation names its kid explicitly; the fresh key
191
+ * is read back through `readBackKeyAgreementKey`, a recipient whose wrap
192
+ * survives the rotation (the standing credential's, on both forgets). No
193
+ * seal backstop runs here.
194
+ *
195
+ * Every stage detects its own completion from durable state: a recipient the
196
+ * current epoch no longer wraps to skips the append (so a re-run of a
197
+ * torn-after-rotation ceremony attempts no second append at the same anchor,
198
+ * which on a ladder-signed roster the one-shot license would refuse), the
199
+ * read-back adopts whatever the roster now delivers, and the fan-out is
200
+ * staleness-driven. An account with no roster yet reports `rotated: false`
201
+ * with an empty fan-out and no key.
202
+ *
203
+ * @param options {object}
204
+ * @param options.rosterStore {EncryptionDescriptorStore} the
205
+ * `key-map/user-key.jsonl` roster store
206
+ * @param options.did {string} the account's did:webvh
207
+ * @param options.doc {DIDDoc} the document the rotation's recipients are
208
+ * resolved from -- the one `log` resolves to
209
+ * @param options.log {DIDLog} the log the rotation anchors at, which the
210
+ * minimum controller version is built from: the pre-edit head for a plain
211
+ * forget, the post-reinstall head for the last-client transition
212
+ * @param options.retireRecipientId {string} the roster kid to retire
213
+ * @param [options.userKey] {UserKey} this client's cached user key
214
+ * @param options.readBackKeyAgreementKey {IKeyAgreementKey} the recipient
215
+ * whose wrap survives the rotation, reading the fresh key back and
216
+ * unwrapping the generations for the fan-out
217
+ * @param [options.pinnedEpochId] {string} the locally pinned latest-seen
218
+ * roster epoch
219
+ * @param [options.onUserKeyAdopted] {UserKeyAdoptedHook} persists a
220
+ * rotated key
221
+ * @param options.collections {CascadeCollections} the fan-out's work
222
+ * @returns {Promise<RosterCascadeResult>} `rotated` says whether THIS run
223
+ * retired the recipient's wrap; `rosterSeal` is never present
224
+ * @throws {UserKeyRosterIntegrityError} the roster's `currentEpoch` names
225
+ * no epoch in its own list
226
+ */
227
+ export async function retireRosterRecipientAndCascade({ rosterStore, did, doc, log, retireRecipientId, userKey, readBackKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections }) {
228
+ anchorRosterStoreAt({ rosterStore, did, log });
229
+ const current = await rosterStore.read();
230
+ if (current === null) {
231
+ return { rotated: false, collections: { outcomes: {}, failed: [] } };
232
+ }
233
+ let descriptor = current.descriptor;
234
+ let rotated = false;
235
+ if (rosterWrapsRecipient({ descriptor, recipientId: retireRecipientId })) {
236
+ descriptor = await rotateUserKeyRoster({
237
+ store: rosterStore,
238
+ document: doc,
239
+ retireRecipientId
240
+ });
241
+ rotated = true;
242
+ }
243
+ // The fresh key comes back through the surviving recipient's wrap -- the
244
+ // retired one is gone from the current epoch.
245
+ const read = await adoptRotatedUserKey({
246
+ rosterStore,
247
+ descriptor,
248
+ userKey,
249
+ readBackKeyAgreementKey,
250
+ pinnedEpochId,
251
+ onUserKeyAdopted
252
+ });
253
+ const cascade = await fanOutToCollections({
254
+ collections,
255
+ rosterDescriptor: read.descriptor,
256
+ clientKeyAgreementKey: readBackKeyAgreementKey,
257
+ userKey: read.userKey
258
+ });
259
+ return {
260
+ rotated,
261
+ collections: cascade,
262
+ userKey: read.userKey,
263
+ rosterDescriptor: read.descriptor
264
+ };
265
+ }
125
266
  //# sourceMappingURL=userKeyRosterCascade.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyRosterCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyRosterCascade.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EACL,2BAA2B,EAE5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AA4C3B;;;;;;;GAOG;AACH,KAAK,UAAU,eAAe,CAAC,EAC7B,WAAW,EAGZ;IACC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,CAAA;IACrC,OAAO,OAAO,aAAa,KAAK,UAAU;QACxC,CAAC,CAAC,MAAM,aAAa,EAAE;QACvB,CAAC,CAAC,aAAa,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,EACrD,WAAW,EACX,GAAG,EACH,GAAG,EACH,GAAG,EACH,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,WAAW,EAeZ;IACC,wEAAwE;IACxE,wEAAwE;IACxE,yEAAyE;IACzE,0EAA0E;IAC1E,0EAA0E;IAC1E,4EAA4E;IAC5E,sCAAsC;IACtC,IAAI,yBAAyB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3C,WAAW,CAAC,kBAAkB,CAAC;YAC7B,UAAU,EAAE,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE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AM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;IACxC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAA;IACtE,CAAC;IACD,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;IACnC,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,oBAAoB,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;QACzE,UAAU,GAAG,MAAM,mBAAmB,CAAC;YACrC,KAAK,EAAE,WAAW;YAClB,QAAQ,EAAE,GAAG;YACb,iBAAiB;SAClB,CAAC,CAAA;QACF,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IACD,yEAAyE;IACzE,8CAA8C;IAC9C,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC;QACrC,WAAW;QACX,UAAU;QACV,OAAO;QACP,uBAAuB;QACvB,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC;QACxC,WAAW;QACX,gBAAgB,EAAE,IAAI,CAAC,UAAU;QACjC,qBAAqB,EAAE,uBAAuB;QAC9C,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,UAAU;KAClC,CAAA;AACH,CAAC"}
@@ -8,6 +8,7 @@
8
8
  * collection the wrap-set roster lives in. Every wallet app on the account
9
9
  * shares this one implementation, so they share one record.
10
10
  */
11
+ import type { IZcap } from '@interop/data-integrity-core';
11
12
  import type { WasClient } from '@interop/was-client';
12
13
  import type { ClientLabelsStore } from './clientLabels.js';
13
14
  /**
@@ -15,12 +16,18 @@ import type { ClientLabelsStore } from './clientLabels.js';
15
16
  *
16
17
  * @param options {object}
17
18
  * @param options.was {WasClient} the account's storage client, signing as an
18
- * enrolled client
19
+ * enrolled client or, under a delegated capability, as the annex
20
+ * verification method
19
21
  * @param options.spaceId {string} the data Space id
22
+ * @param [options.capability] {IZcap} an invocation capability the read and
23
+ * the write both ride (a delegated Space-subtree zcap -- a transient
24
+ * session's generation delegation); absent, both invoke the root capability
25
+ * as before
20
26
  * @returns {ClientLabelsStore}
21
27
  */
22
- export declare function wasClientLabelsStore({ was, spaceId }: {
28
+ export declare function wasClientLabelsStore({ was, spaceId, capability }: {
23
29
  was: WasClient;
24
30
  spaceId: string;
31
+ capability?: IZcap;
25
32
  }): ClientLabelsStore;
26
33
  //# sourceMappingURL=wasLabelsStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasLabelsStore.d.ts","sourceRoot":"","sources":["../../src/keys/wasLabelsStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,GAAG,EACH,OAAO,EACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,iBAAiB,CAepB"}
1
+ {"version":3,"file":"wasLabelsStore.d.ts","sourceRoot":"","sources":["../../src/keys/wasLabelsStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAMpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,GAAG,EACH,OAAO,EACP,UAAU,EACX,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GAAG,iBAAiB,CAiBpB"}
@@ -1,18 +1,26 @@
1
1
  import { CLIENT_LABELS_RESOURCE, KEY_MAP_COLLECTION } from '../space/collections.js';
2
+ import { plaintextCollection } from '../space/plaintextCollection.js';
2
3
  /**
3
4
  * Builds the labels store over `key-map/client-labels.json` in a data Space.
4
5
  *
5
6
  * @param options {object}
6
7
  * @param options.was {WasClient} the account's storage client, signing as an
7
- * enrolled client
8
+ * enrolled client or, under a delegated capability, as the annex
9
+ * verification method
8
10
  * @param options.spaceId {string} the data Space id
11
+ * @param [options.capability] {IZcap} an invocation capability the read and
12
+ * the write both ride (a delegated Space-subtree zcap -- a transient
13
+ * session's generation delegation); absent, both invoke the root capability
14
+ * as before
9
15
  * @returns {ClientLabelsStore}
10
16
  */
11
- export function wasClientLabelsStore({ was, spaceId }) {
12
- const resource = was
13
- .space(spaceId)
14
- .collection(KEY_MAP_COLLECTION.id, { encryption: 'plaintext' })
15
- .resource(CLIENT_LABELS_RESOURCE);
17
+ export function wasClientLabelsStore({ was, spaceId, capability }) {
18
+ const resource = plaintextCollection({
19
+ was,
20
+ spaceId,
21
+ collectionId: KEY_MAP_COLLECTION.id,
22
+ capability
23
+ }).resource(CLIENT_LABELS_RESOURCE);
16
24
  return {
17
25
  async get() {
18
26
  const result = await resource.get();
@@ -1 +1 @@
1
- {"version":3,"file":"wasLabelsStore.js","sourceRoot":"","sources":["../../src/keys/wasLabelsStore.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAGhC;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,GAAG,EACH,OAAO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OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAA;QAC7C,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAuB;YACxC,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;YAC9D,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAC/D,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/log.d.ts CHANGED
@@ -46,10 +46,15 @@ export type StageNotifier = (stage: string) => void;
46
46
  * one is swallowed with a warn: telemetry must never tear a ceremony, which
47
47
  * would leave exactly the half-run state the notifier exists to observe.
48
48
  *
49
+ * The optional type parameter narrows what the RETURNED notifier accepts. A
50
+ * ceremony passes its own stage-name union (its exported stage tuple's
51
+ * element type), so a mistyped `stage('...')` call fails the type check
52
+ * instead of emitting a name no consumer displays.
53
+ *
49
54
  * @param [onStage] {StageNotifier}
50
- * @returns {StageNotifier}
55
+ * @returns {(stage: Stage) => void}
51
56
  */
52
- export declare function stageNotifier(onStage?: StageNotifier): StageNotifier;
57
+ export declare function stageNotifier<Stage extends string = string>(onStage?: StageNotifier): (stage: Stage) => void;
53
58
  /**
54
59
  * Installs `next` as the logger every call site in this package logs
55
60
  * through, and returns the PREVIOUS logger -- so a test (or an app
package/dist/log.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACxD,IAAI,C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OAAO,CAAC,GAAG,IAAI,CAAA;CACzD;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EACzD,OAAO,CAAC,EAAE,aAAa,GACtB,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAWxB;AAeD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAAE,MAKjB,CAAA"}
package/dist/log.js CHANGED
@@ -25,8 +25,13 @@
25
25
  * one is swallowed with a warn: telemetry must never tear a ceremony, which
26
26
  * would leave exactly the half-run state the notifier exists to observe.
27
27
  *
28
+ * The optional type parameter narrows what the RETURNED notifier accepts. A
29
+ * ceremony passes its own stage-name union (its exported stage tuple's
30
+ * element type), so a mistyped `stage('...')` call fails the type check
31
+ * instead of emitting a name no consumer displays.
32
+ *
28
33
  * @param [onStage] {StageNotifier}
29
- * @returns {StageNotifier}
34
+ * @returns {(stage: Stage) => void}
30
35
  */
31
36
  export function stageNotifier(onStage) {
32
37
  if (onStage === undefined) {
package/dist/log.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AAyBH;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,GAAG,EAAE,CAAC,SAAS,CAAA;IACxB,CAAC;IACD,OAAO,SAAS,MAAM,CAAC,KAAa;QAClC,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;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,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;CAC9C,CAAA"}
@@ -3,20 +3,24 @@
3
3
  */
4
4
  /**
5
5
  * The `@interop/wallet-core/recovery` subpath: recovery codes on the roster
6
- * identity model -- a code as a minimal always-enrolled wallet client.
6
+ * identity model -- a code as a standing unlock credential that retires on
7
+ * spend.
7
8
  *
8
9
  * - `generateRecoveryCode` / `formatRecoveryCode` / `normalizeRecoveryCode` /
9
10
  * `decodeRecoveryCode` / `RECOVERY_KDF` -- the format layer and the code's
10
11
  * own unlock-derivation parameter set (its salt distinct from every other
11
12
  * unlock method's).
12
- * - `recoveryClientFromCode` -- the deterministic client key set:
13
- * unlock identity, client seed (signing + key-agreement pair), and the
14
- * single did:webvh update key whose hash stands pre-committed.
13
+ * - `recoveryClientFromCode` -- the deterministic client key set: unlock
14
+ * identity, client seed (signing + key-agreement pair), binding MAC key,
15
+ * and the update-key ladder seed, whose rung 0 is the did:webvh update key
16
+ * whose hash stands pre-committed and whose VM signs the code's own bridge.
15
17
  * - The record codec lives in `@interop/wallet-core/unlock` now
16
18
  * (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
17
- * recovery record is an unlock record with no ladder member -- the account
18
- * pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
19
- * a seed, never a user key wrap), signed under the mixed-signer policy
19
+ * recovery record is an unlock record with no ladder member (the code's
20
+ * ladder seed derives from the code bytes rather than riding the record) --
21
+ * the account pointer plus the pre-minted PUT-on-`did.jsonl` bridge
22
+ * delegation (never a seed, never a user key wrap), signed under the
23
+ * mixed-signer policy
20
24
  * (the code's unlock key at issuance, an enrolled client's account key on
21
25
  * a re-mint), with the account core authenticated by a MAC under a
22
26
  * code-derived key, so a storage host can never redirect recovery at
@@ -41,8 +45,8 @@ export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalize
41
45
  export type { RecoveryClient } from './recoveryCode.js';
42
46
  export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
43
47
  export type { SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from '../unlock/unlockRecord.js';
44
- export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
48
+ export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, recordedDelegationFields, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
45
49
  export type { RecordRemintOutcome, RecoveryDelegationEntry } from './recoveryDelegation.js';
46
50
  export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
47
- export type { RecoveryLogStore, RecoveryPublicKeys } from './recoveryWebvh.js';
51
+ export type { RecoveryLogStore, RecoveryPublicKeys, ReplacementRecoveryPublicKeys } from './recoveryWebvh.js';
48
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,6BAA6B,EAC9B,MAAM,oBAAoB,CAAA"}
@@ -3,20 +3,24 @@
3
3
  */
4
4
  /**
5
5
  * The `@interop/wallet-core/recovery` subpath: recovery codes on the roster
6
- * identity model -- a code as a minimal always-enrolled wallet client.
6
+ * identity model -- a code as a standing unlock credential that retires on
7
+ * spend.
7
8
  *
8
9
  * - `generateRecoveryCode` / `formatRecoveryCode` / `normalizeRecoveryCode` /
9
10
  * `decodeRecoveryCode` / `RECOVERY_KDF` -- the format layer and the code's
10
11
  * own unlock-derivation parameter set (its salt distinct from every other
11
12
  * unlock method's).
12
- * - `recoveryClientFromCode` -- the deterministic client key set:
13
- * unlock identity, client seed (signing + key-agreement pair), and the
14
- * single did:webvh update key whose hash stands pre-committed.
13
+ * - `recoveryClientFromCode` -- the deterministic client key set: unlock
14
+ * identity, client seed (signing + key-agreement pair), binding MAC key,
15
+ * and the update-key ladder seed, whose rung 0 is the did:webvh update key
16
+ * whose hash stands pre-committed and whose VM signs the code's own bridge.
15
17
  * - The record codec lives in `@interop/wallet-core/unlock` now
16
18
  * (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
17
- * recovery record is an unlock record with no ladder member -- the account
18
- * pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
19
- * a seed, never a user key wrap), signed under the mixed-signer policy
19
+ * recovery record is an unlock record with no ladder member (the code's
20
+ * ladder seed derives from the code bytes rather than riding the record) --
21
+ * the account pointer plus the pre-minted PUT-on-`did.jsonl` bridge
22
+ * delegation (never a seed, never a user key wrap), signed under the
23
+ * mixed-signer policy
20
24
  * (the code's unlock key at issuance, an enrolled client's account key on
21
25
  * a re-mint), with the account core authenticated by a MAC under a
22
26
  * code-derived key, so a storage host can never redirect recovery at
@@ -39,6 +43,6 @@
39
43
  */
40
44
  export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
41
45
  export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
42
- export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
46
+ export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, recordedDelegationFields, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
43
47
  export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
44
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAMhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAMhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
@@ -65,16 +65,27 @@ export declare function decodeRecoveryCode({ code }: {
65
65
  code: string;
66
66
  }): Uint8Array;
67
67
  /**
68
- * The code's full client identity, derived deterministically from
69
- * its bytes: the 32-byte client seed (behind the code's Ed25519 signing pair
70
- * and X25519 key-agreement twin), the single did:webvh update-key seed (one
71
- * key, no staged pair -- a code is spent on use, so it never self-rotates;
72
- * its recovery continuation commits whatever it needs next), the derived
73
- * agents, and the public multibases / ids the issuance and recovery flows
74
- * publish and look up.
68
+ * The code's full client identity, derived deterministically from its bytes:
69
+ * the 32-byte client seed (behind the code's Ed25519 signing pair and X25519
70
+ * key-agreement twin), the ladder seed behind its update authority, the
71
+ * derived agents, and the public multibases / ids the issuance and recovery
72
+ * flows publish and look up.
75
73
  */
76
74
  export interface RecoveryClient extends UnlockClientIdentity {
77
75
  codeBytes: Uint8Array;
76
+ /**
77
+ * The code's update-key ladder seed. Its VM is what signs the code's own
78
+ * bridge delegation, and its rung 0 is the code's committed update key, so
79
+ * the spend's reveal-and-commit entry is the ordinary ladder reveal. A code
80
+ * is spent on use and never self-rotates, so no rung past 0 is ever
81
+ * revealed; the ladder is what gives the code a verification method of its
82
+ * own beside that single rung.
83
+ */
84
+ ladderSeed: Uint8Array;
85
+ /**
86
+ * Rung 0's 32-byte update-key seed -- the key the code's committed hash
87
+ * stands for, and the one the reveal-and-commit entry signs with.
88
+ */
78
89
  updateSeed: Uint8Array;
79
90
  /**
80
91
  * The symmetric key that MACs the recovery record's account binding:
@@ -82,7 +93,16 @@ export interface RecoveryClient extends UnlockClientIdentity {
82
93
  * Derived from the code bytes, so the storage host never holds it.
83
94
  */
84
95
  bindingMacKey: Uint8Array;
96
+ /**
97
+ * Rung 0's public multibase: the code's `updateKeyMultibase` as the
98
+ * registry records it and the document commits its hash.
99
+ */
85
100
  updateKeyMultibase: string;
101
+ /**
102
+ * The ladder VM's public multibase, as the account document publishes it
103
+ * under `assertionMethod` and `capabilityDelegation`.
104
+ */
105
+ ladderVmKeyMultibase: string;
86
106
  }
87
107
  /**
88
108
  * Derives the code's whole client identity from a (possibly formatted) code.
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryCode.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryCode.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAGvE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,SAM1B,CAAA;AAoBD;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,SAAuC;CAI3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C;AAED;;;;;;;;GAQG;AACH,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