@interop/wallet-core 0.62.0 → 0.65.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 (312) 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 +55 -34
  7. package/dist/clientAnnex/establish.d.ts.map +1 -1
  8. package/dist/clientAnnex/establish.js +102 -56
  9. package/dist/clientAnnex/establish.js.map +1 -1
  10. package/dist/clientAnnex/forget.d.ts +16 -2
  11. package/dist/clientAnnex/forget.d.ts.map +1 -1
  12. package/dist/clientAnnex/forget.js +11 -9
  13. package/dist/clientAnnex/forget.js.map +1 -1
  14. package/dist/clientAnnex/forgetLast.d.ts +62 -18
  15. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  16. package/dist/clientAnnex/forgetLast.js +92 -26
  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 +7 -7
  21. package/dist/clientAnnex/gc.js.map +1 -1
  22. package/dist/clientAnnex/heal.d.ts +38 -5
  23. package/dist/clientAnnex/heal.d.ts.map +1 -1
  24. package/dist/clientAnnex/heal.js +346 -236
  25. package/dist/clientAnnex/heal.js.map +1 -1
  26. package/dist/clientAnnex/index.d.ts +21 -5
  27. package/dist/clientAnnex/index.d.ts.map +1 -1
  28. package/dist/clientAnnex/index.js +24 -5
  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 +222 -33
  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 +162 -43
  39. package/dist/clientAnnex/log.d.ts.map +1 -1
  40. package/dist/clientAnnex/log.js +423 -192
  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 +26 -12
  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 +10 -6
  124. package/dist/keys/index.d.ts.map +1 -1
  125. package/dist/keys/index.js +9 -5
  126. package/dist/keys/index.js.map +1 -1
  127. package/dist/keys/rosterLogStore.d.ts +12 -11
  128. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  129. package/dist/keys/rosterLogStore.js +15 -13
  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/userKeyRoster.d.ts +57 -7
  139. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  140. package/dist/keys/userKeyRoster.js +222 -17
  141. package/dist/keys/userKeyRoster.js.map +1 -1
  142. package/dist/keys/userKeyRosterCascade.d.ts +7 -6
  143. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  144. package/dist/keys/userKeyRosterCascade.js +7 -6
  145. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  146. package/dist/keys/wasLabelsStore.d.ts +9 -2
  147. package/dist/keys/wasLabelsStore.d.ts.map +1 -1
  148. package/dist/keys/wasLabelsStore.js +14 -6
  149. package/dist/keys/wasLabelsStore.js.map +1 -1
  150. package/dist/log.d.ts +7 -2
  151. package/dist/log.d.ts.map +1 -1
  152. package/dist/log.js +6 -1
  153. package/dist/log.js.map +1 -1
  154. package/dist/recovery/index.d.ts +12 -8
  155. package/dist/recovery/index.d.ts.map +1 -1
  156. package/dist/recovery/index.js +11 -7
  157. package/dist/recovery/index.js.map +1 -1
  158. package/dist/recovery/recoveryCode.d.ts +27 -7
  159. package/dist/recovery/recoveryCode.d.ts.map +1 -1
  160. package/dist/recovery/recoveryCode.js +18 -6
  161. package/dist/recovery/recoveryCode.js.map +1 -1
  162. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  163. package/dist/recovery/recoveryDelegation.js +21 -34
  164. package/dist/recovery/recoveryDelegation.js.map +1 -1
  165. package/dist/recovery/recoveryWebvh.d.ts +75 -63
  166. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  167. package/dist/recovery/recoveryWebvh.js +127 -116
  168. package/dist/recovery/recoveryWebvh.js.map +1 -1
  169. package/dist/request/classify.d.ts +32 -8
  170. package/dist/request/classify.d.ts.map +1 -1
  171. package/dist/request/classify.js +39 -14
  172. package/dist/request/classify.js.map +1 -1
  173. package/dist/request/ephemeralExchange.d.ts +1 -6
  174. package/dist/request/ephemeralExchange.d.ts.map +1 -1
  175. package/dist/request/ephemeralExchange.js.map +1 -1
  176. package/dist/request/onboarding.d.ts.map +1 -1
  177. package/dist/request/onboarding.js +2 -2
  178. package/dist/request/onboarding.js.map +1 -1
  179. package/dist/request/parse.d.ts.map +1 -1
  180. package/dist/request/parse.js +2 -3
  181. package/dist/request/parse.js.map +1 -1
  182. package/dist/resourceLog/controller.d.ts +34 -12
  183. package/dist/resourceLog/controller.d.ts.map +1 -1
  184. package/dist/resourceLog/controller.js +79 -86
  185. package/dist/resourceLog/controller.js.map +1 -1
  186. package/dist/resourceLog/document.d.ts +182 -0
  187. package/dist/resourceLog/document.d.ts.map +1 -0
  188. package/dist/resourceLog/document.js +159 -0
  189. package/dist/resourceLog/document.js.map +1 -0
  190. package/dist/resourceLog/errors.d.ts +47 -8
  191. package/dist/resourceLog/errors.d.ts.map +1 -1
  192. package/dist/resourceLog/errors.js +54 -8
  193. package/dist/resourceLog/errors.js.map +1 -1
  194. package/dist/resourceLog/index.d.ts +7 -3
  195. package/dist/resourceLog/index.d.ts.map +1 -1
  196. package/dist/resourceLog/index.js +7 -3
  197. package/dist/resourceLog/index.js.map +1 -1
  198. package/dist/resourceLog/ladderRungs.d.ts +35 -0
  199. package/dist/resourceLog/ladderRungs.d.ts.map +1 -0
  200. package/dist/resourceLog/ladderRungs.js +352 -0
  201. package/dist/resourceLog/ladderRungs.js.map +1 -0
  202. package/dist/resourceLog/license.d.ts +42 -17
  203. package/dist/resourceLog/license.d.ts.map +1 -1
  204. package/dist/resourceLog/license.js +38 -24
  205. package/dist/resourceLog/license.js.map +1 -1
  206. package/dist/space/activity.d.ts +15 -15
  207. package/dist/space/activity.d.ts.map +1 -1
  208. package/dist/space/activity.js +15 -15
  209. package/dist/space/activity.js.map +1 -1
  210. package/dist/space/collections.d.ts +11 -0
  211. package/dist/space/collections.d.ts.map +1 -1
  212. package/dist/space/collections.js +13 -0
  213. package/dist/space/collections.js.map +1 -1
  214. package/dist/space/deleteSpace.d.ts +28 -0
  215. package/dist/space/deleteSpace.d.ts.map +1 -0
  216. package/dist/space/deleteSpace.js +44 -0
  217. package/dist/space/deleteSpace.js.map +1 -0
  218. package/dist/space/errors.d.ts.map +1 -1
  219. package/dist/space/errors.js +0 -1
  220. package/dist/space/errors.js.map +1 -1
  221. package/dist/space/index.d.ts +6 -0
  222. package/dist/space/index.d.ts.map +1 -1
  223. package/dist/space/index.js +6 -0
  224. package/dist/space/index.js.map +1 -1
  225. package/dist/space/plaintextCollection.d.ts +43 -0
  226. package/dist/space/plaintextCollection.d.ts.map +1 -0
  227. package/dist/space/plaintextCollection.js +17 -0
  228. package/dist/space/plaintextCollection.js.map +1 -0
  229. package/dist/stages.d.ts +23 -0
  230. package/dist/stages.d.ts.map +1 -0
  231. package/dist/stages.js +23 -0
  232. package/dist/stages.js.map +1 -0
  233. package/dist/sync/index.d.ts +7 -0
  234. package/dist/sync/index.d.ts.map +1 -1
  235. package/dist/sync/index.js +7 -0
  236. package/dist/sync/index.js.map +1 -1
  237. package/dist/sync/push.js +4 -4
  238. package/dist/sync/push.js.map +1 -1
  239. package/dist/sync/remint.js +2 -2
  240. package/dist/sync/remint.js.map +1 -1
  241. package/dist/sync/types.d.ts +41 -1
  242. package/dist/sync/types.d.ts.map +1 -1
  243. package/dist/sync/types.js +47 -1
  244. package/dist/sync/types.js.map +1 -1
  245. package/dist/unlock/index.d.ts +5 -1
  246. package/dist/unlock/index.d.ts.map +1 -1
  247. package/dist/unlock/index.js +5 -1
  248. package/dist/unlock/index.js.map +1 -1
  249. package/dist/unlock/retire.d.ts +35 -7
  250. package/dist/unlock/retire.d.ts.map +1 -1
  251. package/dist/unlock/retire.js +52 -14
  252. package/dist/unlock/retire.js.map +1 -1
  253. package/dist/unlock/standingClient.d.ts.map +1 -1
  254. package/dist/unlock/standingClient.js +5 -1
  255. package/dist/unlock/standingClient.js.map +1 -1
  256. package/dist/unlock/standingWebvh.d.ts +217 -35
  257. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  258. package/dist/unlock/standingWebvh.js +469 -210
  259. package/dist/unlock/standingWebvh.js.map +1 -1
  260. package/dist/webvh/accountEntry.d.ts +146 -0
  261. package/dist/webvh/accountEntry.d.ts.map +1 -0
  262. package/dist/webvh/accountEntry.js +239 -0
  263. package/dist/webvh/accountEntry.js.map +1 -0
  264. package/dist/webvh/didWeb.d.ts +12 -7
  265. package/dist/webvh/didWeb.d.ts.map +1 -1
  266. package/dist/webvh/didWeb.js +2 -2
  267. package/dist/webvh/didWeb.js.map +1 -1
  268. package/dist/webvh/didWebProjection.d.ts +164 -0
  269. package/dist/webvh/didWebProjection.d.ts.map +1 -0
  270. package/dist/webvh/didWebProjection.js +230 -0
  271. package/dist/webvh/didWebProjection.js.map +1 -0
  272. package/dist/webvh/didWebvh.d.ts +275 -136
  273. package/dist/webvh/didWebvh.d.ts.map +1 -1
  274. package/dist/webvh/didWebvh.js +307 -340
  275. package/dist/webvh/didWebvh.js.map +1 -1
  276. package/dist/webvh/enrollClient.d.ts +65 -0
  277. package/dist/webvh/enrollClient.d.ts.map +1 -0
  278. package/dist/webvh/enrollClient.js +172 -0
  279. package/dist/webvh/enrollClient.js.map +1 -0
  280. package/dist/webvh/index.d.ts +37 -12
  281. package/dist/webvh/index.d.ts.map +1 -1
  282. package/dist/webvh/index.js +33 -10
  283. package/dist/webvh/index.js.map +1 -1
  284. package/dist/webvh/listClients.d.ts +1 -35
  285. package/dist/webvh/listClients.d.ts.map +1 -1
  286. package/dist/webvh/listClients.js +2 -30
  287. package/dist/webvh/listClients.js.map +1 -1
  288. package/dist/webvh/revokeClient.d.ts +41 -11
  289. package/dist/webvh/revokeClient.d.ts.map +1 -1
  290. package/dist/webvh/revokeClient.js +99 -48
  291. package/dist/webvh/revokeClient.js.map +1 -1
  292. package/dist/webvh/standingZcap.d.ts +61 -14
  293. package/dist/webvh/standingZcap.d.ts.map +1 -1
  294. package/dist/webvh/standingZcap.js +91 -0
  295. package/dist/webvh/standingZcap.js.map +1 -1
  296. package/dist/webvh/verifyLog.d.ts +59 -5
  297. package/dist/webvh/verifyLog.d.ts.map +1 -1
  298. package/dist/webvh/verifyLog.js +76 -11
  299. package/dist/webvh/verifyLog.js.map +1 -1
  300. package/dist/webvh/wasIdStore.d.ts +8 -8
  301. package/dist/webvh/wasIdStore.d.ts.map +1 -1
  302. package/dist/webvh/wasIdStore.js +39 -14
  303. package/dist/webvh/wasIdStore.js.map +1 -1
  304. package/dist/webvh/zcap.d.ts +14 -1
  305. package/dist/webvh/zcap.d.ts.map +1 -1
  306. package/dist/webvh/zcap.js +3 -27
  307. package/dist/webvh/zcap.js.map +1 -1
  308. package/package.json +2 -2
  309. package/dist/webvh/keyAgreement.d.ts +0 -97
  310. package/dist/webvh/keyAgreement.d.ts.map +0 -1
  311. package/dist/webvh/keyAgreement.js +0 -71
  312. package/dist/webvh/keyAgreement.js.map +0 -1
