@interop/wallet-core 0.50.0 → 0.52.1

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 (241) hide show
  1. package/README.md +7 -11
  2. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +17 -8
  3. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  4. package/dist/clientAnnex/credentialAnchoredGenesis.js +33 -12
  5. package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
  6. package/dist/clientAnnex/forget.d.ts +18 -6
  7. package/dist/clientAnnex/forget.d.ts.map +1 -1
  8. package/dist/clientAnnex/forget.js +19 -6
  9. package/dist/clientAnnex/forget.js.map +1 -1
  10. package/dist/clientAnnex/forgetLast.d.ts +65 -28
  11. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  12. package/dist/clientAnnex/forgetLast.js +78 -18
  13. package/dist/clientAnnex/forgetLast.js.map +1 -1
  14. package/dist/clientAnnex/gc.d.ts +3 -3
  15. package/dist/clientAnnex/gc.d.ts.map +1 -1
  16. package/dist/clientAnnex/gc.js +2 -2
  17. package/dist/clientAnnex/gc.js.map +1 -1
  18. package/dist/clientAnnex/index.d.ts +6 -6
  19. package/dist/clientAnnex/index.d.ts.map +1 -1
  20. package/dist/clientAnnex/index.js +5 -5
  21. package/dist/clientAnnex/index.js.map +1 -1
  22. package/dist/clientAnnex/ladder.d.ts +19 -11
  23. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  24. package/dist/clientAnnex/ladder.js +77 -14
  25. package/dist/clientAnnex/ladder.js.map +1 -1
  26. package/dist/clientAnnex/ladderAnchored.d.ts +36 -7
  27. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  28. package/dist/clientAnnex/ladderAnchored.js +80 -18
  29. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  30. package/dist/clientAnnex/log.d.ts +6 -6
  31. package/dist/clientAnnex/log.d.ts.map +1 -1
  32. package/dist/clientAnnex/log.js +8 -8
  33. package/dist/clientAnnex/log.js.map +1 -1
  34. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +7 -7
  35. package/dist/clientAnnex/recoveryLadderAnchored.js +9 -9
  36. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  37. package/dist/clientAnnex/selfEnroll.d.ts +6 -4
  38. package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
  39. package/dist/clientAnnex/selfEnroll.js +19 -7
  40. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  41. package/dist/clients/listing.d.ts +1 -1
  42. package/dist/clients/listing.d.ts.map +1 -1
  43. package/dist/clients/listing.js +1 -1
  44. package/dist/clients/listing.js.map +1 -1
  45. package/dist/clients/revocation.d.ts +1 -1
  46. package/dist/clients/rosterPolicy.d.ts +1 -1
  47. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  48. package/dist/descriptors/acquire.js +1 -1
  49. package/dist/descriptors/logSource.d.ts +1 -2
  50. package/dist/descriptors/logSource.d.ts.map +1 -1
  51. package/dist/descriptors/logSource.js +2 -2
  52. package/dist/descriptors/logSource.js.map +1 -1
  53. package/dist/enrollment/enrollment.d.ts +1 -1
  54. package/dist/enrollment/enrollment.d.ts.map +1 -1
  55. package/dist/enrollment/enrollment.js +2 -1
  56. package/dist/enrollment/enrollment.js.map +1 -1
  57. package/dist/genesis/accountGenesis.d.ts +13 -1
  58. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  59. package/dist/genesis/accountGenesis.js +1 -1
  60. package/dist/genesis/accountGenesis.js.map +1 -1
  61. package/dist/index.d.ts +1 -3
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +1 -3
  64. package/dist/index.js.map +1 -1
  65. package/dist/keyring/kdf.d.ts +6 -20
  66. package/dist/keyring/kdf.d.ts.map +1 -1
  67. package/dist/keyring/kdf.js +8 -5
  68. package/dist/keyring/kdf.js.map +1 -1
  69. package/dist/keyring/unlockSpace.js +1 -1
  70. package/dist/keys/rosterLogStore.d.ts +16 -14
  71. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  72. package/dist/keys/rosterLogStore.js +149 -32
  73. package/dist/keys/rosterLogStore.js.map +1 -1
  74. package/dist/keys/rosterStore.d.ts +8 -7
  75. package/dist/keys/rosterStore.d.ts.map +1 -1
  76. package/dist/keys/rosterStore.js +6 -6
  77. package/dist/keys/rosterStore.js.map +1 -1
  78. package/dist/keys/spaceEpochs.d.ts +1 -1
  79. package/dist/keys/spaceEpochs.js +1 -1
  80. package/dist/keys/userKeyRoster.d.ts +3 -3
  81. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  82. package/dist/keys/userKeyRoster.js +3 -3
  83. package/dist/keys/userKeyRoster.js.map +1 -1
  84. package/dist/recovery/index.d.ts +2 -2
  85. package/dist/recovery/index.js +2 -2
  86. package/dist/recovery/recoveryDelegation.js +1 -1
  87. package/dist/recovery/recoveryDelegation.js.map +1 -1
  88. package/dist/recovery/recoveryWebvh.d.ts +4 -4
  89. package/dist/recovery/recoveryWebvh.js +5 -5
  90. package/dist/request/appKey.d.ts +9 -3
  91. package/dist/request/appKey.d.ts.map +1 -1
  92. package/dist/request/appKey.js +13 -8
  93. package/dist/request/appKey.js.map +1 -1
  94. package/dist/request/classify.d.ts.map +1 -1
  95. package/dist/request/classify.js +13 -1
  96. package/dist/request/classify.js.map +1 -1
  97. package/dist/request/ephemeralExchange.d.ts +6 -1
  98. package/dist/request/ephemeralExchange.d.ts.map +1 -1
  99. package/dist/request/ephemeralExchange.js +6 -1
  100. package/dist/request/ephemeralExchange.js.map +1 -1
  101. package/dist/request/exchangeClient.d.ts +0 -23
  102. package/dist/request/exchangeClient.d.ts.map +1 -1
  103. package/dist/request/exchangeClient.js +30 -1
  104. package/dist/request/exchangeClient.js.map +1 -1
  105. package/dist/request/index.d.ts +4 -1
  106. package/dist/request/index.d.ts.map +1 -1
  107. package/dist/request/index.js +4 -1
  108. package/dist/request/index.js.map +1 -1
  109. package/dist/request/interactionRequest.d.ts +23 -0
  110. package/dist/request/interactionRequest.d.ts.map +1 -0
  111. package/dist/request/interactionRequest.js +46 -0
  112. package/dist/request/interactionRequest.js.map +1 -0
  113. package/dist/request/interactionUrl.d.ts +3 -14
  114. package/dist/request/interactionUrl.d.ts.map +1 -1
  115. package/dist/request/interactionUrl.js +20 -1
  116. package/dist/request/interactionUrl.js.map +1 -1
  117. package/dist/resourceLog/controller.d.ts +48 -49
  118. package/dist/resourceLog/controller.d.ts.map +1 -1
  119. package/dist/resourceLog/controller.js +40 -20
  120. package/dist/resourceLog/controller.js.map +1 -1
  121. package/dist/resourceLog/errors.d.ts +12 -78
  122. package/dist/resourceLog/errors.d.ts.map +1 -1
  123. package/dist/resourceLog/errors.js +12 -79
  124. package/dist/resourceLog/errors.js.map +1 -1
  125. package/dist/resourceLog/index.d.ts +17 -22
  126. package/dist/resourceLog/index.d.ts.map +1 -1
  127. package/dist/resourceLog/index.js +16 -21
  128. package/dist/resourceLog/index.js.map +1 -1
  129. package/dist/resourceLog/license.d.ts +27 -26
  130. package/dist/resourceLog/license.d.ts.map +1 -1
  131. package/dist/resourceLog/license.js +31 -30
  132. package/dist/resourceLog/license.js.map +1 -1
  133. package/dist/unlock/index.d.ts +6 -6
  134. package/dist/unlock/index.d.ts.map +1 -1
  135. package/dist/unlock/index.js +5 -5
  136. package/dist/unlock/retire.d.ts +29 -28
  137. package/dist/unlock/retire.d.ts.map +1 -1
  138. package/dist/unlock/retire.js +25 -16
  139. package/dist/unlock/retire.js.map +1 -1
  140. package/dist/unlock/standingClient.d.ts +1 -1
  141. package/dist/unlock/standingClient.js +3 -3
  142. package/dist/unlock/standingWebvh.d.ts +28 -10
  143. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  144. package/dist/unlock/standingWebvh.js +75 -37
  145. package/dist/unlock/standingWebvh.js.map +1 -1
  146. package/dist/unlock/unlockRecord.js +1 -1
  147. package/dist/webvh/delegatedLogStore.d.ts +2 -2
  148. package/dist/webvh/delegatedLogStore.js +2 -2
  149. package/dist/webvh/didWeb.js +1 -1
  150. package/dist/webvh/didWeb.js.map +1 -1
  151. package/dist/webvh/didWebvh.d.ts +3 -3
  152. package/dist/webvh/didWebvh.d.ts.map +1 -1
  153. package/dist/webvh/didWebvh.js +5 -5
  154. package/dist/webvh/didWebvh.js.map +1 -1
  155. package/dist/webvh/listClients.js +1 -1
  156. package/dist/webvh/listClients.js.map +1 -1
  157. package/dist/webvh/verifyLog.d.ts +1 -1
  158. package/dist/webvh/verifyLog.d.ts.map +1 -1
  159. package/dist/webvh/verifyLog.js +1 -2
  160. package/dist/webvh/verifyLog.js.map +1 -1
  161. package/package.json +6 -10
  162. package/dist/display/alignment.d.ts +0 -55
  163. package/dist/display/alignment.d.ts.map +0 -1
  164. package/dist/display/alignment.js +0 -117
  165. package/dist/display/alignment.js.map +0 -1
  166. package/dist/display/credentialName.d.ts +0 -42
  167. package/dist/display/credentialName.d.ts.map +0 -1
  168. package/dist/display/credentialName.js +0 -106
  169. package/dist/display/credentialName.js.map +0 -1
  170. package/dist/display/displayFields.d.ts +0 -59
  171. package/dist/display/displayFields.d.ts.map +0 -1
  172. package/dist/display/displayFields.js +0 -136
  173. package/dist/display/displayFields.js.map +0 -1
  174. package/dist/display/evidence.d.ts +0 -50
  175. package/dist/display/evidence.d.ts.map +0 -1
  176. package/dist/display/evidence.js +0 -67
  177. package/dist/display/evidence.js.map +0 -1
  178. package/dist/display/image.d.ts +0 -18
  179. package/dist/display/image.d.ts.map +0 -1
  180. package/dist/display/image.js +0 -23
  181. package/dist/display/image.js.map +0 -1
  182. package/dist/display/index.d.ts +0 -38
  183. package/dist/display/index.d.ts.map +0 -1
  184. package/dist/display/index.js +0 -32
  185. package/dist/display/index.js.map +0 -1
  186. package/dist/display/issuer.d.ts +0 -105
  187. package/dist/display/issuer.d.ts.map +0 -1
  188. package/dist/display/issuer.js +0 -126
  189. package/dist/display/issuer.js.map +0 -1
  190. package/dist/display/obv3.d.ts +0 -82
  191. package/dist/display/obv3.d.ts.map +0 -1
  192. package/dist/display/obv3.js +0 -117
  193. package/dist/display/obv3.js.map +0 -1
  194. package/dist/display/parse.d.ts +0 -66
  195. package/dist/display/parse.d.ts.map +0 -1
  196. package/dist/display/parse.js +0 -104
  197. package/dist/display/parse.js.map +0 -1
  198. package/dist/display/subject.d.ts +0 -79
  199. package/dist/display/subject.d.ts.map +0 -1
  200. package/dist/display/subject.js +0 -124
  201. package/dist/display/subject.js.map +0 -1
  202. package/dist/display/text.d.ts +0 -53
  203. package/dist/display/text.d.ts.map +0 -1
  204. package/dist/display/text.js +0 -78
  205. package/dist/display/text.js.map +0 -1
  206. package/dist/display/types.d.ts +0 -55
  207. package/dist/display/types.d.ts.map +0 -1
  208. package/dist/display/types.js +0 -41
  209. package/dist/display/types.js.map +0 -1
  210. package/dist/display/validity.d.ts +0 -51
  211. package/dist/display/validity.d.ts.map +0 -1
  212. package/dist/display/validity.js +0 -51
  213. package/dist/display/validity.js.map +0 -1
  214. package/dist/display/verificationView.d.ts +0 -115
  215. package/dist/display/verificationView.d.ts.map +0 -1
  216. package/dist/display/verificationView.js +0 -199
  217. package/dist/display/verificationView.js.map +0 -1
  218. package/dist/resourceLog/append.d.ts +0 -112
  219. package/dist/resourceLog/append.d.ts.map +0 -1
  220. package/dist/resourceLog/append.js +0 -197
  221. package/dist/resourceLog/append.js.map +0 -1
  222. package/dist/resourceLog/entry.d.ts +0 -68
  223. package/dist/resourceLog/entry.d.ts.map +0 -1
  224. package/dist/resourceLog/entry.js +0 -167
  225. package/dist/resourceLog/entry.js.map +0 -1
  226. package/dist/resourceLog/pin.d.ts +0 -82
  227. package/dist/resourceLog/pin.d.ts.map +0 -1
  228. package/dist/resourceLog/pin.js +0 -57
  229. package/dist/resourceLog/pin.js.map +0 -1
  230. package/dist/resourceLog/seal.d.ts +0 -97
  231. package/dist/resourceLog/seal.d.ts.map +0 -1
  232. package/dist/resourceLog/seal.js +0 -113
  233. package/dist/resourceLog/seal.js.map +0 -1
  234. package/dist/resourceLog/verify.d.ts +0 -96
  235. package/dist/resourceLog/verify.d.ts.map +0 -1
  236. package/dist/resourceLog/verify.js +0 -474
  237. package/dist/resourceLog/verify.js.map +0 -1
  238. package/dist/resourceLog/vmFragment.d.ts +0 -33
  239. package/dist/resourceLog/vmFragment.d.ts.map +0 -1
  240. package/dist/resourceLog/vmFragment.js +0 -39
  241. package/dist/resourceLog/vmFragment.js.map +0 -1