package/README.md CHANGED
@@ -75,18 +75,26 @@ The subpaths:
75
75
  store they write through, and ZCap signing under the did:webvh
76
76
  verification-method id.
77
77
 
78
- - **`@interop/wallet-core/resourceLog`** -- the client side of the Resource Log
79
- Profile (the hash-linked log format governing key resources co-managed between
80
- a wallet's clients and the storage server): full chain verification against an
81
- adversarial host (parse shape, SCID and entry-hash recomputation, entry
82
- proofs, the external-authorization rule against the independently verified
83
- did:webvh controller document, terminal handover entries), the chain-head pin
84
- with its continuity rules, the entry builders, the read/append/create path
85
- (compare-and-swap with rebase-and-retry, read-back confirmation), and the
86
- sealing sweep -- the idempotent backstop append that re-anchors a log's head
87
- past the controller's latest membership change. Transport lives in
88
- [`@interop/was-client`](https://npm.im/@interop/was-client)'s `/log` subpath;
89
- the hashing and proof kernel in
78
+ - **`@interop/wallet-core/resourceLog`** -- the wallet-domain half of the
79
+ Resource Log Profile, the hash-linked log format governing key resources
80
+ co-managed between a wallet's clients and the storage server. Three pieces.
81
+ The did:webvh controller adapter, which answers which keys could have signed a
82
+ given entry at a given document version, and supplies the admission hook every
83
+ verifier consults. The ceremony-tail license that hook carries, which bounds
84
+ what a standing credential's ladder key may append -- above all refusing a
85
+ silent rekey against an unchanged document. And `isResourceLogRefusal`, the
86
+ shared reading of the refusal taxonomy: which refusals a reader must not paper
87
+ over with a cached copy, and which one it may (a chain-head rollback,
88
+ reconcilable divergence). The adapter and the license read the account
89
+ document through one import-free leaf beside them: relation resolution,
90
+ ladder-VM recognition, and the credential class. They therefore answer exactly
91
+ as the client listing does. That leaf's public home is the `webvh` subpath.
92
+ The generic half lives in
93
+ [`@interop/vh-resource-log`](https://npm.im/@interop/vh-resource-log) -- chain
94
+ verification against an adversarial host, the chain-head pin, the entry
95
+ builders, the read/append/create path, and the sealing sweep. Transport is in
96
+ [`@interop/was-client`](https://npm.im/@interop/was-client)'s `/log` subpath,
97
+ and the hashing and proof kernel in
90
98
  [`@interop/did-method-webvh`](https://npm.im/@interop/did-method-webvh).
91
99
 
92
100
  - **`@interop/wallet-core/keys`** -- the user key and its wrap-set roster,
@@ -158,6 +166,18 @@ The subpaths:
158
166
  delegation builder and the revocation cascade's bridge re-mint core; the
159
167
  record codec is the `unlock` subpath's, re-exported here).
160
168
 
169
+ - **`@interop/wallet-core/clientAnnex`** -- the client annex, the sibling
170
+ did:webvh log holding per-visit transient client keys in garbage-collected
171
+ generations, published in the account's auxiliary annex Space. This is the
172
+ authoring and maintenance surface of everything anchored on an unlock
173
+ credential's update-key ladder: the ladder itself (rung and VM derivation, the
174
+ shared attribution walks), the annex log and its GC, ZCap signing under a
175
+ ladder VM, the ladder-anchored account-log ceremonies (genesis,
176
+ self-enrollment, forget, and the last-client transition to a client-less
177
+ account), the credential-anchored account genesis with its mend and its
178
+ per-visit readiness ensure, and the transient-recovery continuation. It sits
179
+ on top of the other subpaths and none of them import from it.
180
+
161
181
  ## Install
162
182
 
163
183
  - Node.js 24+ is recommended.
@@ -188,10 +208,15 @@ import {
188
208
  ```
189
209
 
190
210
  The `sync` and `space` subpaths are re-exported from the package root as well.
191
- Every other subpath (`identity`, `request`, `webvh`, `keys`, `clients`,
192
- `descriptors`, `keyring`, `enrollment`, `recovery`) is import-directly-only, so
193
- consumers of the root never pull the signing / KMS / document-loader dependency
194
- graph.
211
+ Every other subpath (`identity`, `request`, `webvh`, `resourceLog`, `keys`,
212
+ `clients`, `descriptors`, `keyring`, `enrollment`, `genesis`, `unlock`,
213
+ `recovery`, `clientAnnex`) is import-directly-only, so consumers of the root
214
+ never pull the signing / KMS / document-loader dependency graph.
215
+
216
+ Two further exports are leaves of that same isolation, carved out to stay
217
+ dependency-light: `keys/clientKeyRecord` is the client-key record codec alone,
218
+ so a wallet's storage tests load without the crypto graph, and
219
+ `request/matching` is the QueryByExample matchers alone.
195
220
 
196
221
  ## Contribute
197
222
 
@@ -12,13 +12,13 @@
12
12
  * resolution of the orphan-Space tear): re-derivable from the unlock
13
13
  * record's ladder seed, so a tab death here strands nothing a later
14
14
  * login cannot finish or unwind.
15
- * 2. The optional KMS key map (`provideDidWebKeys`), acquired only once the
16
- * Space exists -- the enrolled-client ceremony's stage, verbatim: a
17
- * KMS-keeping wallet creates the keystore under the ladder VM's bare
18
- * did:key and writes keys.json and did.json into the Space here.
19
- * Best-effort: a throw is collected and the genesis proceeds
20
- * keystore-less; a later login's heal supplies the missing convenience
21
- * key.
15
+ * 2. The optional KMS authentication binding (`provideKmsAuthentication`),
16
+ * started BEFORE stage 1 is awaited and joined before stage 3 -- the
17
+ * keystore and the key mint need no Space, so only the thunk's own
18
+ * `keys.json` write waits on the `spaceReady` promise this ceremony hands
19
+ * it. Best-effort: a throw is collected and the genesis proceeds
20
+ * keystore-less, publishing a document with no `authentication` relation,
21
+ * which no later entry adds the key to.
22
22
  * 3. The ladder-anchored did:webvh genesis
23
23
  * (`ensureLadderAnchoredDidWebvh`): the entry signed by ladder rung 0,
24
24
  * `updateKeys` = [rung 0], `nextKeyHashes` = [hash(rung 0), hash(rung 1)],
@@ -55,7 +55,8 @@
55
55
  import { type RecipientPublicKey } from '@interop/was-client/edv';
56
56
  import type { WasClient } from '@interop/was-client';
57
57
  import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
58
- import type { DidWebKeyMapV2, WebvhIdStore } from '../webvh/didWebvh.js';
58
+ import type { DIDLog } from '@interop/did-method-webvh';
59
+ import type { KmsAuthenticationBinding, PublishedWebvhLog, WebvhIdStore } from '../webvh/didWebvh.js';
59
60
  import type { UnlockKeyAgreementPublication } from '../unlock/standingWebvh.js';
60
61
  import { type UserKey } from '../keys/index.js';
61
62
  import type { ResourceLogPinStore } from '@interop/vh-resource-log';
@@ -97,17 +98,26 @@ export declare function mintCredentialAnchoredAccountKeySet(): Promise<{
97
98
  * roster and recipient zero of every encrypted collection
98
99
  * @param options.idStore {WebvhIdStore} the account's `id` collection
99
100
  * store, signing as the same bootstrap did:key
100
- * @param options.rosterStoreFor {Function} `({ did }) =>
101
+ * @param options.rosterStoreFor {Function} `({ did, log }) =>
101
102
  * EncryptionDescriptorStore` -- the user-key roster's store once the DID is
102
- * known, with a LADDER-signed `ResourceLogSigner` (the first-entry shape)
103
- * @param [options.provideDidWebKeys] {Function} `() =>
104
- * Promise<DidWebKeyMapV2 | undefined>` -- the KMS key-map acquisition (a
105
- * wallet that keeps a KMS runs its did:web provisioning here, after the
106
- * Space exists, under the ladder VM's bare did:key); absent or resolving
107
- * `undefined`, the genesis is ladder-and-credential-only and no `keys.json`
108
- * is ever written. A throw is collected, not fatal: the genesis proceeds
109
- * keystore-less and a later login heals the document with the convenience
110
- * key
103
+ * known, with a LADDER-signed `ResourceLogSigner` (the first-entry shape).
104
+ * `log` is the account log the did:webvh stage just adopted or published,
105
+ * so a store resolving its controller view can read it out of this run's
106
+ * own head instead of fetching `did.jsonl` again
107
+ * @param [options.provideKmsAuthentication] {Function} `({ spaceReady }) =>
108
+ * Promise<KmsAuthenticationBinding | undefined>` -- the KMS authentication
109
+ * binding's acquisition (a wallet that keeps a KMS mints the key under the
110
+ * ladder VM's bare did:key and writes `keys.json` here); absent or
111
+ * resolving `undefined`, the genesis is ladder-and-credential-only and no
112
+ * `keys.json` is ever written. It is STARTED before the Space is awaited
113
+ * and joined before the genesis entry, so its `spaceReady` argument is what
114
+ * its own `keys.json` write waits on. A throw is collected, not fatal: the
115
+ * genesis proceeds keystore-less, and the document it publishes never gains
116
+ * the key. The thunk's own obligation, since this ceremony takes
117
+ * `authentication.vmId` VERBATIM into the world-readable genesis entry: a
118
+ * served `keys.json` may be adopted only after the multibase in its `vmId`
119
+ * is checked against the session's own keystore listing; on a mismatch, or
120
+ * when the keystore cannot be listed, the thunk mints instead of adopting
111
121
  * @param [options.expectedDid] {string} the account DID, when the caller
112
122
  * holds a pointer that already names one (a heal re-run); a fresh signup
113
123
  * and a fresh-terminal heal legitimately hold none
@@ -119,13 +129,17 @@ export declare function mintCredentialAnchoredAccountKeySet(): Promise<{
119
129
  * account pointer must durably name the DID first (freewallet's record
120
130
  * re-bind) passes `false` and promotes after that write
121
131
  * @param [options.onStage] {StageNotifier} observational: called as each
122
- * stage finishes, with `space-provisioning`, `webvh-genesis`,
123
- * `roster-genesis`, `collection-epochs`, and (only when this ceremony
124
- * promotes) `controller-promotion`. Stage 2's own boundary is the
125
- * caller's `provideDidWebKeys` thunk, which is where a caller marks it
126
- * @returns {Promise<AccountGenesisResult>}
132
+ * stage finishes, with the names in `CREDENTIAL_ANCHORED_GENESIS_STAGES`
133
+ * (`clientAnnex/stages.ts`) and, only when this ceremony promotes,
134
+ * `CONTROLLER_PROMOTION_STAGE`. `kms-authentication` fires at the JOIN
135
+ * rather than inside the thunk: stage 2 overlaps stage 1, so a thunk that
136
+ * finishes first would otherwise mark out of order
137
+ * @returns {Promise<AccountGenesisResult>} with `published` and
138
+ * `logMinted` always set: the account log's verified head the did:webvh
139
+ * stage adopted or minted, and which of the two it was -- the head is only
140
+ * safely reusable downstream when this run minted it
127
141
  */
128
- export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, provideDidWebKeys, expectedDid, accountLogPinStore, onDidPublished, promoteController, onStage }: {
142
+ export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, provideKmsAuthentication, expectedDid, accountLogPinStore, onDidPublished, promoteController, onStage }: {
129
143
  was: WasClient;
130
144
  wasServerUrl: string;
131
145
  spaceId: string;
@@ -136,8 +150,11 @@ export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerU
136
150
  idStore: WebvhIdStore;
137
151
  rosterStoreFor: (options: {
138
152
  did: string;
153
+ log: DIDLog;
139
154
  }) => EncryptionDescriptorStore;
140
- provideDidWebKeys?: () => Promise<DidWebKeyMapV2 | undefined>;
155
+ provideKmsAuthentication?: (options: {
156
+ spaceReady: Promise<unknown>;
157
+ }) => Promise<KmsAuthenticationBinding | undefined>;
141
158
  expectedDid?: string;
142
159
  accountLogPinStore?: ResourceLogPinStore;
143
160
  onDidPublished?: (published: {
@@ -145,5 +162,8 @@ export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerU
145
162
  }) => Promise<void>;
146
163
  promoteController?: boolean;
147
164
  onStage?: StageNotifier;
148
- }): Promise<AccountGenesisResult>;
165
+ }): Promise<AccountGenesisResult & {
166
+ published: PublishedWebvhLog;
167
+ logMinted: boolean;
168
+ }>;
149
169
  //# sourceMappingURL=credentialAnchoredGenesis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentialAnchoredGenesis.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/credentialAnchoredGenesis.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAIxE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAGL,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AAE7D;;;;;;;;G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AE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,EAAE,6BAA6B,CAAA;IAC3C,iBAAiB,EAAE,kBAAkB,CAAA;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,YAAY,CAAA;IACrB,cAAc,EAAE,CAAC,OAAO,EAAE;QACxB,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ,KAAK,yBAAyB,CAAA;IAC/B,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE;QACnC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;KAC7B,KAAK,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,mBAAmB,CAAA;IACxC,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,GAAG,OAAO,CACT,oBAAoB,GAAG;IAAE,SAAS,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAC5E,CAwJA"}
@@ -12,13 +12,13 @@
12
12
  * resolution of the orphan-Space tear): re-derivable from the unlock
13
13
  * record's ladder seed, so a tab death here strands nothing a later
14
14
  * login cannot finish or unwind.
15
- * 2. The optional KMS key map (`provideDidWebKeys`), acquired only once the
16
- * Space exists -- the enrolled-client ceremony's stage, verbatim: a
17
- * KMS-keeping wallet creates the keystore under the ladder VM's bare
18
- * did:key and writes keys.json and did.json into the Space here.
19
- * Best-effort: a throw is collected and the genesis proceeds
20
- * keystore-less; a later login's heal supplies the missing convenience
21
- * key.
15
+ * 2. The optional KMS authentication binding (`provideKmsAuthentication`),
16
+ * started BEFORE stage 1 is awaited and joined before stage 3 -- the
17
+ * keystore and the key mint need no Space, so only the thunk's own
18
+ * `keys.json` write waits on the `spaceReady` promise this ceremony hands
19
+ * it. Best-effort: a throw is collected and the genesis proceeds
20
+ * keystore-less, publishing a document with no `authentication` relation,
21
+ * which no later entry adds the key to.
22
22
  * 3. The ladder-anchored did:webvh genesis
23
23
  * (`ensureLadderAnchoredDidWebvh`): the entry signed by ladder rung 0,
24
24
  * `updateKeys` = [rung 0], `nextKeyHashes` = [hash(rung 0), hash(rung 1)],
@@ -59,6 +59,7 @@ import { ensureLadderAnchoredDidWebvh } from './ladderAnchored.js';
59
59
  import { ensureWalletSpaceEpochs, mintUserKey } from '../keys/index.js';
60
60
  import { AccountGenesisSpaceError, ensurePromotedSpaceController, mintSpaceId } from '../genesis/accountGenesis.js';
61
61
  import { stageNotifier } from '../log.js';
62
+ import { CONTROLLER_PROMOTION_STAGE } from './stages.js';
62
63
  /**
63
64
  * The key set a credential-anchored signup mints locally before anything
64
65
  * touches the network: the data Space id and the account's user key -- nothing else.
@@ -94,17 +95,26 @@ export async function mintCredentialAnchoredAccountKeySet() {
94
95
  * roster and recipient zero of every encrypted collection
95
96
  * @param options.idStore {WebvhIdStore} the account's `id` collection
96
97
  * store, signing as the same bootstrap did:key
97
- * @param options.rosterStoreFor {Function} `({ did }) =>
98
+ * @param options.rosterStoreFor {Function} `({ did, log }) =>
98
99
  * EncryptionDescriptorStore` -- the user-key roster's store once the DID is
99
- * known, with a LADDER-signed `ResourceLogSigner` (the first-entry shape)
100
- * @param [options.provideDidWebKeys] {Function} `() =>
101
- * Promise<DidWebKeyMapV2 | undefined>` -- the KMS key-map acquisition (a
102
- * wallet that keeps a KMS runs its did:web provisioning here, after the
103
- * Space exists, under the ladder VM's bare did:key); absent or resolving
104
- * `undefined`, the genesis is ladder-and-credential-only and no `keys.json`
105
- * is ever written. A throw is collected, not fatal: the genesis proceeds
106
- * keystore-less and a later login heals the document with the convenience
107
- * key
100
+ * known, with a LADDER-signed `ResourceLogSigner` (the first-entry shape).
101
+ * `log` is the account log the did:webvh stage just adopted or published,
102
+ * so a store resolving its controller view can read it out of this run's
103
+ * own head instead of fetching `did.jsonl` again
104
+ * @param [options.provideKmsAuthentication] {Function} `({ spaceReady }) =>
105
+ * Promise<KmsAuthenticationBinding | undefined>` -- the KMS authentication
106
+ * binding's acquisition (a wallet that keeps a KMS mints the key under the
107
+ * ladder VM's bare did:key and writes `keys.json` here); absent or
108
+ * resolving `undefined`, the genesis is ladder-and-credential-only and no
109
+ * `keys.json` is ever written. It is STARTED before the Space is awaited
110
+ * and joined before the genesis entry, so its `spaceReady` argument is what
111
+ * its own `keys.json` write waits on. A throw is collected, not fatal: the
112
+ * genesis proceeds keystore-less, and the document it publishes never gains
113
+ * the key. The thunk's own obligation, since this ceremony takes
114
+ * `authentication.vmId` VERBATIM into the world-readable genesis entry: a
115
+ * served `keys.json` may be adopted only after the multibase in its `vmId`
116
+ * is checked against the session's own keystore listing; on a mismatch, or
117
+ * when the keystore cannot be listed, the thunk mints instead of adopting
108
118
  * @param [options.expectedDid] {string} the account DID, when the caller
109
119
  * holds a pointer that already names one (a heal re-run); a fresh signup
110
120
  * and a fresh-terminal heal legitimately hold none
@@ -116,49 +126,89 @@ export async function mintCredentialAnchoredAccountKeySet() {
116
126
  * account pointer must durably name the DID first (freewallet's record
117
127
  * re-bind) passes `false` and promotes after that write
118
128
  * @param [options.onStage] {StageNotifier} observational: called as each
119
- * stage finishes, with `space-provisioning`, `webvh-genesis`,
120
- * `roster-genesis`, `collection-epochs`, and (only when this ceremony
121
- * promotes) `controller-promotion`. Stage 2's own boundary is the
122
- * caller's `provideDidWebKeys` thunk, which is where a caller marks it
123
- * @returns {Promise<AccountGenesisResult>}
129
+ * stage finishes, with the names in `CREDENTIAL_ANCHORED_GENESIS_STAGES`
130
+ * (`clientAnnex/stages.ts`) and, only when this ceremony promotes,
131
+ * `CONTROLLER_PROMOTION_STAGE`. `kms-authentication` fires at the JOIN
132
+ * rather than inside the thunk: stage 2 overlaps stage 1, so a thunk that
133
+ * finishes first would otherwise mark out of order
134
+ * @returns {Promise<AccountGenesisResult>} with `published` and
135
+ * `logMinted` always set: the account log's verified head the did:webvh
136
+ * stage adopted or minted, and which of the two it was -- the head is only
137
+ * safely reusable downstream when this run minted it
124
138
  */
125
- export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, provideDidWebKeys, expectedDid, accountLogPinStore, onDidPublished, promoteController = true, onStage }) {
139
+ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, provideKmsAuthentication, expectedDid, accountLogPinStore, onDidPublished, promoteController = true, onStage }) {
126
140
  const failed = [];
127
141
  const stage = stageNotifier(onStage);
128
142
  const bootstrap = await ladderVmAgent({ ladderSeed });
129
143
  // 1. The Space and its collection roster, create-if-absent under the
130
- // ladder VM's bare did:key. The typed refusal, exactly as on the
131
- // enrolled-client flow: nothing downstream can proceed without a Space.
144
+ // ladder VM's bare did:key. Started here and awaited below, so stage 2 --
145
+ // which needs no Space until its own write -- runs alongside it. The typed
146
+ // refusal, exactly as on the enrolled-client flow: nothing downstream can
147
+ // proceed without a Space.
148
+ const spaceReady = provisionWalletSpace({
149
+ was,
150
+ spaceId,
151
+ controllerDid: bootstrap.id
152
+ });
153
+ // 2. The optional KMS authentication binding, started before the Space is
154
+ // awaited: the keystore and the key mint touch no Space, and the thunk
155
+ // orders its own `keys.json` write behind `spaceReady`. A throw degrades to
156
+ // the ladder-and-credential-only genesis rather than aborting: every later
157
+ // ceremony anchors in the ladder, and the document simply publishes no
158
+ // `authentication` relation.
159
+ // Started inside the same guard the join uses, so a thunk that throws
160
+ // synchronously is collected like one that rejects.
161
+ let kmsRun;
162
+ // The flag rather than the value decides whether the stage is reported, so
163
+ // a thunk rejecting with `undefined` is still a collected failure.
164
+ let kmsFailed = false;
165
+ let kmsFailure;
132
166
  try {
133
- await provisionWalletSpace({ was, spaceId, controllerDid: bootstrap.id });
167
+ kmsRun = provideKmsAuthentication?.({ spaceReady });
168
+ }
169
+ catch (err) {
170
+ kmsFailed = true;
171
+ kmsFailure = err;
172
+ }
173
+ // A Space that never came up returns below while the thunk is still in
174
+ // flight, so its rejection is claimed here rather than surfacing as an
175
+ // unhandled one.
176
+ kmsRun?.catch(() => { });
177
+ try {
178
+ await spaceReady;
134
179
  }
135
180
  catch (err) {
136
181
  throw new AccountGenesisSpaceError({ spaceId, cause: err });
137
182
  }
138
183
  stage('space-provisioning');
139
- // 2. The optional KMS key map, acquired only once the Space exists (a
140
- // KMS-keeping wallet creates the keystore under the ladder VM's bare
141
- // did:key and writes keys.json and did.json into the Space here). A throw
142
- // degrades to the ladder-and-credential-only genesis rather than aborting:
143
- // every later ceremony anchors in the ladder, and a later login heals the
144
- // document with the convenience key.
145
- let didWebKeys;
146
- if (provideDidWebKeys) {
184
+ // The join: the genesis entry carries the KMS binding, so it waits on the
185
+ // whole stage even though the Space no longer does.
186
+ let kmsAuthentication;
187
+ if (kmsRun) {
147
188
  try {
148
- didWebKeys = await provideDidWebKeys();
189
+ kmsAuthentication = await kmsRun;
149
190
  }
150
191
  catch (err) {
151
- failed.push({ stage: 'didWebKeys', error: err });
192
+ kmsFailed = true;
193
+ kmsFailure = err;
152
194
  }
153
195
  }
196
+ if (kmsFailed) {
197
+ failed.push({ stage: 'kmsAuthentication', error: kmsFailure });
198
+ }
199
+ stage('kms-authentication');
200
+ const didWebKeys = kmsAuthentication?.keys;
154
201
  // 3. The ladder-anchored did:webvh genesis -- probe, adopt
155
202
  // (ladder-attributed), or create-and-publish. Fatal on failure, like the
156
203
  // enrolled-client stage.
157
- const { did } = await ensureLadderAnchoredDidWebvh({
204
+ const { did, published, logMinted } = await ensureLadderAnchoredDidWebvh({
158
205
  idStore,
159
206
  wasServerUrl,
160
207
  spaceId,
161
208
  ...(didWebKeys ? { didWebKeys } : {}),
209
+ ...(kmsAuthentication?.etag !== undefined && {
210
+ keysJsonEtag: kmsAuthentication.etag
211
+ }),
162
212
  ladderSeed,
163
213
  keyAgreement,
164
214
  ...(expectedDid !== undefined ? { expectedDid } : {}),
@@ -171,7 +221,7 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
171
221
  // genesis append is the ceremony-tail license's first-entry shape.
172
222
  let rosterDescriptor;
173
223
  try {
174
- const store = rosterStoreFor({ did });
224
+ const store = rosterStoreFor({ did, log: published.log });
175
225
  const current = await store.read();
176
226
  rosterDescriptor =
177
227
  current !== null
@@ -224,10 +274,12 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
224
274
  catch (err) {
225
275
  failed.push({ stage: 'promotion', error: err });
226
276
  }
227
- stage('controller-promotion');
277
+ stage(CONTROLLER_PROMOTION_STAGE);
228
278
  }
229
279
  return {
230
280
  did,
281
+ published,
282
+ logMinted,
231
283
  ...(rosterDescriptor ? { rosterDescriptor } : {}),
232
284
  ...(epochs ? { epochs } : {}),
233
285
  ...(epochsSkipped ? { epochsSkipped } : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"credentialAnchoredGenesis.js","sourceRoot":"","sources":["../../src/clientAnnex/credentialAnchoredGenesis.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,OAAO,EACL,cAAc,EAEf,MAAM,yBAAyB,CAAA;AAIhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,WA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C3C,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM;KACP,CAAA;AACH,CAAC"}
@@ -26,8 +26,9 @@
26
26
  * moments before dying on the promoted Space, a permanent lockout.
27
27
  * 2. `ensureCredentialAnchoredAccountGenesis` under the ladder VM's bare
28
28
  * did:key as bootstrap controller, promotion deferred
29
- * (`promoteController: false`): Space + collections, the optional KMS key
30
- * map (`provideDidWebKeys`, an opaque best-effort thunk the caller owns),
29
+ * (`promoteController: false`): Space + collections, the optional KMS
30
+ * authentication binding (`provideKmsAuthentication`, an opaque
31
+ * best-effort thunk the caller owns, started alongside the Space),
31
32
  * the one-entry ladder-anchored did:webvh genesis with the credential's
32
33
  * `keyAgreement` publication folded in, the roster's epoch[0] wrapped to
33
34
  * the credential's standing key-agreement key with a ladder-signed entry
@@ -86,13 +87,14 @@
86
87
  * bare did:key -- outside the current-key-set rule -- with no mender here;
87
88
  * an open gap owned by the did:web-stage collapse.
88
89
  */
90
+ import type { DIDLog } from '@interop/did-method-webvh';
89
91
  import type { IKeyAgreementKey, IZcap } from '@interop/data-integrity-core';
90
92
  import type { WasClient } from '@interop/was-client';
91
93
  import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
92
94
  import type { ResourceLogPinStore } from '@interop/vh-resource-log';
93
95
  import type { ZcapClient } from '@interop/ezcap';
94
96
  import { type AccountGenesisResult } from '../genesis/accountGenesis.js';
95
- import type { ClientWebvhUpdateKeys, DidWebKeyMapV2, PublishedWebvhLog, WebvhIdStore } from '../webvh/didWebvh.js';
97
+ import type { ClientWebvhUpdateKeys, KmsAuthenticationBinding, PublishedWebvhLog, WebvhIdStore } from '../webvh/didWebvh.js';
96
98
  import type { ICapabilityAgent } from '../webvh/zcap.js';
97
99
  import type { AccountPointer } from '../keyring/record.js';
98
100
  import { type UserKey } from '../keys/index.js';
@@ -122,16 +124,25 @@ export interface CredentialAnchoredStandingFields {
122
124
  * DID, the record's unlock Space id and management zcap, the standing fields
123
125
  * a registry entry records, and the report members -- the genesis's
124
126
  * `epochsSkipped` marker and the best-effort stages' collected failures
125
- * (`didWebKeys`, `keystorePromotion`).
127
+ * (`kmsAuthentication`, `keystorePromotion`).
126
128
  */
127
129
  export interface CredentialAnchoredEstablishment {
128
130
  did: string;
131
+ /**
132
+ * The account log's verified head this run ends standing on -- the pointer
133
+ * entry's own post-publish head when stage 3 wrote one, otherwise the head
134
+ * stage 3 stood on. The caller enters the account straight after this
135
+ * returns, so it seeds its session's verified-log memo from here rather
136
+ * than fetching `did.jsonl` again (`verifiedAccountLogOf`); reuse is within
137
+ * this one run alone.
138
+ */
139
+ accountLog: PublishedWebvhLog;
129
140
  unlockSpaceId: string;
130
141
  manageCapability?: IZcap;
131
142
  standingFields: CredentialAnchoredStandingFields;
132
143
  epochsSkipped?: AccountGenesisResult['epochsSkipped'];
133
144
  failed: Array<{
134
- stage: 'didWebKeys' | 'keystorePromotion';
145
+ stage: 'kmsAuthentication' | 'keystorePromotion';
135
146
  error: unknown;
136
147
  }>;
137
148
  }
@@ -230,11 +241,19 @@ export type CredentialAnchoredBindRecordHook = (options: {
230
241
  * establishment's root window omits it
231
242
  * @param [options.pinStore] {ResourceLogPinStore} chain-head pins; slot
232
243
  * keys are derived here per log
244
+ * @param [options.published] {PublishedWebvhLog} the same account head as
245
+ * `account`, complete with the ETag its read carried, when the caller holds
246
+ * one. The pointer entry's first attempt then builds on it -- one saved
247
+ * read of the log the caller just read or published -- and a lost
248
+ * compare-and-swap falls through to a fresh pinned read
233
249
  * @param [options.now] {number} epoch milliseconds, for tests
234
250
  * @returns {Promise<object>} the pointed (or freshly minted) annex DID,
235
- * the generation delegation when one was installed here, and what ran
251
+ * the generation delegation when one was installed here, what ran, and --
252
+ * on `accountLog` -- the account head this block leaves standing: the
253
+ * post-pointer-entry one when it wrote, the supplied `published` verbatim
254
+ * when the document already pointed at a generation
236
255
  */
237
- export declare function ensurePointedClientAnnexGeneration({ account, wasServerUrl, accountSpaceId, ladderSeed, was, mintController, mintGenerationDelegation, idStore, updateKeys, delegatedClients, invocation, logOnly, pinStore, now }: {
256
+ export declare function ensurePointedClientAnnexGeneration({ account, wasServerUrl, accountSpaceId, ladderSeed, was, mintController, mintGenerationDelegation, idStore, updateKeys, delegatedClients, invocation, logOnly, pinStore, published, now }: {
238
257
  account: Pick<PublishedWebvhLog, 'did' | 'doc' | 'log'>;
239
258
  wasServerUrl: string;
240
259
  accountSpaceId: string;
@@ -253,12 +272,14 @@ export declare function ensurePointedClientAnnexGeneration({ account, wasServerU
253
272
  };
254
273
  logOnly?: boolean;
255
274
  pinStore?: ResourceLogPinStore;
275
+ published?: PublishedWebvhLog;
256
276
  now?: number;
257
277
  }): Promise<{
258
278
  clientAnnexDid: string;
259
279
  generationDelegation?: IZcap;
260
280
  generationMinted: boolean;
261
281
  spaceMinted: boolean;
282
+ accountLog?: PublishedWebvhLog;
262
283
  }>;
263
284
  /**
264
285
  * Runs the whole credential-anchored establishment for one unlock credential
@@ -279,10 +300,12 @@ export declare function ensurePointedClientAnnexGeneration({ account, wasServerU
279
300
  * @param options.bindRecord {CredentialAnchoredBindRecordHook} REQUIRED:
280
301
  * the unlock-record codec closure (see its type doc for the hook's
281
302
  * standing-layout and freshness-floor obligations)
282
- * @param options.rosterStoreFor {Function} REQUIRED: `({ did }) =>
303
+ * @param options.rosterStoreFor {Function} REQUIRED: `({ did, log }) =>
283
304
  * EncryptionDescriptorStore` -- the user-key roster's store, with a
284
305
  * LADDER-signed log signer (the ceremony-tail license's first-entry
285
- * shape), invoked as the bootstrap did:key
306
+ * shape), invoked as the bootstrap did:key. `log` is the account log this
307
+ * run adopted or published, so a store resolving its controller view reads
308
+ * it out of this run's own head instead of fetching `did.jsonl` again
286
309
  * @param options.bootstrapWasFor {Function} REQUIRED:
287
310
  * `({ keyAgent }) => WasClient` -- the storage client wiring, signing as
288
311
  * the ladder VM's bare did:key (the agent is derived here from the seed)
@@ -308,10 +331,15 @@ export declare function ensurePointedClientAnnexGeneration({ account, wasServerU
308
331
  * delegation, when the caller holds one -- threaded into stage 3's Space
309
332
  * resolution; under this ceremony's bootstrap-only authority a
310
333
  * sibling-named Space it can no longer write falls back to a fresh mint
311
- * @param [options.provideDidWebKeys] {Function} `() =>
312
- * Promise<DidWebKeyMapV2 | undefined>` -- the caller's opaque best-effort
313
- * KMS/did:web thunk, run inside stage 2 (the caller owns its body and its
314
- * timeout); a throw is the collected non-fatal `didWebKeys` failure
334
+ * @param [options.provideKmsAuthentication] {Function} `({ spaceReady }) =>
335
+ * Promise<KmsAuthenticationBinding | undefined>` -- the caller's opaque
336
+ * best-effort KMS thunk, started in stage 2 alongside the Space
337
+ * provisioning it reports through `spaceReady` (the caller owns its body
338
+ * and its timeout); a throw is the collected non-fatal `kmsAuthentication`
339
+ * failure. The thunk's obligation, since the genesis takes
340
+ * `authentication.vmId` verbatim into the world-readable entry: it adopts a
341
+ * served `keys.json` only after checking that `vmId`'s multibase against
342
+ * its own keystore listing, and mints otherwise
315
343
  * @param [options.promoteKeystore] {Function} `({ did }) => Promise<void>`
316
344
  * -- the best-effort keystore-controller promotion, called after the
317
345
  * Space's own promotion; the caller's closure no-ops when its KMS stage
@@ -326,15 +354,16 @@ export declare function ensurePointedClientAnnexGeneration({ account, wasServerU
326
354
  * client-local one when a remembered caller seeds its own pin)
327
355
  * @param [options.now] {number} epoch milliseconds, for tests
328
356
  * @param [options.onStage] {StageNotifier} observational: called as each
329
- * stage finishes, so a caller can time them. In order:
330
- * `interim-bind` (skipped with `priorCreatedAt`), `space-provisioning`,
331
- * `webvh-genesis`, `roster-genesis`, `collection-epochs`,
332
- * `roster-delivered-epochs` (only on the adopted-roster arm),
333
- * `account-log-read`, `annex-generation`, `record-rebind`,
334
- * `controller-promotion`. The three stages whose body is the caller's own
335
- * closure -- the KMS thunk, `beforePromotion`, `promoteKeystore` -- are
336
- * left for the caller to mark inside them, since only the caller can name
337
- * what its closure does
357
+ * stage finishes, so a caller can time them, in the order of
358
+ * `CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGES` (`clientAnnex/stages.ts`).
359
+ * `interim-bind` is skipped with `priorCreatedAt`; `account-log-read` is
360
+ * kept as the stage-3 preamble's name, its span near-zero whenever the
361
+ * genesis's own head is reused instead of read; and the adopted-roster arm
362
+ * reports `roster-delivered-epochs` in place of `collection-epochs` (see
363
+ * `CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGE_ALIASES` beside it). The two
364
+ * stages whose body is the caller's own closure -- `beforePromotion` and
365
+ * `promoteKeystore` -- are left for the caller to mark inside them, since
366
+ * only the caller can name what its closure does
338
367
  * @returns {Promise<CredentialAnchoredEstablishment>}
339
368
  * @throws {TypeError} synchronously, when a required hook is missing
340
369
  * @throws {Error} when the genesis's roster or epoch stage did not land
@@ -354,6 +383,7 @@ export declare function establishCredentialAnchoredAccount(options: {
354
383
  bindRecord: CredentialAnchoredBindRecordHook;
355
384
  rosterStoreFor: (options: {
356
385
  did: string;
386
+ log: DIDLog;
357
387
  }) => EncryptionDescriptorStore;
358
388
  bootstrapWasFor: (options: {
359
389
  keyAgent: ICapabilityAgent;
@@ -363,7 +393,9 @@ export declare function establishCredentialAnchoredAccount(options: {
363
393
  lowEntropy: boolean;
364
394
  priorCreatedAt?: string;
365
395
  delegatedClients?: IZcap;
366
- provideDidWebKeys?: () => Promise<DidWebKeyMapV2 | undefined>;
396
+ provideKmsAuthentication?: (options: {
397
+ spaceReady: Promise<unknown>;
398
+ }) => Promise<KmsAuthenticationBinding | undefined>;
367
399
  promoteKeystore?: (options: {
368
400
  did: string;
369
401
  }) => Promise<void>;
@@ -378,17 +410,6 @@ export declare function establishCredentialAnchoredAccount(options: {
378
410
  now?: number;
379
411
  onStage?: StageNotifier;
380
412
  }): Promise<CredentialAnchoredEstablishment>;
381
- /**
382
- * The current `updateKeys` / `nextKeyHashes` view of a published log, for
383
- * the bind-time rung attribution.
384
- *
385
- * @param published {PublishedWebvhLog}
386
- * @returns {object}
387
- */
388
- export declare function currentLogParameters(published: Pick<PublishedWebvhLog, 'log'>): {
389
- updateKeys: string[];
390
- nextKeyHashes: string[];
391
- };
392
413
  /**
393
414
  * A delegation's `expires` caveat, when it carries one.
394
415
  *