@@ -67,7 +67,7 @@ const CLIENT_ANNEX_RUNG_INFO_SUFFIX = '/rung/0';
67
67
  export const LADDER_MAX_SCAN = 128;
68
68
  /**
69
69
  * Thrown when the published log's standing parameters match no derivable rung
70
- * -- the credential's posture was revoked (or never published), the ladder
70
+ * -- the credential's inventory was revoked (or never published), the ladder
71
71
  * seed does not belong to this account, or the scan bound was exceeded -- or
72
72
  * when they match more than one rung in the same role, which no legitimate
73
73
  * history produces. Self-enrollment refuses loudly rather than guessing.
@@ -265,9 +265,20 @@ export async function attributeLadderRung({ ladderSeed, published, maxScan = LAD
265
265
  * @returns {boolean}
266
266
  */
267
267
  function ladderSigned({ entry, ladderKeys }) {
268
- return (entry?.proof ?? []).some(proof => {
268
+ return entrySigners({ entry }).some(key => ladderKeys.has(key));
269
+ }
270
+ /**
271
+ * The update-key multibases that signed a log entry (the fragment of each
272
+ * proof's `did:key:<multibase>#<multibase>` id; see {@link ladderSigned}).
273
+ *
274
+ * @param options {object}
275
+ * @param options.entry {DIDLogEntry | undefined}
276
+ * @returns {string[]}
277
+ */
278
+ function entrySigners({ entry }) {
279
+ return (entry?.proof ?? []).flatMap(proof => {
269
280
  const keyMultibase = proof.verificationMethod?.split('#')[1];
270
- return keyMultibase !== undefined && ladderKeys.has(keyMultibase);
281
+ return keyMultibase === undefined ? [] : [keyMultibase];
271
282
  });
272
283
  }
273
284
  /**
@@ -275,9 +286,9 @@ function ladderSigned({ entry, ladderKeys }) {
275
286
  * credential's own `keyAgreement` verification method -- asked at the entry
276
287
  * that completes an enrollment the ladder's rung revealed, where it is the
277
288
  * test of whether the CREDENTIAL survives its own ceremony. A self-enrollment
278
- * leaves the credential's posture untouched (it climbs to the next rung),
289
+ * leaves the credential's inventory untouched (it climbs to the next rung),
279
290
  * while a spend -- the recovery continuation, whose add-and-retire entry
280
- * strikes the code's posture and publishes its successor's -- ends it.
291
+ * strikes the code's inventory and publishes its successor's -- ends it.
281
292
  *
282
293
  * With no id supplied the question cannot be asked, so the answer is a
283
294
  * conservative `false`: a claim the ladder cannot attribute is released rather
@@ -295,18 +306,18 @@ function credentialSurvives({ entry, vmId }) {
295
306
  }
296
307
  // The `keyAgreement` RELATION alone, rather than the bare
297
308
  // `verificationMethod` array: an entry that dereferences the method while
298
- // leaving its object behind has ended the credential's posture, and reading
309
+ // leaving its object behind has ended the credential's inventory, and reading
299
310
  // that as a climb would claim -- and strike -- a successor credential's
300
311
  // commitment.
301
312
  return relationIds(entry.state.keyAgreement).includes(vmId);
302
313
  }
303
314
  /**
304
- * Attributes a ladder's FULL standing posture from the log -- the retirement
315
+ * Attributes a ladder's FULL standing inventory from the log -- the retirement
305
316
  * counterpart of {@link attributeLadderRung}, which recovers only the single
306
317
  * current rung. Retiring a credential must strike every standing artifact its
307
318
  * ladder accounts for, so this walks the log's effective parameters forward
308
319
  * from an anchor (the recorded bind-time rung, however stale) and tracks the
309
- * ladder's footprint entry by entry:
320
+ * ladder's inventory entry by entry:
310
321
  *
311
322
  * - a newly authorized key whose hash was a known ladder commitment is a rung
312
323
  * REVEAL; the hashes that entry newly commits are claimed by the ladder,
@@ -315,7 +326,15 @@ function credentialSurvives({ entry, vmId }) {
315
326
  * key commits stay OUT, even while the rung sits in `updateKeys`: a rung
316
327
  * stands revealed indefinitely after a forget (and after a torn
317
328
  * self-enrollment), and the account's enrolled clients go on extending the
318
- * log the whole time;
329
+ * log the whole time. One exception, the HANDOVER: when the revealed rung's
330
+ * hash was committed earlier by a key the revealing entry itself retires
331
+ * (the recovery continuation -- the spent code commits the fresh
332
+ * credential's `hash(rung 0)` and `hash(rung 1)` adjacently with the
333
+ * replacement code's hash last, then the add entry revealing rung 0 strikes
334
+ * the code), the hash committed immediately after the rung's in that entry,
335
+ * when it is not the entry's last addition, is the ladder's next commitment
336
+ * and is claimed too, so a seed-less walk over a continuation log sees
337
+ * rung 1;
319
338
  * - the entry that retires the revealed rung while authorizing a key whose
320
339
  * hash sits among those claims is the enrollment's COMPLETION: the new
321
340
  * client's update-key hash and the claim committed immediately after it
@@ -327,7 +346,7 @@ function credentialSurvives({ entry, vmId }) {
327
346
  * the hash derives from the ladder's own seed (or is the recorded key's),
328
347
  * or the credential itself survives the completing entry, which is what
329
348
  * makes the residue its next standing commitment. A SPEND -- the recovery
330
- * continuation, whose one entry retires the code's own posture and
349
+ * continuation, whose one entry retires the code's own inventory and
331
350
  * publishes its successor's -- leaves the replacement credential's
332
351
  * commitment in that position instead, and striking that would leave the
333
352
  * replacement unusable and unhealable;
@@ -339,7 +358,7 @@ function credentialSurvives({ entry, vmId }) {
339
358
  * anchor being current; without it, the walk is anchored on
340
359
  * `anchorKeyMultibase` and on `credentialVmId` alone, and a residue neither
341
360
  * can attribute is released -- the retirement then strikes what the recorded
342
- * posture names and nothing more. More than one ladder reveal standing or
361
+ * inventory names and nothing more. More than one ladder reveal standing or
343
362
  * arriving at once matches no legitimate history and fails closed
344
363
  * ({@link LadderAttributionError}).
345
364
  *
@@ -351,14 +370,14 @@ function credentialSurvives({ entry, vmId }) {
351
370
  * when the caller holds it
352
371
  * @param [options.credentialVmId] {string} the credential's own
353
372
  * `keyAgreement` verification-method id, which tells a climb (the
354
- * credential stands afterwards) from a spend (its posture goes in the same
373
+ * credential stands afterwards) from a spend (its inventory goes in the same
355
374
  * entry)
356
375
  * @param [options.maxScan] {number} seeded pre-derivation bound; defaults to
357
376
  * {@link LADDER_MAX_SCAN}
358
- * @returns {Promise<LadderStandingPosture>} what currently stands; both
377
+ * @returns {Promise<LadderStandingInventory>} what currently stands; both
359
378
  * arrays empty when the log carries nothing of the ladder any more
360
379
  */
361
- export async function attributeLadderPosture({ log, anchorKeyMultibase, ladderSeed, credentialVmId, maxScan = LADDER_MAX_SCAN }) {
380
+ export async function attributeLadderInventory({ log, anchorKeyMultibase, ladderSeed, credentialVmId, maxScan = LADDER_MAX_SCAN }) {
362
381
  const anchorHash = await deriveNextKeyHash(anchorKeyMultibase);
363
382
  const ladderKeys = new Set([anchorKeyMultibase]);
364
383
  // What the ladder knows a priori: the recorded key's hash and, with the
@@ -380,13 +399,29 @@ export async function attributeLadderPosture({ log, anchorKeyMultibase, ladderSe
380
399
  let pending;
381
400
  let prevUpdateKeys = new Set();
382
401
  let prevHashes = new Set();
402
+ // Where each standing hash was FIRST committed: the entry's signers, the
403
+ // hash appended immediately after it there, and whether that successor
404
+ // closed the entry's additions. Read back at a reveal whose committing
405
+ // entry the reveal itself retires (below).
406
+ const firstCommit = new Map();
383
407
  for (const [index, entry] of params.entries()) {
384
408
  const currentUpdateKeys = new Set(entry.updateKeys);
385
409
  const addedKeys = entry.updateKeys.filter(key => !prevUpdateKeys.has(key));
410
+ const removedKeys = [...prevUpdateKeys].filter(key => !currentUpdateKeys.has(key));
386
411
  // Order-preserving on purpose: the completion transfer below reads the
387
412
  // claim committed immediately after the client's update-key hash as its
388
413
  // staged hash (the reveal entry's append order, a ratified convention).
389
414
  const addedHashes = entry.nextKeyHashes.filter(hash => !prevHashes.has(hash));
415
+ const signers = entrySigners({ entry: log[index] });
416
+ addedHashes.forEach((hash, at) => {
417
+ if (!firstCommit.has(hash)) {
418
+ firstCommit.set(hash, {
419
+ signers,
420
+ successor: addedHashes[at + 1],
421
+ successorLast: at + 2 === addedHashes.length
422
+ });
423
+ }
424
+ });
390
425
  // Completion first: the pending revealed rung left `updateKeys`. When the
391
426
  // same entry authorizes a key whose hash sits among the reveal's claims,
392
427
  // the enrollment completed -- that hash and its successor (the client's
@@ -444,6 +479,34 @@ export async function attributeLadderPosture({ log, anchorKeyMultibase, ladderSe
444
479
  for (const hash of addedHashes) {
445
480
  ladderHashes.add(hash);
446
481
  }
482
+ // The HANDOVER: a rung whose hash some OTHER key committed earlier, in
483
+ // an entry this reveal retires the signer of. That is the recovery
484
+ // continuation's shape -- the spent code's reveal-and-commit entry
485
+ // commits the fresh credential's `hash(rung 0)` and `hash(rung 1)`
486
+ // adjacently and the replacement code's hash last, and the
487
+ // add-and-retire entry revealing rung 0 strikes the code -- and it is
488
+ // the one case in which a hash another key committed belongs to this
489
+ // ladder: the committer was handing its standing over, not committing
490
+ // for itself. The hash appended immediately after the rung's in that
491
+ // entry is the ladder's next commitment, provided it is not the entry's
492
+ // LAST addition: what an entry hands to a successor credential comes
493
+ // last (the adjacency and the last-position rule both in
494
+ // `decisions/0007-ladder-reveal-hash-order.md`). The condition is
495
+ // reachable outside the continuation -- a forget entry reveals the rung
496
+ // while retiring the client that signed the bind -- and stays inert
497
+ // there only because a bind appends its one hash last. It is a CLAIM
498
+ // like the rest: the completion below still releases it unless the
499
+ // credential survives or the seed derives it.
500
+ const keyHash = await deriveNextKeyHash(key);
501
+ const origin = prevHashes.has(keyHash)
502
+ ? firstCommit.get(keyHash)
503
+ : undefined;
504
+ if (origin?.successor !== undefined &&
505
+ !origin.successorLast &&
506
+ origin.signers.some(signer => removedKeys.includes(signer))) {
507
+ pending.claims.unshift(origin.successor);
508
+ ladderHashes.add(origin.successor);
509
+ }
447
510
  }
448
511
  else if (pending && ladderSigned({ entry: log[index], ladderKeys })) {
449
512
  // The rung is still revealed AND signed this entry, so the hashes it
@@ -1 +1 @@
1
- {"version":3,"file":"ladder.js","sourceRoot":"","sources":["../../src/clientAnnex/ladder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAC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,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;YACtE,qEAAqE;YACrE,yDAAyD;YACzD,uEAAuE;YACvE,mEAAmE;YACnE,qEAAqE;YACrE,oEAAoE;YACpE,uEAAuE;YACvE,2CAA2C;YAC3C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAA;YACnC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC/B,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;QAED,cAAc,GAAG,iBAAiB,CAAA;QAClC,UAAU,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI;QACzC,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;KAClB,CAAA;IACD,OAAO;QACL,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjE,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC5E,CAAA;AACH,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
2
2
  import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
3
- import type { ResourceLogPinStore } from '../resourceLog/index.js';
3
+ import type { ResourceLogPinStore } from '@interop/vh-resource-log';
4
4
  import { type RevokedClientKeys } from '../webvh/revokeClient.js';
5
5
  import { type UnlockKeyAgreementPublication, type UnlockLogStore } from '../unlock/standingWebvh.js';
6
6
  /**
@@ -12,7 +12,7 @@ import { type UnlockKeyAgreementPublication, type UnlockLogStore } from '../unlo
12
12
  * what the first durable self-enrollment's reveal-and-commit entry,
13
13
  * re-stating `updateKeys` containing rung 0, requires --
14
14
  * and the ladder VM (the stable sibling) is published under `assertionMethod`
15
- * and `capabilityDelegation` only. The credential's `keyAgreement` posture
15
+ * and `capabilityDelegation` only. The credential's `keyAgreement`
16
16
  * entry is FOLDED INTO GENESIS -- no enrolled client exists to run the
17
17
  * separate bind entry ({@link publishUnlockKey}) -- so the genesis
18
18
  * `keyAgreement` array holds only the credential's entry.
@@ -108,6 +108,14 @@ export declare function ensureLadderAnchoredDidWebvh(options: {
108
108
  * therefore holds them and can sign the add entry)
109
109
  * @param [options.expectedDid] {string} the account DID the log must resolve
110
110
  * to, from the credential-authenticated pointer
111
+ * @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
112
+ * pins; every read both entries are built on is checked against the pinned
113
+ * head (a served prefix is refused before the reveal entry lands, not only
114
+ * by a verify that follows both entries), and the pin advances to each
115
+ * entry as it publishes
116
+ * @param [options.logId] {string} the account log's pin slot
117
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
118
+ * supplied
111
119
  * @returns {Promise<{ did: string, webDoc?: object }>} the account DID and,
112
120
  * when the add entry ran here, the final `did.json` projection for the
113
121
  * enrolled session to republish
@@ -118,6 +126,8 @@ export declare function selfEnrollWebvhClient(options: {
118
126
  newClientKeys: WebvhEnrollmentKeys;
119
127
  newClientUpdateSeeds: ClientWebvhUpdateKeys;
120
128
  expectedDid?: string;
129
+ pinStore?: ResourceLogPinStore;
130
+ logId?: string;
121
131
  }): Promise<{
122
132
  did: string;
123
133
  webDoc?: object;
@@ -147,7 +157,7 @@ export declare class LastDurableClientForgetError extends Error {
147
157
  * reverse, collapsed to a single entry because a removal reveals no new key.
148
158
  * The signer is the credential's current ladder rung, recovered from the log
149
159
  * itself ({@link attributeLadderRung}): its hash stands committed by the
150
- * credential's posture (or the rung is already revealed), which is exactly
160
+ * credential's inventory (or the rung is already revealed), which is exactly
151
161
  * what lets it reveal itself in the entry it signs under prerotation. The
152
162
  * entry's members are the revocation removal's, verbatim
153
163
  * (`clientRemovalTarget` / `clientRemovalFields`, shared with
@@ -161,10 +171,10 @@ export declare class LastDurableClientForgetError extends Error {
161
171
  * the rung is revealed and the client still stands. The honest residue is the
162
172
  * acting rung itself -- no entry can remove its own signing key, so the rung
163
173
  * stands REVEALED in `updateKeys` afterwards (the same standing state the
164
- * ladder-anchored postures live in). That is credential-held authority, not
174
+ * ladder-anchored accounts live in). That is credential-held authority, not
165
175
  * the forgotten client's: only the ladder seed derives it, the credential's
166
176
  * next self-enrollment consumes and retires it, and retiring the credential
167
- * itself strikes it (`attributeLadderPosture`).
177
+ * itself strikes it (`attributeLadderInventory`).
168
178
  *
169
179
  * Forgetting the LAST enrolled durable client is refused
170
180
  * ({@link LastDurableClientForgetError}): that transition -- to the
@@ -187,6 +197,13 @@ export declare class LastDurableClientForgetError extends Error {
187
197
  * excluded from the staged-hash attribution
188
198
  * @param [options.expectedDid] {string} the account DID the log must resolve
189
199
  * to, from the caller's stored account pointer
200
+ * @param [options.pinStore] {ResourceLogPinStore} the caller's chain-head
201
+ * pins: the read inside each attempt is checked against the pinned head
202
+ * (a served truncated prefix is refused as a `rollback` before anything is
203
+ * built on it), and the pin advances to the head this entry publishes
204
+ * @param [options.logId] {string} the account log's pin slot
205
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
206
+ * supplied
190
207
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} the account
191
208
  * DID and the document and log as the removal entry leaves them (unchanged
192
209
  * on the idempotent no-op path)
@@ -197,6 +214,8 @@ export declare function forgetWebvhClient(options: {
197
214
  forgottenClient: RevokedClientKeys;
198
215
  knownLatentHashes?: string[];
199
216
  expectedDid?: string;
217
+ pinStore?: ResourceLogPinStore;
218
+ logId?: string;
200
219
  }): Promise<{
201
220
  did: string;
202
221
  doc: DIDDoc;
@@ -223,6 +242,8 @@ export declare function forgetLastWebvhClient(options: {
223
242
  forgottenClient: RevokedClientKeys;
224
243
  knownLatentHashes?: string[];
225
244
  expectedDid?: string;
245
+ pinStore?: ResourceLogPinStore;
246
+ logId?: string;
226
247
  }): Promise<{
227
248
  did: string;
228
249
  doc: DIDDoc;
@@ -232,14 +253,14 @@ export declare function forgetLastWebvhClient(options: {
232
253
  * THE LADDER-VM INSTALL ENTRY (the two-entry transition ceremony's first
233
254
  * entry): publishes the credential's ladder VM -- the stable sibling, under
234
255
  * `assertionMethod` and `capabilityDelegation` only -- while the last durable
235
- * client's whole footprint stays untouched: the both-present transitional
256
+ * client's whole inventory stays untouched: the both-present transitional
236
257
  * state the no-neither invariant permits. The entry is ladder-signed by the
237
258
  * attributed rung, which reveals itself into `updateKeys` with its own hash
238
259
  * kept committed (the carry-over convention), exactly the removal entry's
239
260
  * rung math -- so a torn ceremony's re-run re-attributes the now-revealed
240
261
  * rung and carries on.
241
262
  *
242
- * This entry is what makes the transition's document version POSTURE-CHANGING
263
+ * This entry is what makes the transition's document version INVENTORY-CHANGING
243
264
  * under the ceremony-tail license (the ladder-VM set gains a member), so the
244
265
  * ceremony's ONE ladder-signed roster append anchors here -- and it is what
245
266
  * lets the delegation revocations that follow verify their ladder-signed
@@ -258,6 +279,12 @@ export declare function forgetLastWebvhClient(options: {
258
279
  * @param options.ladderSeed {Uint8Array} the credential's ladder seed
259
280
  * @param [options.expectedDid] {string} the account DID the log must resolve
260
281
  * to, from the caller's stored account pointer
282
+ * @param [options.pinStore] {ResourceLogPinStore} the caller's chain-head
283
+ * pins: the read inside each attempt is checked against the pinned head,
284
+ * and the pin advances to the head this entry publishes
285
+ * @param [options.logId] {string} the account log's pin slot
286
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
287
+ * supplied
261
288
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog, installed: boolean }>}
262
289
  * the account DID and the document and log as the install entry leaves them
263
290
  * (unchanged on the idempotent no-op path); `installed` says whether the
@@ -267,6 +294,8 @@ export declare function installLadderVmWebvh(options: {
267
294
  store: UnlockLogStore;
268
295
  ladderSeed: Uint8Array;
269
296
  expectedDid?: string;
297
+ pinStore?: ResourceLogPinStore;
298
+ logId?: string;
270
299
  }): Promise<{
271
300
  did: string;
272
301
  doc: DIDDoc;
@@ -1 +1 @@
1
- {"version":3,"file":"ladderAnchored.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/ladderAnchored.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAEP,MAAM,2BAA2B,CAAA;AAiBlC,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAElE,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAA;AAOnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,8BAA8B,CAAC,EACnD,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACb,EAAE;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,EAAE,6BAA6B,CAAA;CAC5C,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,EAAE;IAC1D,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY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ies on the ACCOUNT log -- everything a standing
6
6
  * credential's ladder does to the world-readable `did.jsonl` beyond the
7
- * split-posture edits (which stay in `unlock/standingWebvh.ts`):
7
+ * split-configuration edits (which stay in `unlock/standingWebvh.ts`):
8
8
  *
9
9
  * - {@link createLadderAnchoredAccountLog} / {@link ensureLadderAnchoredDidWebvh}
10
10
  * -- the genesis of an account with zero enrolled durable clients, anchored
11
11
  * on the credential's ladder alone (rung 0 signs, the ladder VM and the
12
- * credential's `keyAgreement` posture fold into the one entry).
12
+ * credential's `keyAgreement` inventory fold into the one entry).
13
13
  * - {@link selfEnrollWebvhClient} -- the self-enrolling continuation a fresh
14
14
  * browser runs with nothing but the credential: two entries through the
15
15
  * record's delegated `did.jsonl` bridge --
@@ -22,7 +22,7 @@
22
22
  * 2. **Add + retire the rung**: signed by the new client's update key
23
23
  * (revealed from the commit), this entry publishes the new client's
24
24
  * verification methods and update key and drops the spent rung and its
25
- * hash. The credential's own posture -- its `keyAgreement` entry and the
25
+ * hash. The credential's own inventory -- its `keyAgreement` entry and the
26
26
  * freshly committed `hash(rung i + 1)` -- stands untouched, ready for
27
27
  * the next self-enrollment. Nothing is spent, and no replacement exists.
28
28
  * When the account was LADDER-ANCHORED, the same atomic entry removes
@@ -32,7 +32,7 @@
32
32
  *
33
33
  * - {@link forgetWebvhClient} -- self-enrollment in reverse: one atomic
34
34
  * ladder-signed removal entry through the bridge takes a durable client's
35
- * whole document footprint out; the last enrolled durable client refuses
35
+ * whole document inventory out; the last enrolled durable client refuses
36
36
  * ({@link LastDurableClientForgetError}).
37
37
  * - {@link installLadderVmWebvh} / {@link forgetLastWebvhClient} -- the two
38
38
  * entries of the LAST durable client's forget (decision 0004's 2026-08-19
@@ -64,7 +64,7 @@ import { attributeLadderRung, ladderRung, ladderVmKeyMultibase } from './ladder.
64
64
  * what the first durable self-enrollment's reveal-and-commit entry,
65
65
  * re-stating `updateKeys` containing rung 0, requires --
66
66
  * and the ladder VM (the stable sibling) is published under `assertionMethod`
67
- * and `capabilityDelegation` only. The credential's `keyAgreement` posture
67
+ * and `capabilityDelegation` only. The credential's `keyAgreement`
68
68
  * entry is FOLDED INTO GENESIS -- no enrolled client exists to run the
69
69
  * separate bind entry ({@link publishUnlockKey}) -- so the genesis
70
70
  * `keyAgreement` array holds only the credential's entry.
@@ -229,6 +229,14 @@ async function publishLogOnly({ store, log, ifMatch }) {
229
229
  * therefore holds them and can sign the add entry)
230
230
  * @param [options.expectedDid] {string} the account DID the log must resolve
231
231
  * to, from the credential-authenticated pointer
232
+ * @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
233
+ * pins; every read both entries are built on is checked against the pinned
234
+ * head (a served prefix is refused before the reveal entry lands, not only
235
+ * by a verify that follows both entries), and the pin advances to each
236
+ * entry as it publishes
237
+ * @param [options.logId] {string} the account log's pin slot
238
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
239
+ * supplied
232
240
  * @returns {Promise<{ did: string, webDoc?: object }>} the account DID and,
233
241
  * when the add entry ran here, the final `did.json` projection for the
234
242
  * enrolled session to republish
@@ -243,10 +251,18 @@ export async function selfEnrollWebvhClient(options) {
243
251
  * @param options {object} see {@link selfEnrollWebvhClient}
244
252
  * @returns {Promise<{ did: string, webDoc?: object }>}
245
253
  */
246
- async function selfEnrollWebvhClientOnce({ store, ladderSeed, newClientKeys, newClientUpdateSeeds, expectedDid }) {
254
+ async function selfEnrollWebvhClientOnce({ store, ladderSeed, newClientKeys, newClientUpdateSeeds, expectedDid, pinStore, logId }) {
255
+ // Each attempt's own read is what the CAS publish is built on, so the
256
+ // continuity check runs here -- and again on the retry-up-the-ladder
257
+ // re-run -- not only on the verify that follows both entries.
258
+ const pinned = {
259
+ ...(pinStore ? { pinStore } : {}),
260
+ ...(logId !== undefined ? { logId } : {})
261
+ };
247
262
  let published = await readLogOrThrow({
248
263
  store,
249
- ...(expectedDid !== undefined ? { expectedDid } : {})
264
+ ...(expectedDid !== undefined ? { expectedDid } : {}),
265
+ ...pinned
250
266
  });
251
267
  // Already complete (a torn earlier run finished the add entry): the new
252
268
  // client's update key is authorized, which only the add entry writes.
@@ -288,8 +304,18 @@ async function selfEnrollWebvhClientOnce({ store, ladderSeed, newClientKeys, new
288
304
  ]
289
305
  });
290
306
  await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
291
- // The same account the reveal entry just extended.
292
- published = await readLogOrThrow({ store, expectedDid: published.did });
307
+ // Advance the pin to what the reveal entry just published, so the re-read
308
+ // below (and any read after a tear here) refuses a host that rolls the
309
+ // log back behind it.
310
+ if (pinStore && logId !== undefined) {
311
+ await pinStore.write({ logId, pin: pinOfLog(updated.log) });
312
+ }
313
+ // The same account the reveal entry just extended, under the same pin.
314
+ published = await readLogOrThrow({
315
+ store,
316
+ expectedDid: published.did,
317
+ ...pinned
318
+ });
293
319
  }
294
320
  // The add entry: the new client's verification methods and update key in;
295
321
  // the spent rung's key and hash out. The credential's keyAgreement entry
@@ -341,6 +367,11 @@ async function selfEnrollWebvhClientOnce({ store, ladderSeed, newClientKeys, new
341
367
  // Conditional on the read this entry was built on: the re-read above when
342
368
  // the commit entry ran here, the first read when it was skipped.
343
369
  await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
370
+ // Advance the pin to what this entry just published, so a host rolling the
371
+ // log back straight afterwards is refused on the next read.
372
+ if (pinStore && logId !== undefined) {
373
+ await pinStore.write({ logId, pin: pinOfLog(updated.log) });
374
+ }
344
375
  return { did: updated.did, webDoc: updated.webDoc };
345
376
  }
346
377
  /**
@@ -373,7 +404,7 @@ export class LastDurableClientForgetError extends Error {
373
404
  * reverse, collapsed to a single entry because a removal reveals no new key.
374
405
  * The signer is the credential's current ladder rung, recovered from the log
375
406
  * itself ({@link attributeLadderRung}): its hash stands committed by the
376
- * credential's posture (or the rung is already revealed), which is exactly
407
+ * credential's inventory (or the rung is already revealed), which is exactly
377
408
  * what lets it reveal itself in the entry it signs under prerotation. The
378
409
  * entry's members are the revocation removal's, verbatim
379
410
  * (`clientRemovalTarget` / `clientRemovalFields`, shared with
@@ -387,10 +418,10 @@ export class LastDurableClientForgetError extends Error {
387
418
  * the rung is revealed and the client still stands. The honest residue is the
388
419
  * acting rung itself -- no entry can remove its own signing key, so the rung
389
420
  * stands REVEALED in `updateKeys` afterwards (the same standing state the
390
- * ladder-anchored postures live in). That is credential-held authority, not
421
+ * ladder-anchored accounts live in). That is credential-held authority, not
391
422
  * the forgotten client's: only the ladder seed derives it, the credential's
392
423
  * next self-enrollment consumes and retires it, and retiring the credential
393
- * itself strikes it (`attributeLadderPosture`).
424
+ * itself strikes it (`attributeLadderInventory`).
394
425
  *
395
426
  * Forgetting the LAST enrolled durable client is refused
396
427
  * ({@link LastDurableClientForgetError}): that transition -- to the
@@ -413,6 +444,13 @@ export class LastDurableClientForgetError extends Error {
413
444
  * excluded from the staged-hash attribution
414
445
  * @param [options.expectedDid] {string} the account DID the log must resolve
415
446
  * to, from the caller's stored account pointer
447
+ * @param [options.pinStore] {ResourceLogPinStore} the caller's chain-head
448
+ * pins: the read inside each attempt is checked against the pinned head
449
+ * (a served truncated prefix is refused as a `rollback` before anything is
450
+ * built on it), and the pin advances to the head this entry publishes
451
+ * @param [options.logId] {string} the account log's pin slot
452
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
453
+ * supplied
416
454
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} the account
417
455
  * DID and the document and log as the removal entry leaves them (unchanged
418
456
  * on the idempotent no-op path)
@@ -450,10 +488,14 @@ export async function forgetLastWebvhClient(options) {
450
488
  * (refuse the last client)
451
489
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>}
452
490
  */
453
- async function clientForgetEntryOnce({ store, ladderSeed, forgottenClient, knownLatentHashes = [], expectedDid, transition }) {
491
+ async function clientForgetEntryOnce({ store, ladderSeed, forgottenClient, knownLatentHashes = [], expectedDid, pinStore, logId, transition }) {
492
+ // Each attempt's own read is what the CAS publish is built on, so the
493
+ // continuity check runs here, not only on the orchestrator's pre-read.
454
494
  const published = await readLogOrThrow({
455
495
  store,
456
- ...(expectedDid !== undefined ? { expectedDid } : {})
496
+ ...(expectedDid !== undefined ? { expectedDid } : {}),
497
+ ...(pinStore ? { pinStore } : {}),
498
+ ...(logId !== undefined ? { logId } : {})
457
499
  });
458
500
  const { did, doc } = published;
459
501
  const target = await clientRemovalTarget({
@@ -522,20 +564,25 @@ async function clientForgetEntryOnce({ store, ladderSeed, forgottenClient, known
522
564
  nextKeyHashes: [...new Set([...fields.nextKeyHashes, rungHash])]
523
565
  });
524
566
  await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
567
+ // Advance the pin to what this entry just published, so a host rolling the
568
+ // log back straight afterwards is refused on the next read.
569
+ if (pinStore && logId !== undefined) {
570
+ await pinStore.write({ logId, pin: pinOfLog(updated.log) });
571
+ }
525
572
  return { did: updated.did, doc: updated.doc, log: updated.log };
526
573
  }
527
574
  /**
528
575
  * THE LADDER-VM INSTALL ENTRY (the two-entry transition ceremony's first
529
576
  * entry): publishes the credential's ladder VM -- the stable sibling, under
530
577
  * `assertionMethod` and `capabilityDelegation` only -- while the last durable
531
- * client's whole footprint stays untouched: the both-present transitional
578
+ * client's whole inventory stays untouched: the both-present transitional
532
579
  * state the no-neither invariant permits. The entry is ladder-signed by the
533
580
  * attributed rung, which reveals itself into `updateKeys` with its own hash
534
581
  * kept committed (the carry-over convention), exactly the removal entry's
535
582
  * rung math -- so a torn ceremony's re-run re-attributes the now-revealed
536
583
  * rung and carries on.
537
584
  *
538
- * This entry is what makes the transition's document version POSTURE-CHANGING
585
+ * This entry is what makes the transition's document version INVENTORY-CHANGING
539
586
  * under the ceremony-tail license (the ladder-VM set gains a member), so the
540
587
  * ceremony's ONE ladder-signed roster append anchors here -- and it is what
541
588
  * lets the delegation revocations that follow verify their ladder-signed
@@ -554,6 +601,12 @@ async function clientForgetEntryOnce({ store, ladderSeed, forgottenClient, known
554
601
  * @param options.ladderSeed {Uint8Array} the credential's ladder seed
555
602
  * @param [options.expectedDid] {string} the account DID the log must resolve
556
603
  * to, from the caller's stored account pointer
604
+ * @param [options.pinStore] {ResourceLogPinStore} the caller's chain-head
605
+ * pins: the read inside each attempt is checked against the pinned head,
606
+ * and the pin advances to the head this entry publishes
607
+ * @param [options.logId] {string} the account log's pin slot
608
+ * (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
609
+ * supplied
557
610
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog, installed: boolean }>}
558
611
  * the account DID and the document and log as the install entry leaves them
559
612
  * (unchanged on the idempotent no-op path); `installed` says whether the
@@ -569,10 +622,14 @@ export async function installLadderVmWebvh(options) {
569
622
  * @param options {object} see {@link installLadderVmWebvh}
570
623
  * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog, installed: boolean }>}
571
624
  */
572
- async function installLadderVmWebvhOnce({ store, ladderSeed, expectedDid }) {
625
+ async function installLadderVmWebvhOnce({ store, ladderSeed, expectedDid, pinStore, logId }) {
626
+ // Each attempt's own read is what the CAS publish is built on, so the
627
+ // continuity check runs here, not only on the orchestrator's pre-read.
573
628
  const published = await readLogOrThrow({
574
629
  store,
575
- ...(expectedDid !== undefined ? { expectedDid } : {})
630
+ ...(expectedDid !== undefined ? { expectedDid } : {}),
631
+ ...(pinStore ? { pinStore } : {}),
632
+ ...(logId !== undefined ? { logId } : {})
576
633
  });
577
634
  const { did, doc } = published;
578
635
  const ladderVmKey = await ladderVmKeyMultibase({ ladderSeed });
@@ -621,6 +678,11 @@ async function installLadderVmWebvhOnce({ store, ladderSeed, expectedDid }) {
621
678
  capabilityDelegation: withVm(doc.capabilityDelegation)
622
679
  });
623
680
  await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
681
+ // Advance the pin to what this entry just published, so a host rolling the
682
+ // log back straight afterwards is refused on the next read.
683
+ if (pinStore && logId !== undefined) {
684
+ await pinStore.write({ logId, pin: pinOfLog(updated.log) });
685
+ }
624
686
  return {
625
687
  did: updated.did,
626
688
  doc: updated.doc,