@real-life/trust-protocol 0.3.2 → 0.5.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 (277) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +209 -78
  3. package/dist/ack.d.ts +84 -0
  4. package/dist/ack.d.ts.map +1 -0
  5. package/dist/ack.js +114 -0
  6. package/dist/ack.js.map +1 -0
  7. package/dist/adapters/vti-mediator.d.ts +169 -0
  8. package/dist/adapters/vti-mediator.d.ts.map +1 -0
  9. package/dist/adapters/vti-mediator.js +659 -0
  10. package/dist/adapters/vti-mediator.js.map +1 -0
  11. package/dist/anchor.d.ts +226 -0
  12. package/dist/anchor.d.ts.map +1 -0
  13. package/dist/anchor.js +347 -0
  14. package/dist/anchor.js.map +1 -0
  15. package/dist/{holder.d.ts → carrier-holder.d.ts} +1 -1
  16. package/dist/carrier-holder.d.ts.map +1 -0
  17. package/dist/{holder.js → carrier-holder.js} +5 -4
  18. package/dist/carrier-holder.js.map +1 -0
  19. package/dist/carrier-identity.js +4 -4
  20. package/dist/carrier-identity.js.map +1 -1
  21. package/dist/carrier.d.ts.map +1 -1
  22. package/dist/carrier.js +4 -3
  23. package/dist/carrier.js.map +1 -1
  24. package/dist/ceremony.d.ts +3 -2
  25. package/dist/ceremony.d.ts.map +1 -1
  26. package/dist/ceremony.js +16 -26
  27. package/dist/ceremony.js.map +1 -1
  28. package/dist/codec.d.ts +54 -0
  29. package/dist/codec.d.ts.map +1 -0
  30. package/dist/codec.js +494 -0
  31. package/dist/codec.js.map +1 -0
  32. package/dist/continuity.d.ts +67 -0
  33. package/dist/continuity.d.ts.map +1 -0
  34. package/dist/continuity.js +110 -0
  35. package/dist/continuity.js.map +1 -0
  36. package/dist/core.d.ts +4 -0
  37. package/dist/core.d.ts.map +1 -1
  38. package/dist/core.js.map +1 -1
  39. package/dist/crypto.d.ts +23 -7
  40. package/dist/crypto.d.ts.map +1 -1
  41. package/dist/crypto.js +54 -20
  42. package/dist/crypto.js.map +1 -1
  43. package/dist/delivery.d.ts +31 -3
  44. package/dist/delivery.d.ts.map +1 -1
  45. package/dist/delivery.js +75 -28
  46. package/dist/delivery.js.map +1 -1
  47. package/dist/encounter/ceremony.d.ts +37 -0
  48. package/dist/encounter/ceremony.d.ts.map +1 -0
  49. package/dist/encounter/ceremony.js +662 -0
  50. package/dist/encounter/ceremony.js.map +1 -0
  51. package/dist/encounter.d.ts +91 -1
  52. package/dist/encounter.d.ts.map +1 -1
  53. package/dist/encounter.js +191 -12
  54. package/dist/encounter.js.map +1 -1
  55. package/dist/engine.d.ts +303 -0
  56. package/dist/engine.d.ts.map +1 -0
  57. package/dist/engine.js +1509 -0
  58. package/dist/engine.js.map +1 -0
  59. package/dist/entropy.d.ts +28 -0
  60. package/dist/entropy.d.ts.map +1 -0
  61. package/dist/entropy.js +96 -0
  62. package/dist/entropy.js.map +1 -0
  63. package/dist/events.d.ts +198 -0
  64. package/dist/events.d.ts.map +1 -0
  65. package/dist/events.js +2 -0
  66. package/dist/events.js.map +1 -0
  67. package/dist/fixtures.d.ts +30 -0
  68. package/dist/fixtures.d.ts.map +1 -0
  69. package/dist/fixtures.js +155 -0
  70. package/dist/fixtures.js.map +1 -0
  71. package/dist/forge.d.ts +47 -0
  72. package/dist/forge.d.ts.map +1 -0
  73. package/dist/forge.js +20 -0
  74. package/dist/forge.js.map +1 -0
  75. package/dist/group-star.d.ts +251 -0
  76. package/dist/group-star.d.ts.map +1 -0
  77. package/dist/group-star.js +348 -0
  78. package/dist/group-star.js.map +1 -0
  79. package/dist/holder-api.d.ts +165 -0
  80. package/dist/holder-api.d.ts.map +1 -0
  81. package/dist/holder-api.js +142 -0
  82. package/dist/holder-api.js.map +1 -0
  83. package/dist/holder-state-v1.d.ts +801 -0
  84. package/dist/holder-state-v1.d.ts.map +1 -0
  85. package/dist/holder-state-v1.js +2 -0
  86. package/dist/holder-state-v1.js.map +1 -0
  87. package/dist/holder-state-v2.d.ts +858 -0
  88. package/dist/holder-state-v2.d.ts.map +1 -0
  89. package/dist/holder-state-v2.js +2 -0
  90. package/dist/holder-state-v2.js.map +1 -0
  91. package/dist/identity-state.d.ts +43 -0
  92. package/dist/identity-state.d.ts.map +1 -0
  93. package/dist/identity-state.js +345 -0
  94. package/dist/identity-state.js.map +1 -0
  95. package/dist/identity.d.ts +24 -2
  96. package/dist/identity.d.ts.map +1 -1
  97. package/dist/identity.js +70 -11
  98. package/dist/identity.js.map +1 -1
  99. package/dist/index.d.ts +27 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +81 -29
  102. package/dist/index.js.map +1 -1
  103. package/dist/internal.d.ts +37 -0
  104. package/dist/internal.d.ts.map +1 -0
  105. package/dist/internal.js +22 -0
  106. package/dist/internal.js.map +1 -0
  107. package/dist/introduction/holder.d.ts +18 -0
  108. package/dist/introduction/holder.d.ts.map +1 -0
  109. package/dist/introduction/holder.js +764 -0
  110. package/dist/introduction/holder.js.map +1 -0
  111. package/dist/introduction.d.ts +101 -0
  112. package/dist/introduction.d.ts.map +1 -0
  113. package/dist/introduction.js +132 -0
  114. package/dist/introduction.js.map +1 -0
  115. package/dist/invariants.d.ts +43 -0
  116. package/dist/invariants.d.ts.map +1 -0
  117. package/dist/invariants.js +953 -0
  118. package/dist/invariants.js.map +1 -0
  119. package/dist/keys-seed.d.ts +7 -0
  120. package/dist/keys-seed.d.ts.map +1 -0
  121. package/dist/keys-seed.js +133 -0
  122. package/dist/keys-seed.js.map +1 -0
  123. package/dist/log-memory.d.ts +12 -0
  124. package/dist/log-memory.d.ts.map +1 -0
  125. package/dist/log-memory.js +101 -0
  126. package/dist/log-memory.js.map +1 -0
  127. package/dist/membership/holder.d.ts +33 -0
  128. package/dist/membership/holder.d.ts.map +1 -0
  129. package/dist/membership/holder.js +929 -0
  130. package/dist/membership/holder.js.map +1 -0
  131. package/dist/membership.d.ts +123 -0
  132. package/dist/membership.d.ts.map +1 -0
  133. package/dist/membership.js +180 -0
  134. package/dist/membership.js.map +1 -0
  135. package/dist/message/holder.d.ts +49 -0
  136. package/dist/message/holder.d.ts.map +1 -0
  137. package/dist/message/holder.js +290 -0
  138. package/dist/message/holder.js.map +1 -0
  139. package/dist/message.d.ts +43 -0
  140. package/dist/message.d.ts.map +1 -0
  141. package/dist/message.js +51 -0
  142. package/dist/message.js.map +1 -0
  143. package/dist/ports.d.ts +237 -0
  144. package/dist/ports.d.ts.map +1 -0
  145. package/dist/ports.js +2 -0
  146. package/dist/ports.js.map +1 -0
  147. package/dist/profile.d.ts +56 -0
  148. package/dist/profile.d.ts.map +1 -0
  149. package/dist/profile.js +193 -0
  150. package/dist/profile.js.map +1 -0
  151. package/dist/prompts.d.ts +14 -0
  152. package/dist/prompts.d.ts.map +1 -0
  153. package/dist/prompts.js +69 -0
  154. package/dist/prompts.js.map +1 -0
  155. package/dist/receive.d.ts +134 -0
  156. package/dist/receive.d.ts.map +1 -0
  157. package/dist/receive.js +317 -0
  158. package/dist/receive.js.map +1 -0
  159. package/dist/results.d.ts +173 -0
  160. package/dist/results.d.ts.map +1 -0
  161. package/dist/results.js +21 -0
  162. package/dist/results.js.map +1 -0
  163. package/dist/schemas.d.ts.map +1 -1
  164. package/dist/schemas.js +45 -38
  165. package/dist/schemas.js.map +1 -1
  166. package/dist/sha256.d.ts +3 -0
  167. package/dist/sha256.d.ts.map +1 -0
  168. package/dist/sha256.js +69 -0
  169. package/dist/sha256.js.map +1 -0
  170. package/dist/star.d.ts +31 -0
  171. package/dist/star.d.ts.map +1 -0
  172. package/dist/star.js +56 -0
  173. package/dist/star.js.map +1 -0
  174. package/dist/state-builder.d.ts +42 -0
  175. package/dist/state-builder.d.ts.map +1 -0
  176. package/dist/state-builder.js +100 -0
  177. package/dist/state-builder.js.map +1 -0
  178. package/dist/state.d.ts +914 -0
  179. package/dist/state.d.ts.map +1 -0
  180. package/dist/state.js +37 -0
  181. package/dist/state.js.map +1 -0
  182. package/dist/store-contract.d.ts +11 -0
  183. package/dist/store-contract.d.ts.map +1 -0
  184. package/dist/store-contract.js +189 -0
  185. package/dist/store-contract.js.map +1 -0
  186. package/dist/store-memory.d.ts +8 -0
  187. package/dist/store-memory.d.ts.map +1 -0
  188. package/dist/store-memory.js +17 -0
  189. package/dist/store-memory.js.map +1 -0
  190. package/dist/testing.d.ts +22 -0
  191. package/dist/testing.d.ts.map +1 -0
  192. package/dist/testing.js +21 -0
  193. package/dist/testing.js.map +1 -0
  194. package/dist/trust/continuity.d.ts +71 -0
  195. package/dist/trust/continuity.d.ts.map +1 -0
  196. package/dist/trust/continuity.js +1222 -0
  197. package/dist/trust/continuity.js.map +1 -0
  198. package/dist/trust/duties.d.ts +67 -0
  199. package/dist/trust/duties.d.ts.map +1 -0
  200. package/dist/trust/duties.js +179 -0
  201. package/dist/trust/duties.js.map +1 -0
  202. package/dist/trust/entries.d.ts +139 -0
  203. package/dist/trust/entries.d.ts.map +1 -0
  204. package/dist/trust/entries.js +795 -0
  205. package/dist/trust/entries.js.map +1 -0
  206. package/dist/trust/group-star.d.ts +43 -0
  207. package/dist/trust/group-star.d.ts.map +1 -0
  208. package/dist/trust/group-star.js +188 -0
  209. package/dist/trust/group-star.js.map +1 -0
  210. package/dist/trust/mapping.d.ts +56 -0
  211. package/dist/trust/mapping.d.ts.map +1 -0
  212. package/dist/trust/mapping.js +584 -0
  213. package/dist/trust/mapping.js.map +1 -0
  214. package/dist/trust/profile.d.ts +25 -0
  215. package/dist/trust/profile.d.ts.map +1 -0
  216. package/dist/trust/profile.js +249 -0
  217. package/dist/trust/profile.js.map +1 -0
  218. package/dist/trust/star.d.ts +208 -0
  219. package/dist/trust/star.d.ts.map +1 -0
  220. package/dist/trust/star.js +588 -0
  221. package/dist/trust/star.js.map +1 -0
  222. package/dist/trust/state.d.ts +83 -0
  223. package/dist/trust/state.d.ts.map +1 -0
  224. package/dist/trust/state.js +154 -0
  225. package/dist/trust/state.js.map +1 -0
  226. package/dist/util-freeze.d.ts +3 -0
  227. package/dist/util-freeze.d.ts.map +1 -0
  228. package/dist/util-freeze.js +11 -0
  229. package/dist/util-freeze.js.map +1 -0
  230. package/dist/views.d.ts +179 -0
  231. package/dist/views.d.ts.map +1 -0
  232. package/dist/views.js +286 -0
  233. package/dist/views.js.map +1 -0
  234. package/dist/visibility.d.ts +5 -5
  235. package/dist/visibility.d.ts.map +1 -1
  236. package/dist/visibility.js +22 -28
  237. package/dist/visibility.js.map +1 -1
  238. package/dist/wire.d.ts +218 -83
  239. package/dist/wire.d.ts.map +1 -1
  240. package/dist/wire.js.map +1 -1
  241. package/package.json +60 -10
  242. package/schemas/holder-state-v1.schema.json +3880 -0
  243. package/schemas/holder-state-v2.schema.json +4123 -0
  244. package/dist/holder.d.ts.map +0 -1
  245. package/dist/holder.js.map +0 -1
  246. package/dist/probe/acks.d.ts +0 -27
  247. package/dist/probe/acks.d.ts.map +0 -1
  248. package/dist/probe/acks.js +0 -152
  249. package/dist/probe/acks.js.map +0 -1
  250. package/dist/probe/continuity.d.ts +0 -20
  251. package/dist/probe/continuity.d.ts.map +0 -1
  252. package/dist/probe/continuity.js +0 -805
  253. package/dist/probe/continuity.js.map +0 -1
  254. package/dist/probe/deps.d.ts +0 -61
  255. package/dist/probe/deps.d.ts.map +0 -1
  256. package/dist/probe/deps.js +0 -54
  257. package/dist/probe/deps.js.map +0 -1
  258. package/dist/probe/encounter.d.ts +0 -26
  259. package/dist/probe/encounter.d.ts.map +0 -1
  260. package/dist/probe/encounter.js +0 -938
  261. package/dist/probe/encounter.js.map +0 -1
  262. package/dist/probe/introduce.d.ts +0 -62
  263. package/dist/probe/introduce.d.ts.map +0 -1
  264. package/dist/probe/introduce.js +0 -306
  265. package/dist/probe/introduce.js.map +0 -1
  266. package/dist/probe/membership.d.ts +0 -96
  267. package/dist/probe/membership.d.ts.map +0 -1
  268. package/dist/probe/membership.js +0 -467
  269. package/dist/probe/membership.js.map +0 -1
  270. package/dist/probe/trust.d.ts +0 -156
  271. package/dist/probe/trust.d.ts.map +0 -1
  272. package/dist/probe/trust.js +0 -1233
  273. package/dist/probe/trust.js.map +0 -1
  274. package/dist/probe.d.ts +0 -7
  275. package/dist/probe.d.ts.map +0 -1
  276. package/dist/probe.js +0 -42
  277. package/dist/probe.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariants.js","sourceRoot":"","sources":["../src/invariants.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,yEAAyE;AACzE,yEAAyE;AACzE,wDAAwD;AACxD,qEAAqE;AACrE,0EAA0E;AAC1E,qEAAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,EAAE;AACF,oCAAoC;AACpC,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,uDAAuD;AACvD,0EAA0E;AAC1E,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,wEAAwE;AACxE,yEAAyE;AACzE,0DAA0D;AAC1D,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,iCAAiC;AACjC,0EAA0E;AAC1E,sEAAsE;AACtE,oEAAoE;AACpE,wDAAwD;AACxD,2EAA2E;AAC3E,uEAAuE;AACvE,qEAAqE;AACrE,gCAAgC;AAChC,0EAA0E;AAC1E,4EAA4E;AAC5E,iDAAiD;AACjD,0EAA0E;AAC1E,uEAAuE;AACvE,wEAAwE;AACxE,oEAAoE;AACpE,mDAAmD;AACnD,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,yEAAyE;AACzE,oEAAoE;AACpE,2EAA2E;AAC3E,4EAA4E;AAC5E,+DAA+D;AAC/D,0EAA0E;AAC1E,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,qEAAqE;AACrE,sEAAsE;AACtE,EAAE;AACF,uEAA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AAS;IACT,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAAE,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAA;IACjO,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAA6B,EAAE,KAA4B,EAAE,EAAY,EAAe,EAAE,CACzH,CAAC,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA","sourcesContent":["// invariants — predicates over one holder state and over one commit\n// (before, after), for tests and an optional runtime check (lib Stage 2,\n// note §4.7). createHolder(ports, {invariants: true}) runs them on every\n// commit, before the store's CAS, and throws InfraError\n// 'invariant-violated' with the violations as its cause: a violating\n// state never lands. A testing mode, not a production guard; the property\n// generator (test/invariants.test.mjs) checks them after every step.\n//\n// Rule numbers: bare four-digit numbers are RLTP-TRU (trust-layer.md);\n// Identity §n is identity-layer.md, Delivery §n delivery-contract.md.\n//\n// Over one state (stateViolations):\n// register every revocation mark names a held device name; the\n// lineage is chained (each prev the preceding next) and no\n// longer than the head allows; at most one rotation runs,\n// from the head to the next generation, its label persisted\n// (6360), its step-2 duty open; a rotation duty names a\n// running rotation (Identity §5.4, §5.5)\n// entries every tuple's entryId names a contact or an alias (2145);\n// every contact's relIds exist, are distinct, are no husks;\n// every relationship's contactId resolves (2090, 2140);\n// an id or alias names one contact only, never itself as an\n// alias (2140); every live relationship belongs to the entry\n// its identity resolves to and to the entry its active tuple\n// feeds, and otherwise only to entries one of its tuples\n// names: an earlier appended tuple's entry stays behind the\n// chain after a later re-encounter appended another, until a\n// merge duty merges them (2145, 2146); a position exactly\n// where the status is not `none` (2060, 2250); the matches\n// of an accepted star name contacts (6160);\n// entry positions are distinct and below nextPos (2120);\n// entryOrder.heads names each live relationship once (2180)\n// head an entry all of whose relationships feed it holds as its\n// anchor head one of their newest heads, none where they\n// hold none (6560)\n// bindings every binding list is non-empty, sorted and distinct; two\n// bindings for one anchor are the flagged conflict of a\n// chaining's union (6610); two links from one prev to\n// different nexts only beside such a flag\n// salts per tuple and reconciled artifact: every in-flight salt in\n// [1, lastSalt], hwm ≤ lastSalt, snapshot and its digest\n// present together (5630, 5660, 5690); probe sequences\n// likewise (6680)\n// assembly an open assembly's salt lies above both the completed hwm\n// and the lower bound (5150, 5366); an accepted star or group\n// star carries the hwm as its salt\n// duties a class duty (class-on, reissue-mapping, profile) is owed\n// on an existing relationship that is no husk, under the\n// entry its verifications go to, whose class is on (6410,\n// 2790: the drop rule holds); a class-on duty has its\n// deterministic id (trust/duties.ts)\n// encounter no challenge both open and recorded (5220); challenge and\n// record labels in the register (4110); a scanner's record\n// holds its credential (5630), a pending counter document its\n// credential (5770); an encounter-confirm prompt names a record\n// groups the own member anchor on a held roster, its label in the\n// register; no evidence for a member already admitted\n// introductions a mediator completes only with ack, reply forwarded and\n// vouchers sent (8360); completed, consented and vouched hold\n// a reply; forwarded holds the target pin (8270)\n// owed a duty class on for a live relationship (2850, 6595) with\n// an artifact to send has it out or owed there: the anchor\n// mapping issued on the active tuple or a class-on or\n// re-issue duty open on it; the profile (once one exists)\n// issued at the counter's revision on the active tuple\n// (profileOut) or a class-on or profile duty open on it\n//\n// messages a block names a relationship the holder holds (Message\n// Tasks 6010)\n//\n// Over one commit (transitionViolations):\n// commitSeq strictly +1 per commit; lastWhen never falls (4.7)\n// register labels, pair nonces, carriers, device names and revocation\n// marks only grow; the community keeps its genesis and its\n// head never falls; the lineage only extends (Identity §2); a\n// device.added of an act never names a name revoked before\n// (§5.5); names and marks are sets (a state check); the head\n// moves one generation at a time, with exactly one lineage\n// element, onto a label persisted in an earlier commit (6360)\n// profile the own profile's one counter never falls and its content\n// changes only with it (6450)\n// addresses tombstones never shrink; a key leaves only as a tombstone,\n// a member key (group/…, an identity context) excepted\n// (Delivery §5)\n// salts per tuple label: lastSalt, probe seq and the issued\n// revisions never fall, exhausted is sticky, a new in-flight\n// salt is above the old lastSalt (a salt is never issued\n// twice, 5110) with the digest of its view; what a salt or\n// probe committed (view, viewDigest, digests) never changes,\n// only acked grows within its digests (5130; a rename may\n// rewrite the star's members, 2100); an entry leaves only\n// completed at or below hwm, or with no document left in the\n// outbox; hwm and lowerBound never fall (5140, 5366)\n// baseline hwm, snapshot and snapshotDigest change only together,\n// upward, by the delivery-ack that completes the in-flight\n// entry of the new hwm, to that entry's view (5660, 5670,\n// 5680; star and group star); a rename rewrites the star\n// baseline's members only. The probe's done is sticky and\n// set only by the ack completing a probe (6830)\n// tuples a tuple new in this commit carries fresh per-tuple state:\n// every salt, revision and sequence at 0, no baseline,\n// assembly, in-flight entry or verified artifact (6250)\n// positions a position once assigned stays with its entry (2120,\n// 2190; after a split with what remains of it, 2080, 2100):\n// it leaves only with the entry, merged into one at an\n// earlier position or departed, and is never assigned again;\n// nextPos never falls; entryOrder.heads only appends, a\n// departed relationship leaving it and a chaining moving the\n// chain into the appended relationship's place (2180)\n// bindings a second binding for one anchor arises only where a\n// chaining appended a tuple in this commit (6610, the union of\n// 4c); a relationship's held anchor head moves only along the\n// links it holds (6150, 6170), except at such a chaining\n// messages the record of surfaced invitations and the register of\n// declined ones only grow (RLTP-MT-3130, RLTP-MSG-6310); a\n// block is set only by the block act, a merge, or a\n// chaining that absorbs a blocked fresh relationship (6030),\n// cleared only by the block act or with its relationship; a\n// completion-record entry never changes and leaves only by\n// tick (4340); an inbox entry arises only in a unique\n// receive of its document, with its record entry, and leaves\n// only by the take-over (4420)\n// outbox `accepted` appears only through report; a new item starts\n// submitted (Delivery §6.1, note §4.3)\n// effects a new cache entry only through a unique receive, one, the\n// document's digest; entries leave only by tick (Delivery\n// 4.2)\n// duties a duty disappears only where a rule lets it (dutyDrops):\n// (a) fulfilment: resume ran its handler and the handler\n// returned Applied in this commit (CommitOp.fulfilled)\n// (b) the drop rules: a class duty whose class is off toward\n// the entry its relationship's verifications go to (6410,\n// 2790; a split's 2115 included), any known duty whose\n// relationship departed or became a husk (2260, the move\n// at a chaining)\n// (c) the merge into one of its kind owed on the same\n// relationship with its urgency kept: a re-issue into one\n// no later and not waiting where it was due (awaitHead\n// null wins, 6596), a profile duty into one of no lower\n// revision\n// (d) the same delivery: an anchor mapping issued on the\n// relationship in this commit meets every class-on and\n// re-issue of the anchor mapping owed there (6596); a\n// profile issued there (its revision rose on the active\n// tuple, or a profile duty owed there was fulfilled)\n// meets every class-on and profile duty owed there\n// (e) a received document that ends its continuity step: a\n// probe duty by the ack that completes an in-flight probe\n// (done set in this commit, 6830); a mapping duty by its\n// current issuance answered (aligned in this commit) —\n// the ack of one of that issuance's documents, or a\n// continuity mapping arriving on the tuple (6850)\n// (f) a rotation duty, by its rotation's completion in this\n// commit (the act's step 2: the head moved, the rotation\n// gone)\n// expiry: no duty kind expires yet. A duty of a kind (or\n// version) the library does not know leaves only by (a), a\n// module's handler: never where none is registered\n// journal act records leave only by tick (retention)\n// encounter records only grow, a credential held in a direction never\n// changes (5.6 step 8, 5660); a challenge leaves only into a\n// record or aged at lastWhen (5290)\n// introductions an act leaves only past its absolute lifetime (8310)\n// groups a held group and its roster members stay (removal is not built)\n//\n// Choices where the brief and the note leave them open (PR 5):\n// - \"effects holds only completed digests\" is read as: an entry enters\n// only with the stage-9 commit of a unique receive. A chunk held in an\n// open assembly is such a completed effect (every chunk is acked on\n// its own, Delivery 4.2, 5.2a), so \"no effect digest in an open\n// assembly\" would contradict the per-chunk ack; it is not checked\n// - \"lowerBound ≥ hwm when set\" does not hold: a discard raises the lower\n// bound to a salt above hwm, and a later, higher salt completing\n// raises hwm past it (5140, 5366). Checked instead: both never fall,\n// and an open assembly lies above both\nimport { MESSAGE_LIFETIME_MS } from './message.js'\nimport { jcs } from './core.js'\nimport { triasOf } from './state.js'\nimport type { Contact, Duty, HolderState, Relationship, SeqIn, SeqOut, Tuple } from './state.js'\nimport { ADMISSION_BOUND, classOnToward, entryOf, entryRelationships, feeding, findContact, liveRel, newestHeads, newestOf } from './trust/state.js'\nimport { classOfDuty, classOnId, hasArtifact, onFor, owedOn } from './trust/duties.js'\nimport { CONTINUITY_MAPPING_TYPE, CONTINUITY_PROBE_TYPE } from './trust/continuity.js'\nimport { viewDigest } from './trust/star.js'\nimport { isKnownDuty } from './codec.js'\nimport type { HolderEvent } from './events.js'\nimport { communityLabel } from './identity.js'\nimport { challengeAged } from './encounter.js'\nimport { ACT_EXPIRY, ACT_SKEW } from './introduction.js'\n\n/** What a commit was: the operation that produced it. */\nexport type CommitOp =\n /** events: what the act announces (the engine passes them) */\n | { kind: 'act', command: string, events?: readonly HolderEvent[] }\n | { kind: 'tick' }\n /** fulfilled: the duties whose handler returned Applied in this commit */\n | { kind: 'resume', fulfilled?: readonly string[] }\n | { kind: 'report', status?: string }\n /** type: the received document's; ref: the acknowledged outbox digest of\n * a delivery-ack; rkid: the own key the document arrived on */\n | { kind: 'receive', disposition?: string, digest?: string, type?: string, ref?: string, rkid?: string }\n\n/** One broken invariant: its name (as in the header) and what broke it. */\nexport interface Violation { invariant: string, detail: string }\n\nconst cmp = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0)\nconst big = (d: string): bigint => BigInt(d)\nconst isHusk = (r: Readonly<Relationship>): boolean => r.chainedInto !== null\n\n// ── one state ──────────────────────────────────────────────────────────\n\nfunction seqOutViolations (v: Violation[], where: string, o: Readonly<SeqOut<unknown>>): void {\n const last = big(o.lastSalt)\n for (const salt of Object.keys(o.inflight)) {\n if (big(salt) < 1n || big(salt) > last) v.push({ invariant: 'salts', detail: `${where}: in-flight salt ${salt} outside [1, lastSalt ${o.lastSalt}]` })\n }\n if (big(o.hwm) > last) v.push({ invariant: 'salts', detail: `${where}: hwm ${o.hwm} above lastSalt ${o.lastSalt}` })\n if ((o.snapshot === null) !== (o.snapshotDigest === null)) v.push({ invariant: 'salts', detail: `${where}: snapshot and snapshotDigest not together` })\n if (o.exhausted && last < ADMISSION_BOUND) v.push({ invariant: 'salts', detail: `${where}: exhausted below the bound` })\n}\n\nfunction seqInViolations (v: Violation[], where: string, i: Readonly<SeqIn<{ salt: string } | unknown>>, accepted: boolean): void {\n if (i.assembly !== null) {\n const s = big(i.assembly.salt)\n if (s <= big(i.hwm) || s <= big(i.lowerBound)) v.push({ invariant: 'assembly', detail: `${where}: open assembly at salt ${i.assembly.salt} not above hwm ${i.hwm} and lowerBound ${i.lowerBound}` })\n }\n if (accepted && i.accepted !== null && (i.accepted as { salt: string }).salt !== i.hwm) {\n v.push({ invariant: 'assembly', detail: `${where}: accepted salt ${(i.accepted as { salt: string }).salt} is not hwm ${i.hwm}` })\n }\n}\n\nfunction tupleViolations (v: Violation[], state: Readonly<HolderState>, r: Readonly<Relationship>, t: Readonly<Tuple>): void {\n const where = `${r.id}/${t.ownPairLabel}`\n if (!findContact(state, t.entryId)) v.push({ invariant: 'entries', detail: `${where}: entryId ${t.entryId} names no contact` })\n seqOutViolations(v, `${where} starOut`, t.starOut)\n seqOutViolations(v, `${where} groupStarOut`, t.groupStarOut)\n for (const p of Object.keys(t.probeOut.inflight)) {\n if (big(p) < 1n || big(p) > big(t.probeOut.seq)) v.push({ invariant: 'salts', detail: `${where}: probe ${p} outside [1, seq ${t.probeOut.seq}]` })\n }\n seqInViolations(v, `${where} starIn`, t.starIn, true)\n seqInViolations(v, `${where} groupStarIn`, t.groupStarIn, true)\n seqInViolations(v, `${where} probeIn`, { ...t.probeIn, accepted: null }, false)\n}\n\nfunction dutyViolations (v: Violation[], state: Readonly<HolderState>, d: Readonly<Duty>): void {\n const cls = classOfDuty(d as Duty)\n if (cls === null) return\n const relId = (d as { relId: string }).relId\n if (d.kind === 'class-on' && d.id !== classOnId(cls, relId)) v.push({ invariant: 'duties', detail: `${d.id}: a class-on duty's id is ${classOnId(cls, relId)}` })\n if (!Object.hasOwn(state.relationships, relId) || isHusk(state.relationships[relId])) {\n v.push({ invariant: 'duties', detail: `${d.id}: owed on ${relId}, which is gone or a husk` })\n return\n }\n const e = entryOf(state, state.relationships[relId])\n const named = findContact(state, (d as { contactId: string }).contactId)\n if (!e || !named || named.id !== e.id) v.push({ invariant: 'duties', detail: `${d.id}: owed under ${(d as { contactId: string }).contactId}, not the entry ${e?.id} its relationship's verifications go to` })\n else if (!classOnToward(e, cls)) v.push({ invariant: 'duties', detail: `${d.id}: the class ${cls} is off toward ${e.id} (6410)` })\n}\n\n/** The register (Identity §2, §5.4, §5.5) and the running rotations. */\nfunction registerViolations (v: Violation[], state: Readonly<HolderState>): void {\n const r = state.register\n for (const n of r.devices.revoked) if (!r.devices.names.includes(n)) v.push({ invariant: 'register', detail: `revocation mark ${n} without its device name` })\n if (new Set(r.devices.names).size !== r.devices.names.length || new Set(r.devices.revoked).size !== r.devices.revoked.length) v.push({ invariant: 'register', detail: 'device names or revocation marks repeat: they are sets' })\n const lin = r.lineage as Array<{ body?: { prev?: unknown, next?: unknown } }>\n for (let i = 1; i < lin.length; i++) if (lin[i].body?.prev !== lin[i - 1].body?.next) v.push({ invariant: 'register', detail: `lineage element ${i} does not continue element ${i - 1}` })\n if (r.community !== null && big(r.community.head) - 1n < BigInt(lin.length)) v.push({ invariant: 'register', detail: `${lin.length} lineage elements beyond head ${r.community.head}` })\n for (const rot of Object.values(state.rotations)) {\n if (r.community === null || big(rot.from) !== big(r.community.head) || big(rot.to) !== big(rot.from) + 1n) v.push({ invariant: 'register', detail: `rotation ${rot.id} ${rot.from} → ${rot.to} does not start at the head ${r.community?.head}` })\n else if (!r.labels.includes(communityLabel(r.community.genesis, Number(rot.to)))) v.push({ invariant: 'register', detail: `rotation ${rot.id}: the label of generation ${rot.to} is not persisted (6360)` })\n }\n if (Object.keys(state.rotations).length > 1) v.push({ invariant: 'register', detail: 'more than one rotation running' })\n // a running rotation has its step-2 duty open, and a rotation duty names a running rotation\n for (const rot of Object.values(state.rotations)) {\n if (!Object.values(state.duties).some((d) => d.kind === 'rotation' && (d as { rotationId?: unknown }).rotationId === rot.id)) v.push({ invariant: 'register', detail: `rotation ${rot.id} has no rotation duty: it would never complete` })\n }\n for (const d of Object.values(state.duties)) {\n if (d.kind === 'rotation' && isKnownDuty(d) && !Object.hasOwn(state.rotations, (d as { rotationId: string }).rotationId)) v.push({ invariant: 'duties', detail: `${d.id}: no rotation ${(d as { rotationId: string }).rotationId} runs` })\n }\n}\n\n/** The invariants of one state (see the header); empty where all hold. */\n/** The encounter, the groups and the introduction acts (PR 7a). */\nfunction socialViolations (v: Violation[], state: Readonly<HolderState>): void {\n const labels = new Set(state.register.labels)\n const e = state.encounter\n for (const c of Object.values(e.challenges)) {\n if (Object.hasOwn(e.records, c.value)) v.push({ invariant: 'encounter', detail: `challenge ${c.value} both open and recorded (5220)` })\n if (!labels.has(c.label)) v.push({ invariant: 'encounter', detail: `challenge ${c.value}: its label is not in the register (4110)` })\n }\n for (const r of Object.values(e.records)) {\n if (!labels.has(r.label)) v.push({ invariant: 'encounter', detail: `record ${r.own}: its label is not in the register (4110)` })\n if (r.role === 'scanner' && r.out === null) v.push({ invariant: 'encounter', detail: `record ${r.own}: a scanner's record without its step credential (5630)` })\n if (r.counterPending && r.out === null) v.push({ invariant: 'encounter', detail: `record ${r.own}: a counter document pending without the credential (5770)` })\n }\n for (const p of Object.values(state.prompts)) {\n if (p.kind === 'encounter-confirm' && !Object.hasOwn(e.records, p.id.slice('encounter:'.length))) v.push({ invariant: 'encounter', detail: `prompt ${p.id} names no record` })\n }\n for (const g of Object.values(state.groups)) {\n if (g.memberAnchor !== undefined && Object.keys(g.roster).length && !Object.hasOwn(g.roster, g.memberAnchor)) v.push({ invariant: 'groups', detail: `${g.id}: the own member anchor is not on the roster` })\n if (Object.keys(g.roster).length && !labels.has(g.memberLabel)) v.push({ invariant: 'groups', detail: `${g.id}: the member label is not in the register` })\n for (const ev of Object.values(g.evidence)) {\n const subject = (ev.accept as { payload?: { accept?: { subject?: string } } }).payload?.accept?.subject\n if (subject !== undefined && Object.hasOwn(g.roster, subject)) v.push({ invariant: 'groups', detail: `${g.id}: evidence held for a member already admitted` })\n }\n }\n for (const a of Object.values(e.introductions)) {\n if (a.role === 'mediator' && a.status === 'completed' && !(a.ack !== null && a.replyForwarded && a.vouchersSent)) v.push({ invariant: 'introductions', detail: `${a.key}: completed without its three duties (8360)` })\n if (a.vouched !== (a.voucher !== null)) v.push({ invariant: 'introductions', detail: `${a.key}: vouched without its retained voucher, or the reverse (8200)` })\n if ((a.status === 'completed' && a.role === 'requester') || a.status === 'consented' || a.vouched) {\n if (a.reply === null) v.push({ invariant: 'introductions', detail: `${a.key}: ${a.status}${a.vouched ? ', vouched' : ''} without a reply` })\n }\n if (a.role === 'mediator' && a.status === 'forwarded' && a.pins.target === undefined) v.push({ invariant: 'introductions', detail: `${a.key}: forwarded without a target pin (8270)` })\n }\n}\n\nexport function stateViolations (state: Readonly<HolderState>): Violation[] {\n const v: Violation[] = []\n registerViolations(v, state)\n // a block names a relationship the holder holds (Message Tasks 6010)\n for (const r of state.messages.blocked) if (!Object.hasOwn(state.relationships, r)) v.push({ invariant: 'messages', detail: `blocked ${r} names no relationship` })\n socialViolations(v, state)\n const contacts = Object.values(state.contacts)\n const positions = new Set<string>()\n for (const c of contacts) {\n if (!c.relIds.length || new Set(c.relIds).size !== c.relIds.length) v.push({ invariant: 'entries', detail: `${c.id}: relIds ${jcs(c.relIds)} empty or repeated` })\n for (const id of c.relIds) {\n if (!Object.hasOwn(state.relationships, id)) v.push({ invariant: 'entries', detail: `${c.id}: relationship ${id} does not exist` })\n else if (isHusk(state.relationships[id])) v.push({ invariant: 'entries', detail: `${c.id}: relationship ${id} is a husk` })\n }\n if (c.pos !== null) {\n if (positions.has(c.pos)) v.push({ invariant: 'entries', detail: `${c.id}: position ${c.pos} taken twice` })\n positions.add(c.pos)\n if (big(c.pos) >= big(state.entryOrder.nextPos)) v.push({ invariant: 'entries', detail: `${c.id}: position ${c.pos} not below nextPos ${state.entryOrder.nextPos}` })\n }\n headViolations(v, state, c)\n }\n const holdersOf = new Map<string, string[]>()\n for (const c of contacts) for (const id of c.relIds) holdersOf.set(id, [...(holdersOf.get(id) ?? []), c.id])\n const names = new Map<string, string>()\n for (const c of contacts) {\n if ((c.pos === null) !== (c.status === 'none')) v.push({ invariant: 'entries', detail: `${c.id}: position ${c.pos} with status ${c.status}` })\n for (const n of [c.id, ...c.aliases]) {\n if (names.has(n)) v.push({ invariant: 'entries', detail: `${n} names ${names.get(n)} and ${c.id}` })\n names.set(n, c.id)\n }\n }\n for (const r of Object.values(state.relationships)) {\n if (!findContact(state, r.contactId)) v.push({ invariant: 'entries', detail: `${r.id}: contactId ${r.contactId} resolves to no contact` })\n if (!isHusk(r)) {\n const holders = holdersOf.get(r.id) ?? []\n const own = findContact(state, r.contactId)?.id\n const fed = entryOf(state, r)?.id\n const named = new Set(r.tuples.map((t) => findContact(state, t.entryId)?.id).filter((x): x is string => x !== undefined))\n const ok = own !== undefined && holders.includes(own) && holders.every((h) => h === own || h === fed || named.has(h)) && (fed === undefined || holders.includes(fed))\n if (!ok) v.push({ invariant: 'entries', detail: `${r.id}: held by ${jcs(holders)}, its identity resolves to ${own}, its active tuple feeds ${fed}` })\n }\n for (const t of r.tuples) {\n for (const m of t.starIn.accepted?.matches ?? []) if (!findContact(state, m)) v.push({ invariant: 'entries', detail: `${r.id}/${t.ownPairLabel}: an accepted star matches ${m}, no contact` })\n }\n for (const t of r.tuples) tupleViolations(v, state, r, t)\n for (const [anchor, list] of Object.entries(r.bindings)) {\n if (!list.length || jcs(list) !== jcs([...new Set(list)].sort(cmp))) v.push({ invariant: 'bindings', detail: `${r.id}: bindings of ${anchor} not a sorted, distinct, non-empty list` })\n }\n for (const l of r.links) {\n if (r.links.some((m) => m.prev === l.prev && m.next !== l.next) && !((r.bindings[l.prev]?.length ?? 0) > 1)) {\n v.push({ invariant: 'bindings', detail: `${r.id}: links from ${l.prev} to different nexts without a flagged binding conflict` })\n break\n }\n }\n }\n const heads = state.entryOrder.heads\n if (new Set(heads).size !== heads.length) v.push({ invariant: 'entries', detail: 'entryOrder.heads repeats a relationship' })\n for (const id of heads) if (!Object.hasOwn(state.relationships, id) || isHusk(state.relationships[id])) v.push({ invariant: 'entries', detail: `entryOrder.heads names ${id}, gone or a husk` })\n const headSet = new Set(heads)\n for (const r of Object.values(state.relationships)) if (liveRel(r) && !headSet.has(r.id)) v.push({ invariant: 'entries', detail: `${r.id} is live but not in entryOrder.heads` })\n for (const d of Object.values(state.duties)) dutyViolations(v, state, d)\n // 2850: on for a relationship, out there or owed there\n const duties = Object.values(state.duties)\n for (const r of Object.values(state.relationships)) {\n if (!liveRel(r)) continue\n for (const cls of ['anchorMapping', 'profile'] as const) {\n if (!hasArtifact(state, cls) || !onFor(state, r, cls)) continue\n const head = r.tuples.find((t) => t.ownPairLabel === r.activeHead)!\n const out = cls === 'anchorMapping' ? head.mappingOut.body !== null : head.profileOut.rev === state.profile.revision\n if (!out && !duties.some((d) => owedOn(d, r.id, cls))) v.push({ invariant: 'owed', detail: `${r.id}: the ${cls} class is on for it, nothing is out there and no duty owes it (2850)` })\n }\n }\n return v\n}\n\n/** 6560 for an entry all of whose relationships feed it. */\nfunction headViolations (v: Violation[], state: Readonly<HolderState>, c: Readonly<Contact>): void {\n const all = entryRelationships(state, c)\n const rels = feeding(state, c)\n if (all.length !== rels.length || all.length !== c.relIds.length) return\n const newest = newestHeads(rels)\n if (!newest.length ? c.anchorHead !== null : (c.anchorHead === null || !newest.includes(c.anchorHead))) {\n v.push({ invariant: 'head', detail: `${c.id}: anchor head ${c.anchorHead} is not among the newest heads ${jcs(newest)} of its relationships` })\n }\n}\n\n// ── one commit ─────────────────────────────────────────────────────────\n\nconst superset = (after: readonly string[], before: readonly string[]): string[] => {\n const a = new Set(after)\n return before.filter((x) => !a.has(x))\n}\n\n/** Every tuple by its own pair label (labels are unique per holder). */\nconst tuplesByLabel = (state: Readonly<HolderState>): Map<string, Tuple> => {\n const m = new Map<string, Tuple>()\n for (const r of Object.values(state.relationships)) for (const t of r.tuples) m.set(t.ownPairLabel, t)\n return m\n}\n\nconst dueOf = (d: Readonly<Duty>): number => (Number.isSafeInteger(d.dueAt) ? d.dueAt as number : 0)\n\n/** What a tuple new in this commit carries beyond fresh state (6250). */\nfunction freshViolations (t: Readonly<Tuple>): string[] {\n const out: string[] = []\n const seqOutFresh = (o: Readonly<SeqOut<unknown>>): boolean => o.lastSalt === '0' && o.hwm === '0' && !o.exhausted && o.snapshot === null && Object.keys(o.inflight).length === 0\n const seqInFresh = (i: Readonly<{ hwm: string, lowerBound: string, assembly: unknown, accepted?: unknown }>): boolean =>\n i.hwm === '0' && i.lowerBound === '0' && i.assembly === null && (i.accepted ?? null) === null\n if (!seqOutFresh(t.starOut)) out.push('starOut')\n if (!seqOutFresh(t.groupStarOut)) out.push('groupStarOut')\n if (!seqInFresh(t.starIn)) out.push('starIn')\n if (!seqInFresh(t.groupStarIn)) out.push('groupStarIn')\n if (!seqInFresh(t.probeIn)) out.push('probeIn')\n if (t.probeOut.seq !== '0' || Object.keys(t.probeOut.inflight).length || t.probeOut.done) out.push('probeOut')\n if (t.mappingOut.rev !== '0' || t.mappingOut.body !== null) out.push('mappingOut')\n if (t.mappingIn.rev !== '0' || t.mappingIn.body !== null) out.push('mappingIn')\n if (t.continuityOut.rev !== '0' || t.continuityOut.body !== null) out.push('continuityOut')\n if (t.continuityIn.rev !== '0' || t.continuityIn.body !== null) out.push('continuityIn')\n if (t.profileIn.rev !== '0' || t.profileIn.body !== null) out.push('profileIn')\n if (t.profileOut.rev !== '0') out.push('profileOut')\n if (t.deactivated) out.push('deactivated')\n return out\n}\n\n/**\n * 2120, 2190: a position once assigned stays with its entry. Every\n * position held before is held after, unless its entry merged into one at\n * an earlier position or left the state; a position new in this commit\n * lies at or above the old nextPos (never reused); nextPos never falls.\n */\nfunction positionViolations (v: Violation[], before: Readonly<HolderState>, after: Readonly<HolderState>): void {\n if (big(after.entryOrder.nextPos) < big(before.entryOrder.nextPos)) v.push({ invariant: 'positions', detail: `nextPos fell ${before.entryOrder.nextPos} → ${after.entryOrder.nextPos}` })\n const holder = new Map(Object.values(after.contacts).filter((c) => c.pos !== null).map((c) => [c.pos as string, c]))\n const had = new Set(Object.values(before.contacts).map((c) => c.pos).filter((p): p is string => p !== null))\n for (const c of Object.values(before.contacts)) {\n if (c.pos === null) continue\n const x = findContact(after, c.id)\n const y = holder.get(c.pos)\n if (y !== undefined) {\n // held by the same entry: the one c.id resolves to, or what remains of\n // c's entry under another identity (2100: a rename; 2080: a split whose\n // leaver took c.id, the remaining relationships keeping the position)\n if (x !== undefined && x !== y && !y.relIds.every((id) => c.relIds.includes(id))) v.push({ invariant: 'positions', detail: `${c.id}: position ${c.pos} moved to ${y.id}` })\n continue\n }\n if (x !== undefined && !(x.pos !== null && big(x.pos) < big(c.pos) && !Object.hasOwn(after.contacts, c.id))) {\n v.push({ invariant: 'positions', detail: `${c.id}: position ${c.pos} changed to ${x.pos}` })\n }\n }\n const held = holder.keys()\n for (const p of held) if (!had.has(p) && big(p) < big(before.entryOrder.nextPos)) v.push({ invariant: 'positions', detail: `position ${p} assigned again (nextPos was ${before.entryOrder.nextPos})` })\n}\n\n/**\n * 2180: entryOrder.heads only appends, except that a departed relationship\n * leaves it and a chaining puts the chain in the appended relationship's\n * place (the chain's own place leaves).\n */\nfunction headsViolations (v: Violation[], before: Readonly<HolderState>, after: Readonly<HolderState>): void {\n const into = new Map<string, string>()\n for (const r of Object.values(after.relationships)) {\n if (r.chainedInto !== null && Object.hasOwn(before.relationships, r.id) && before.relationships[r.id].chainedInto === null) into.set(r.id, r.chainedInto)\n }\n const chains = new Set(into.values())\n const inAfter = new Set(after.entryOrder.heads)\n const inBefore = new Set(before.entryOrder.heads)\n const kept = before.entryOrder.heads.filter((id) => !chains.has(id)).map((id) => into.get(id) ?? id).filter((id) => inAfter.has(id))\n const a = after.entryOrder.heads\n const added = a.slice(kept.length)\n if (jcs(a.slice(0, kept.length)) !== jcs(kept) || added.some((id) => inBefore.has(id) && !chains.has(id))) {\n v.push({ invariant: 'positions', detail: `entryOrder.heads ${jcs(before.entryOrder.heads)} → ${jcs(a)} is no append (2180)` })\n }\n}\n\n/** Whether a rule lets duty `d` of `before` be gone after the commit `op` (see the header). */\nexport function dutyDrops (before: Readonly<HolderState>, after: Readonly<HolderState>, d: Readonly<Duty>, op: CommitOp): boolean {\n // (a) a registered handler ran it (only a kind the engine registers runs)\n if (op.kind === 'resume' && (op.fulfilled ?? []).includes(d.id)) return true\n if (!isKnownDuty(d as Duty)) return false // otherwise never, on any operation\n if (d.kind === 'intro-ack') return false // only its handler's run ends it\n // (f) the rotation's step 2 completed in this commit (the act's own path)\n if (d.kind === 'rotation') {\n const id = (d as { rotationId: string }).rotationId\n return !Object.hasOwn(after.rotations, id) && after.register.community !== null && before.register.community !== null &&\n big(after.register.community.head) === big(before.register.community.head) + 1n\n }\n const relId = (d as { relId?: unknown }).relId as string\n const relGone = !Object.hasOwn(after.relationships, relId) || isHusk(after.relationships[relId])\n if (d.kind === 'merge') return false\n if (relGone) return true // (b) departed, moved\n if (d.kind === 'continuity') {\n // (e) on receive, by the end of its own step only\n if (op.kind !== 'receive') return false\n const label = (d as { tuple: string }).tuple\n const tb = tuplesByLabel(before).get(label), ta = tuplesByLabel(after).get(label)\n if (!tb || !ta) return false\n const ref = op.ref\n if ((d as { step: string }).step === 'probe') {\n // 6830: the ack that completes an in-flight probe, done set in this commit\n if (tb.probeOut.done || !ta.probeOut.done || ref === undefined) return false\n return Object.values(tb.probeOut.inflight).some((e) => e.digests.includes(ref) && e.digests.every((x) => x === ref || e.acked.includes(x)))\n }\n // 6850: the current issuance answered, aligned in this commit — by the\n // ack of one of its own documents, or by a continuity mapping on the tuple\n if (tb.continuityOut.aligned || !ta.continuityOut.aligned) return false\n if (ref !== undefined) return tb.continuityOut.sent.includes(ref) && before.outbox[ref]?.type === CONTINUITY_MAPPING_TYPE\n return op.type === CONTINUITY_MAPPING_TYPE && op.rkid === tb.rkid\n }\n const cls = classOfDuty(d as Duty)\n if (cls === null) return false\n const e = entryOf(after, after.relationships[relId])\n if (e !== undefined && !classOnToward(e, cls)) return true // (b) 6410\n // (c) merged into one of its kind on the same relationship, urgency kept\n const same = Object.values(after.duties).filter((x) => x.kind === d.kind && owedOn(x, relId, cls))\n if (d.kind === 'reissue-mapping') {\n const waits = (d as { awaitHead: string | null }).awaitHead\n if (same.some((x) => dueOf(x) <= dueOf(d) && (waits !== null || (x as { awaitHead: string | null }).awaitHead === null))) return true\n }\n if (d.kind === 'profile' && same.some((x) => BigInt((x as { rev: string }).rev) >= BigInt((d as { rev: string }).rev))) return true\n // (d) the profile went out on the relationship in this commit: its\n // revision rose there, or a profile duty owed there was fulfilled\n if (cls === 'profile') {\n const was = before.relationships[relId], now = after.relationships[relId]\n const head = now.tuples.find((x) => x.ownPairLabel === now.activeHead)\n const prior = was?.tuples.find((x) => x.ownPairLabel === now.activeHead)\n if (head && prior && big(head.profileOut.rev) > big(prior.profileOut.rev)) return true\n if (op.kind === 'resume' && (op.fulfilled ?? []).some((id) => Object.hasOwn(before.duties, id) && owedOn(before.duties[id], relId, 'profile'))) return true\n }\n // (d) the anchor mapping went out on the relationship in this commit\n if (cls === 'anchorMapping') {\n const was = before.relationships[relId], now = after.relationships[relId]\n const head = now.tuples.find((x) => x.ownPairLabel === now.activeHead)\n const prior = was?.tuples.find((x) => x.ownPairLabel === now.activeHead)\n if (head && prior && big(head.mappingOut.rev) > big(prior.mappingOut.rev)) return true\n }\n return false\n}\n\n/** A star view renamed only (2100, 2140): the same anchor heads, members renamed. */\nconst renamedOnly = (a: readonly unknown[], b: readonly unknown[]): boolean => {\n const heads = (x: readonly unknown[]): string => jcs(x.map((y) => (y as { head?: unknown }).head ?? null).sort())\n return a.length === b.length && a.every((y) => (y as { head?: unknown }).head !== undefined) && heads(a) === heads(b)\n}\n\n/**\n * One reconciled sequence's sender side over a commit (5110, 5130, 5660,\n * 5670, 5680): lastSalt, hwm and exhausted never fall back; a salt is\n * issued once, with a view whose digest is its viewDigest; what was\n * committed under a salt (view, viewDigest, digests) stays — only `acked`\n * grows, within the digests — except that a rename rewrites the members\n * of the star's views (`renames`); an entry leaves only once completed at\n * or below hwm or once none of its documents is in the outbox; the\n * baseline (hwm, snapshot, snapshotDigest) changes only together, upward,\n * by the ack (`ack`) that completes the in-flight entry of the new hwm,\n * to that entry's view.\n */\nfunction seqOutTransition (v: Violation[], where: string, b: Readonly<SeqOut<unknown>>, a: Readonly<SeqOut<unknown>>, after: Readonly<HolderState>, ack: string | undefined, renames: boolean): void {\n if (big(a.lastSalt) < big(b.lastSalt)) v.push({ invariant: 'salts', detail: `${where}: lastSalt fell ${b.lastSalt} → ${a.lastSalt}` })\n if (b.exhausted && !a.exhausted) v.push({ invariant: 'salts', detail: `${where}: exhausted is sticky` })\n if (big(a.hwm) < big(b.hwm)) v.push({ invariant: 'salts', detail: `${where}: hwm fell ${b.hwm} → ${a.hwm}` })\n for (const [s, e] of Object.entries(a.inflight)) {\n const was = Object.hasOwn(b.inflight, s) ? b.inflight[s] : undefined\n if (!was) {\n if (big(s) <= big(b.lastSalt)) v.push({ invariant: 'salts', detail: `${where}: salt ${s} issued again (lastSalt was ${b.lastSalt})` })\n if (e.viewDigest !== viewDigest(e.view)) v.push({ invariant: 'salts', detail: `${where}: salt ${s} issued with a viewDigest not of its view` })\n if (e.acked.length) v.push({ invariant: 'salts', detail: `${where}: salt ${s} issued already acked` })\n continue\n }\n if (jcs(e.digests) !== jcs(was.digests)) v.push({ invariant: 'salts', detail: `${where}: the documents of salt ${s} changed` })\n if (jcs(e.view) !== jcs(was.view) || e.viewDigest !== was.viewDigest) {\n if (!(renames && renamedOnly(e.view, was.view) && e.viewDigest === viewDigest(e.view))) v.push({ invariant: 'salts', detail: `${where}: the view of salt ${s} changed` })\n }\n if (was.acked.some((x) => !e.acked.includes(x)) || e.acked.some((x) => !e.digests.includes(x))) v.push({ invariant: 'salts', detail: `${where}: acked of salt ${s} shrank or left its digests` })\n }\n for (const [s, e] of Object.entries(b.inflight)) {\n if (Object.hasOwn(a.inflight, s)) continue\n if (big(s) > big(a.hwm) && e.digests.some((x) => Object.hasOwn(after.outbox, x))) v.push({ invariant: 'salts', detail: `${where}: salt ${s} left in flight above hwm ${a.hwm} with documents still in the outbox` })\n }\n const baseline = a.hwm !== b.hwm || jcs(a.snapshot) !== jcs(b.snapshot) || a.snapshotDigest !== b.snapshotDigest\n if (!baseline) return\n if (a.hwm === b.hwm) {\n // only a rename rewrites the baseline's members, never its heads (2100)\n if (!(renames && a.snapshot !== null && b.snapshot !== null && renamedOnly(a.snapshot, b.snapshot) && a.snapshotDigest === viewDigest(a.snapshot))) {\n v.push({ invariant: 'baseline', detail: `${where}: the baseline changed at hwm ${a.hwm} without a completion (5670, 5680)` })\n }\n return\n }\n const e = Object.hasOwn(b.inflight, a.hwm) ? b.inflight[a.hwm] : undefined\n if (!e || ack === undefined || !e.digests.includes(ack) || e.digests.some((x) => x !== ack && !e.acked.includes(x))) {\n v.push({ invariant: 'baseline', detail: `${where}: hwm ${b.hwm} → ${a.hwm} without the ack that completes salt ${a.hwm} (5660)` })\n } else if (jcs(a.snapshot) !== jcs(e.view) || a.snapshotDigest !== e.viewDigest) {\n v.push({ invariant: 'baseline', detail: `${where}: the baseline at hwm ${a.hwm} is not the view sent under it (5670)` })\n }\n}\n\n/** The probe's sender side over a commit (6680, 6830): seq never falls; a\n * probe's documents stay, `acked` grows within them; `done` is sticky and\n * set only by the ack completing an in-flight probe, which empties the\n * in-flight set; otherwise an entry leaves only with its documents gone\n * from the outbox. */\nfunction probeTransition (v: Violation[], where: string, b: Readonly<Tuple['probeOut']>, a: Readonly<Tuple['probeOut']>, after: Readonly<HolderState>, ack: string | undefined): void {\n if (big(a.seq) < big(b.seq)) v.push({ invariant: 'salts', detail: `${where}: probe seq fell` })\n if (b.done && !a.done) v.push({ invariant: 'baseline', detail: `${where}: probe done is sticky` })\n const completed = !b.done && a.done\n if (completed && !Object.values(b.inflight).some((e) => ack !== undefined && e.digests.includes(ack) && e.digests.every((x) => x === ack || e.acked.includes(x)))) {\n v.push({ invariant: 'baseline', detail: `${where}: probe done without the ack completing one (6830)` })\n }\n for (const [s, e] of Object.entries(a.inflight)) {\n const was = Object.hasOwn(b.inflight, s) ? b.inflight[s] : undefined\n if (!was) { if (big(s) <= big(b.seq)) v.push({ invariant: 'salts', detail: `${where}: probe ${s} issued again` }); continue }\n if (jcs(e.digests) !== jcs(was.digests)) v.push({ invariant: 'salts', detail: `${where}: the documents of probe ${s} changed` })\n if (was.acked.some((x) => !e.acked.includes(x)) || e.acked.some((x) => !e.digests.includes(x))) v.push({ invariant: 'salts', detail: `${where}: acked of probe ${s} shrank or left its digests` })\n }\n if (completed) return\n for (const [s, e] of Object.entries(b.inflight)) {\n if (!Object.hasOwn(a.inflight, s) && e.digests.some((x) => Object.hasOwn(after.outbox, x))) v.push({ invariant: 'salts', detail: `${where}: probe ${s} left in flight with documents still in the outbox` })\n }\n}\n\nfunction seqInTransition (v: Violation[], where: string, b: Readonly<{ hwm: string, lowerBound: string }>, a: Readonly<{ hwm: string, lowerBound: string }>): void {\n if (big(a.hwm) < big(b.hwm)) v.push({ invariant: 'salts', detail: `${where}: received hwm fell ${b.hwm} → ${a.hwm}` })\n if (big(a.lowerBound) < big(b.lowerBound)) v.push({ invariant: 'salts', detail: `${where}: lowerBound fell ${b.lowerBound} → ${a.lowerBound}` })\n}\n\n/** The invariants of one commit from `before` to `after` by `op` (see the header). */\nexport function transitionViolations (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp): Violation[] {\n const v: Violation[] = []\n // the encounter (5.3, 5.5, 5.6): records only grow and a credential once\n // held in a direction stays; a challenge leaves only into a record or aged\n for (const [own, r] of Object.entries(before.encounter.records)) {\n const a = after.encounter.records[own]\n if (!a) { v.push({ invariant: 'encounter', detail: `record ${own} removed` }); continue }\n for (const dir of ['in', 'out'] as const) {\n if (r[dir] !== null && (a[dir] === null || a[dir]!.digest !== r[dir]!.digest)) v.push({ invariant: 'encounter', detail: `record ${own}: the ${dir} credential changed (5.6 step 8, 5660)` })\n }\n }\n for (const [value, c] of Object.entries(before.encounter.challenges)) {\n if (Object.hasOwn(after.encounter.challenges, value) || Object.hasOwn(after.encounter.records, value)) continue\n if (!challengeAged(c.tCh, after.lastWhen)) v.push({ invariant: 'encounter', detail: `challenge ${value} left neither recorded nor aged (5290)` })\n }\n // introduction acts leave only past their absolute lifetime (8310)\n for (const [k, a] of Object.entries(before.encounter.introductions)) {\n if (!Object.hasOwn(after.encounter.introductions, k) && after.lastWhen < a.issuedAt + ACT_EXPIRY + ACT_SKEW) v.push({ invariant: 'introductions', detail: `${k} discarded before its lifetime ended` })\n }\n // the record of surfaced invitations and the register of declined ones\n // only grow, for the life of the holder (RLTP-MT-3130, RLTP-MSG-6310)\n for (const [what, b, a] of [['surfaced', before.joining.surfaced, after.joining.surfaced], ['declined', before.joining.declined, after.joining.declined]] as const) {\n const gone = superset(a, b)\n if (gone.length) v.push({ invariant: 'messages', detail: `joining.${what} lost ${jcs(gone)}` })\n }\n // the completion record (Message Tasks 4.4): an entry never changes its\n // body digest and leaves only by tick (4340); the inbox (4.5): an entry\n // arises only in a unique receive, with its record entry, and leaves only\n // by the application's take-over (4420)\n for (const [label, rec] of Object.entries(before.messages.records)) {\n for (const [mid, e] of Object.entries(rec)) {\n const x = after.messages.records[label]?.[mid]\n if (x === undefined) {\n // only tick, after sentAt + H on the mark it writes, or with its tuple deactivated or gone (4340)\n const t = Object.values(after.relationships).flatMap((r) => r.tuples).find((u) => u.ownPairLabel === label)\n if (op.kind !== 'tick') v.push({ invariant: 'messages', detail: `record ${label} ${mid} deleted by ${op.kind}` })\n else if (!(e.sentAt + MESSAGE_LIFETIME_MS < after.lastWhen) && t !== undefined && !t.deactivated) v.push({ invariant: 'messages', detail: `record ${label} ${mid} deleted before sentAt + H, its tuple live` })\n continue\n }\n if (x.bodyDigest !== e.bodyDigest || x.sentAt !== e.sentAt) v.push({ invariant: 'messages', detail: `record ${label} ${mid} changed` })\n }\n }\n for (const [id, e] of Object.entries(after.messages.inbox)) {\n if (Object.hasOwn(before.messages.inbox, id)) continue\n if (op.kind !== 'receive' || op.disposition !== 'unique' || op.digest !== id) v.push({ invariant: 'messages', detail: `inbox entry ${id} arose by ${op.kind}` })\n if (after.messages.records[e.tuple]?.[e.mid] === undefined) v.push({ invariant: 'messages', detail: `inbox entry ${id} without its record entry` })\n }\n for (const id of Object.keys(before.messages.inbox)) {\n if (!Object.hasOwn(after.messages.inbox, id) && !(op.kind === 'act' && op.command === 'message.take')) v.push({ invariant: 'messages', detail: `inbox entry ${id} left by ${op.kind}` })\n }\n // a block changes only by the block act, a merge (6030) or a departure\n // that removes its relationship\n for (const r of before.messages.blocked) {\n if (!after.messages.blocked.includes(r) && Object.hasOwn(after.relationships, r) && !(op.kind === 'act' && op.command === 'message.block')) v.push({ invariant: 'messages', detail: `the block of ${r} cleared by ${op.kind}` })\n }\n for (const r of after.messages.blocked) {\n if (before.messages.blocked.includes(r) || (op.kind === 'act' && (op.command === 'message.block' || op.command === 'trust.merge')) || op.kind === 'resume') continue\n // a chaining: the chain takes the block of the fresh relationship it absorbed (6030)\n const absorbed = Object.values(after.relationships).some((h) => h.chainedInto === r && before.relationships[h.id]?.chainedInto === null && before.messages.blocked.includes(h.id))\n if (!absorbed) v.push({ invariant: 'messages', detail: `the block of ${r} set by ${op.kind}` })\n }\n // a member stays on the holder's roster (removal is not built)\n for (const [id, g] of Object.entries(before.groups)) {\n const ga = after.groups[id]\n if (!ga) { v.push({ invariant: 'groups', detail: `group ${id} left` }); continue }\n for (const m of Object.keys(g.roster)) if (!Object.hasOwn(ga.roster, m)) v.push({ invariant: 'groups', detail: `${id}: member ${m} left the roster` })\n }\n if (big(after.commitSeq) !== big(before.commitSeq) + 1n) v.push({ invariant: 'commitSeq', detail: `commitSeq ${before.commitSeq} → ${after.commitSeq}` })\n if (after.lastWhen < before.lastWhen) v.push({ invariant: 'commitSeq', detail: `lastWhen fell ${before.lastWhen} → ${after.lastWhen}` })\n // the register (Identity §2): monotone sets\n const rb = before.register, ra = after.register\n const lost = (what: string, xs: string[]): void => { if (xs.length) v.push({ invariant: 'register', detail: `${what} lost ${jcs(xs)}` }) }\n lost('labels', superset(ra.labels, rb.labels))\n lost('pairNonces', Object.keys(rb.pairNonces).filter((k) => ra.pairNonces[k] !== rb.pairNonces[k]))\n for (const [k, list] of Object.entries(rb.carriers)) lost(`carriers ${k}`, superset((ra.carriers[k] ?? []).map((x) => jcs(x)), list.map((x) => jcs(x))))\n lost('device names', superset(ra.devices.names, rb.devices.names))\n lost('device revocations', superset(ra.devices.revoked, rb.devices.revoked))\n if (rb.community !== null && (ra.community === null || ra.community.genesis !== rb.community.genesis || big(ra.community.head) < big(rb.community.head))) {\n v.push({ invariant: 'register', detail: 'the community lost its genesis or its head fell' })\n }\n if (ra.lineage.length < rb.lineage.length || jcs(ra.lineage.slice(0, rb.lineage.length)) !== jcs(rb.lineage)) v.push({ invariant: 'register', detail: 'the lineage did not only extend' })\n // a revoked name is never given again (Identity §5.5)\n // a revoked name is never given again (§5.5): no device.added names one\n if (op.kind === 'act') {\n for (const e of op.events ?? []) if (e.type === 'device.added' && rb.devices.revoked.includes(e.name)) v.push({ invariant: 'register', detail: `device name ${e.name} given again after its revocation` })\n }\n // the head moves by one generation at a time, with one lineage element,\n // onto a label persisted in an earlier commit (6360, Identity §5.4)\n if (rb.community !== null && ra.community !== null && ra.community.head !== rb.community.head) {\n const g = big(ra.community.head)\n if (g !== big(rb.community.head) + 1n || ra.lineage.length !== rb.lineage.length + 1) v.push({ invariant: 'register', detail: `the head moved ${rb.community.head} → ${ra.community.head} with ${ra.lineage.length - rb.lineage.length} lineage elements` })\n if (!rb.labels.includes(communityLabel(ra.community.genesis, Number(g)))) v.push({ invariant: 'register', detail: `the head moved to generation ${ra.community.head} whose label was not persisted before (6360)` })\n }\n // the own profile's one counter never falls, and its content changes only with it (6450)\n if (big(after.profile.revision) < big(before.profile.revision)) v.push({ invariant: 'profile', detail: `the profile revision fell ${before.profile.revision} → ${after.profile.revision}` })\n else if (after.profile.revision === before.profile.revision && jcs(after.profile.body) !== jcs(before.profile.body)) v.push({ invariant: 'profile', detail: `the profile changed under revision ${after.profile.revision}` })\n // addresses (Delivery §5)\n lost('tombstones', superset(after.addresses.tombstones, before.addresses.tombstones))\n for (const k of Object.keys(before.addresses.keys)) {\n if (!Object.hasOwn(after.addresses.keys, k) && !after.addresses.tombstones.includes(k) && !before.addresses.keys[k].label.startsWith('group/')) v.push({ invariant: 'addresses', detail: `${k} left without a tombstone` })\n }\n // salts, baselines and revisions, per tuple label; the acked document\n // of a delivery-ack, and whether the operation may rename (2100, 2140)\n const ack = op.kind === 'receive' ? op.ref : undefined\n const renames = op.kind === 'receive' || op.kind === 'resume' || (op.kind === 'act' && (op.command === 'trust.merge' || op.command === 'trust.depart'))\n const tb = tuplesByLabel(before)\n for (const [label, a] of tuplesByLabel(after)) {\n const b = tb.get(label)\n if (!b) continue\n seqOutTransition(v, `${label} starOut`, b.starOut, a.starOut, after, ack, renames)\n seqOutTransition(v, `${label} groupStarOut`, b.groupStarOut, a.groupStarOut, after, ack, false)\n probeTransition(v, `${label} probeOut`, b.probeOut, a.probeOut, after, ack)\n seqInTransition(v, `${label} starIn`, b.starIn, a.starIn)\n seqInTransition(v, `${label} groupStarIn`, b.groupStarIn, a.groupStarIn)\n seqInTransition(v, `${label} probeIn`, b.probeIn, a.probeIn)\n if (big(a.mappingOut.rev) < big(b.mappingOut.rev)) v.push({ invariant: 'salts', detail: `${label}: mapping revision fell` })\n if (big(a.continuityOut.rev) < big(b.continuityOut.rev)) v.push({ invariant: 'salts', detail: `${label}: continuity revision fell` })\n if (big(a.profileOut.rev) < big(b.profileOut.rev)) v.push({ invariant: 'salts', detail: `${label}: profile revision issued fell` })\n if (big(a.profileOut.rev) > big(after.profile.revision)) v.push({ invariant: 'salts', detail: `${label}: profile revision ${a.profileOut.rev} issued above the counter ${after.profile.revision} (6450)` })\n if (big(a.profileIn.rev) < big(b.profileIn.rev)) v.push({ invariant: 'salts', detail: `${label}: the held profile revision fell (6460)` })\n }\n // a new tuple starts with fresh per-tuple state (6250): nothing migrates into it\n for (const r of Object.values(after.relationships)) {\n for (const t of r.tuples) {\n if (tb.has(t.ownPairLabel)) continue\n const stale = freshViolations(t)\n if (stale.length) v.push({ invariant: 'tuples', detail: `${t.ownPairLabel}: a new tuple carries ${stale.join(', ')} (6250)` })\n }\n }\n // entry positions (2120, 2190) and the creation order of active heads (2180)\n positionViolations(v, before, after)\n headsViolations(v, before, after)\n // bindings and held heads, per relationship (6610, 6150)\n for (const [id, a] of Object.entries(after.relationships)) {\n if (!Object.hasOwn(before.relationships, id) || isHusk(a)) continue\n const b = before.relationships[id]\n const chained = a.tuples.length > b.tuples.length\n if (chained) continue\n for (const [anchor, list] of Object.entries(a.bindings)) {\n if (list.length > 1 && list.length > (b.bindings[anchor]?.length ?? 0)) v.push({ invariant: 'bindings', detail: `${id}: a second binding for ${anchor} without a chaining` })\n }\n if (b.heldCounterpartHead !== null && a.heldCounterpartHead !== b.heldCounterpartHead &&\n (a.heldCounterpartHead === null || jcs(newestOf([b.heldCounterpartHead, a.heldCounterpartHead], a.links)) !== jcs([a.heldCounterpartHead]))) {\n v.push({ invariant: 'bindings', detail: `${id}: the held head moved ${b.heldCounterpartHead} → ${a.heldCounterpartHead} off its links` })\n }\n }\n // the outbox (Delivery §6.1)\n for (const [digest, it] of Object.entries(after.outbox)) {\n const was = Object.hasOwn(before.outbox, digest) ? before.outbox[digest] : undefined\n if (!was) {\n if (it.history.length !== 1 || it.history[0].status !== 'submitted') v.push({ invariant: 'outbox', detail: `${digest}: a new item starts submitted` })\n continue\n }\n const n = (x: typeof it): number => x.history.filter((s) => s.status === 'accepted').length\n if (n(it) > n(was) && op.kind !== 'report') v.push({ invariant: 'outbox', detail: `${digest}: accepted without a report (${op.kind})` })\n if (triasOf(was) === 'delivered' && triasOf(it) !== 'delivered') v.push({ invariant: 'outbox', detail: `${digest}: stepped back from delivered` })\n }\n // the effect cache (Delivery 4.2)\n const added = Object.keys(after.effects).filter((d) => !Object.hasOwn(before.effects, d))\n if (added.length && !(op.kind === 'receive' && op.disposition === 'unique' && added.length === 1 && (op.digest === undefined || added[0] === op.digest))) {\n v.push({ invariant: 'effects', detail: `${jcs(added)} entered the cache by ${op.kind}${op.kind === 'receive' ? ` (${op.disposition})` : ''}` })\n }\n if (op.kind !== 'tick') {\n const gone = Object.keys(before.effects).filter((d) => !Object.hasOwn(after.effects, d))\n if (gone.length) v.push({ invariant: 'effects', detail: `${jcs(gone)} left the cache by ${op.kind}` })\n const acts = Object.keys(before.acts).filter((a) => !Object.hasOwn(after.acts, a))\n if (acts.length) v.push({ invariant: 'journal', detail: `${jcs(acts)} left the journal by ${op.kind}` })\n }\n // duties\n for (const d of Object.values(before.duties)) {\n if (!Object.hasOwn(after.duties, d.id) && !dutyDrops(before, after, d, op)) v.push({ invariant: 'duties', detail: `${d.id} (${d.kind}) disappeared by ${op.kind}${op.kind === 'act' ? ' ' + op.command : ''} without a rule` })\n }\n return v\n}\n\n/** Both: the commit's invariants and those of the state it leaves. */\nexport const commitViolations = (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp): Violation[] =>\n [...transitionViolations(before, after, op), ...stateViolations(after)]\n"]}
@@ -0,0 +1,7 @@
1
+ import type { KeyProvider } from './ports.js';
2
+ /** PKCS#8 prefixes of a raw 32-byte Ed25519 / X25519 private key */
3
+ export declare const ED_PKCS8: Uint8Array<ArrayBuffer>;
4
+ export declare const X_PKCS8: Uint8Array<ArrayBuffer>;
5
+ /** The default KeyProvider over a root seed (the identity's root IKM). */
6
+ export declare function seedKeys(seed: Uint8Array, crypto?: Pick<Crypto, 'subtle'>): KeyProvider;
7
+ //# sourceMappingURL=keys-seed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys-seed.d.ts","sourceRoot":"","sources":["../src/keys-seed.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAyB,WAAW,EAAc,MAAM,YAAY,CAAA;AAGhF,oEAAoE;AACpE,eAAO,MAAM,QAAQ,yBAAoH,CAAA;AACzI,eAAO,MAAM,OAAO,yBAAoH,CAAA;AAIxI,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,WAAW,CA2FxF"}
@@ -0,0 +1,133 @@
1
+ // keys-seed — the library's default KeyProvider (lib Stage 2, note §3).
2
+ //
3
+ // Every key derives from one root seed exactly as identity.ts and
4
+ // carrier-identity.ts derive it — the same HKDF (SHA-256, empty salt)
5
+ // and the same info strings — so the shipped vectors stay valid:
6
+ //
7
+ // anchor of a label 'rltp/anchor/ed/' + label, 'rltp/anchor/x/' + label
8
+ // under the closed registry (Identity §6.1); a
9
+ // device key is the anchor of its device label
10
+ // device/<n>/<c> (§5.5, identity.ts deviceLabel)
11
+ // carrier principal CARRIER_INFO_PREFIX + Dc + Dn (Identity §7a.4)
12
+ //
13
+ // The provider reads no state. agree() asks the engine's release
14
+ // (`allowed(rkid)`, from `addresses`) on EVERY call, cached key or not,
15
+ // so a retired key is never revived from the cache. Derived keys are
16
+ // cached in a Map outside the holder state (keys are not state, Identity
17
+ // 9.3). The WebCrypto handle is the caller's or the global one, resolved
18
+ // here, at construction — never at import. Invalid input answers with
19
+ // a status (`unknown`, `invalid`) or a TypeError; a derivation or WebCrypto
20
+ // failure throws, so the engine reports it as InfraError('key-provider').
21
+ import { base58, b64uOf, fromB64u } from './core.js';
22
+ import { cat } from './crypto.js';
23
+ import { canonicalLabel } from './identity.js';
24
+ import { CARRIER_INFO_PREFIX, validCarrierIdentifier } from './carrier-identity.js';
25
+ import { CryptoUnavailableError } from './results.js';
26
+ const te = new TextEncoder();
27
+ /** PKCS#8 prefixes of a raw 32-byte Ed25519 / X25519 private key */
28
+ export const ED_PKCS8 = Uint8Array.from([0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x04, 0x22, 0x04, 0x20]);
29
+ export const X_PKCS8 = Uint8Array.from([0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20]);
30
+ /** The default KeyProvider over a root seed (the identity's root IKM). */
31
+ export function seedKeys(seed, crypto) {
32
+ if (!(seed instanceof Uint8Array) || seed.length < 32)
33
+ throw new TypeError('seedKeys: the root seed must be at least 32 bytes');
34
+ const S = (crypto ?? globalThis.crypto)?.subtle;
35
+ if (!S)
36
+ throw new CryptoUnavailableError(['subtle']);
37
+ // an allocating copy: Buffer.slice would alias the caller's memory
38
+ const ikm = new Uint8Array(seed);
39
+ const hkdf = async (info) => {
40
+ const k = await S.importKey('raw', ikm, 'HKDF', false, ['deriveBits']);
41
+ return new Uint8Array(await S.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt: new Uint8Array(0), info: te.encode(info) }, k, 256));
42
+ };
43
+ const pubOf = async (priv) => fromB64u((await S.exportKey('jwk', priv)).x);
44
+ const edKey = (s) => S.importKey('pkcs8', cat(ED_PKCS8, s), { name: 'Ed25519' }, true, ['sign']);
45
+ const mh = async (bytes) => 'u' + b64uOf(cat(Uint8Array.from([0x12, 0x20]), new Uint8Array(await S.digest('SHA-256', bytes))));
46
+ const labels = new Map();
47
+ const derive = (label) => {
48
+ const canonical = canonicalLabel(label);
49
+ if (canonical === null)
50
+ return Promise.reject(new Error(`not a label of the closed registry (Identity §6.1): ${JSON.stringify(label)}`));
51
+ let p = labels.get(canonical);
52
+ if (!p) {
53
+ p = (async () => {
54
+ const ed = await edKey(await hkdf('rltp/anchor/ed/' + canonical));
55
+ const x = await S.importKey('pkcs8', cat(X_PKCS8, await hkdf('rltp/anchor/x/' + canonical)), { name: 'X25519' }, true, ['deriveBits']);
56
+ const anchor = 'did:key:z' + base58(cat(Uint8Array.from([0xed, 0x01]), await pubOf(ed)));
57
+ const keyAgreement = 'z' + base58(cat(Uint8Array.from([0xec, 0x01]), await pubOf(x)));
58
+ return { ed, x, anchor, keyAgreement };
59
+ })();
60
+ p.catch(() => labels.delete(canonical));
61
+ labels.set(canonical, p);
62
+ }
63
+ return p;
64
+ };
65
+ const carriers = new Map();
66
+ return {
67
+ async anchorOf(label) {
68
+ const k = await derive(label);
69
+ return { anchor: k.anchor, keyAgreement: k.keyAgreement };
70
+ },
71
+ async sign(label, bytes) {
72
+ const k = await derive(label);
73
+ return new Uint8Array(await S.sign({ name: 'Ed25519' }, k.ed, bytes));
74
+ },
75
+ async agree(rkid, epk, allowed) {
76
+ // the release first, every call: the cache never answers for it
77
+ const rel = allowed(rkid);
78
+ if (rel.status === 'retired')
79
+ return { status: 'retired' };
80
+ if (rel.status !== 'live' || canonicalLabel(rel.label) === null)
81
+ return { status: 'unknown' };
82
+ // from here a failure is the host's (derivation, WebCrypto) and throws
83
+ const k = await derive(rel.label);
84
+ if (k.keyAgreement !== rkid)
85
+ return { status: 'unknown' };
86
+ if (!(epk instanceof Uint8Array) || epk.length !== 32)
87
+ return { status: 'invalid' };
88
+ let pub;
89
+ try {
90
+ pub = await S.importKey('raw', new Uint8Array(epk), { name: 'X25519' }, false, []);
91
+ }
92
+ catch (e) {
93
+ if (e?.name === 'DataError')
94
+ return { status: 'invalid' };
95
+ throw e;
96
+ }
97
+ let shared;
98
+ try {
99
+ shared = new Uint8Array(await S.deriveBits({ name: 'X25519', public: pub }, k.x, 256));
100
+ }
101
+ catch (e) {
102
+ // WebCrypto refuses a low-order point with OperationError: the sender's fault
103
+ if (e?.name === 'OperationError')
104
+ return { status: 'invalid' };
105
+ throw e;
106
+ }
107
+ if (shared.every((b) => b === 0))
108
+ return { status: 'invalid' };
109
+ return { status: 'available', shared };
110
+ },
111
+ carrierPrincipal(nonce, carrier) {
112
+ if (!validCarrierIdentifier(carrier))
113
+ return Promise.reject(new Error('invalid carrier identifier (7a.2)'));
114
+ if (!(nonce instanceof Uint8Array) || nonce.length !== 32)
115
+ return Promise.reject(new Error('carrier nonce must be 32 bytes (7a.3)'));
116
+ const n = new Uint8Array(nonce);
117
+ const key = carrier + '\u0000' + b64uOf(n);
118
+ let p = carriers.get(key);
119
+ if (!p) {
120
+ p = (async () => {
121
+ const info = CARRIER_INFO_PREFIX + await mh(te.encode(carrier)) + await mh(n);
122
+ const priv = await edKey(await hkdf(info));
123
+ const principal = 'did:key:z' + base58(cat(Uint8Array.from([0xed, 0x01]), await pubOf(priv)));
124
+ return { principal, sign: async (bytes) => new Uint8Array(await S.sign({ name: 'Ed25519' }, priv, bytes)) };
125
+ })();
126
+ p.catch(() => carriers.delete(key));
127
+ carriers.set(key, p);
128
+ }
129
+ return p;
130
+ },
131
+ };
132
+ }
133
+ //# sourceMappingURL=keys-seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys-seed.js","sourceRoot":"","sources":["../src/keys-seed.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,iEAAiE;AACjE,EAAE;AACF,4EAA4E;AAC5E,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,uEAAuE;AACvE,EAAE;AACF,iEAAiE;AACjE,wEAAwE;AACxE,qEAAqE;AACrE,yEAAyE;AAC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E,CAAA;gBACzH,CAAC,CAAC,EAAE,CAAA;gBACJ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;gBACnC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACtB,CAAC;YACD,OAAO,CAAC,CAAA;QACV,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["// keys-seed — the library's default KeyProvider (lib Stage 2, note §3).\n//\n// Every key derives from one root seed exactly as identity.ts and\n// carrier-identity.ts derive it — the same HKDF (SHA-256, empty salt)\n// and the same info strings — so the shipped vectors stay valid:\n//\n// anchor of a label 'rltp/anchor/ed/' + label, 'rltp/anchor/x/' + label\n// under the closed registry (Identity §6.1); a\n// device key is the anchor of its device label\n// device/<n>/<c> (§5.5, identity.ts deviceLabel)\n// carrier principal CARRIER_INFO_PREFIX + Dc + Dn (Identity §7a.4)\n//\n// The provider reads no state. agree() asks the engine's release\n// (`allowed(rkid)`, from `addresses`) on EVERY call, cached key or not,\n// so a retired key is never revived from the cache. Derived keys are\n// cached in a Map outside the holder state (keys are not state, Identity\n// 9.3). The WebCrypto handle is the caller's or the global one, resolved\n// here, at construction — never at import. Invalid input answers with\n// a status (`unknown`, `invalid`) or a TypeError; a derivation or WebCrypto\n// failure throws, so the engine reports it as InfraError('key-provider').\nimport { base58, b64uOf, fromB64u } from './core.js'\nimport { cat } from './crypto.js'\nimport { canonicalLabel } from './identity.js'\nimport { CARRIER_INFO_PREFIX, validCarrierIdentifier } from './carrier-identity.js'\nimport { CryptoUnavailableError } from './results.js'\nimport type { Agreement, CarrierKey, KeyProvider, KeyRelease } from './ports.js'\n\nconst te = new TextEncoder()\n/** PKCS#8 prefixes of a raw 32-byte Ed25519 / X25519 private key */\nexport const ED_PKCS8 = Uint8Array.from([0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x04, 0x22, 0x04, 0x20])\nexport const X_PKCS8 = Uint8Array.from([0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20])\n\ninterface LabelKeys { ed: CryptoKey, x: CryptoKey, anchor: string, keyAgreement: string }\n\n/** The default KeyProvider over a root seed (the identity's root IKM). */\nexport function seedKeys (seed: Uint8Array, crypto?: Pick<Crypto, 'subtle'>): KeyProvider {\n if (!(seed instanceof Uint8Array) || seed.length < 32) throw new TypeError('seedKeys: the root seed must be at least 32 bytes')\n const S = (crypto ?? (globalThis.crypto as Pick<Crypto, 'subtle'> | undefined))?.subtle\n if (!S) throw new CryptoUnavailableError(['subtle'])\n // an allocating copy: Buffer.slice would alias the caller's memory\n const ikm = new Uint8Array(seed)\n\n const hkdf = async (info: string): Promise<Uint8Array> => {\n const k = await S.importKey('raw', ikm, 'HKDF', false, ['deriveBits'])\n return new Uint8Array(await S.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt: new Uint8Array(0), info: te.encode(info) }, k, 256))\n }\n const pubOf = async (priv: CryptoKey): Promise<Uint8Array> => fromB64u((await S.exportKey('jwk', priv)).x!)\n const edKey = (s: Uint8Array): Promise<CryptoKey> => S.importKey('pkcs8', cat(ED_PKCS8, s), { name: 'Ed25519' }, true, ['sign'])\n const mh = async (bytes: Uint8Array): Promise<string> =>\n 'u' + b64uOf(cat(Uint8Array.from([0x12, 0x20]), new Uint8Array(await S.digest('SHA-256', bytes))))\n\n const labels = new Map<string, Promise<LabelKeys>>()\n const derive = (label: string): Promise<LabelKeys> => {\n const canonical = canonicalLabel(label)\n if (canonical === null) return Promise.reject(new Error(`not a label of the closed registry (Identity §6.1): ${JSON.stringify(label)}`))\n let p = labels.get(canonical)\n if (!p) {\n p = (async () => {\n const ed = await edKey(await hkdf('rltp/anchor/ed/' + canonical))\n const x = await S.importKey('pkcs8', cat(X_PKCS8, await hkdf('rltp/anchor/x/' + canonical)), { name: 'X25519' }, true, ['deriveBits'])\n const anchor = 'did:key:z' + base58(cat(Uint8Array.from([0xed, 0x01]), await pubOf(ed)))\n const keyAgreement = 'z' + base58(cat(Uint8Array.from([0xec, 0x01]), await pubOf(x)))\n return { ed, x, anchor, keyAgreement }\n })()\n p.catch(() => labels.delete(canonical))\n labels.set(canonical, p)\n }\n return p\n }\n\n const carriers = new Map<string, Promise<CarrierKey>>()\n\n return {\n async anchorOf (label) {\n const k = await derive(label)\n return { anchor: k.anchor, keyAgreement: k.keyAgreement }\n },\n\n async sign (label, bytes) {\n const k = await derive(label)\n return new Uint8Array(await S.sign({ name: 'Ed25519' }, k.ed, bytes))\n },\n\n async agree (rkid: string, epk: Uint8Array, allowed: KeyRelease): Promise<Agreement> {\n // the release first, every call: the cache never answers for it\n const rel = allowed(rkid)\n if (rel.status === 'retired') return { status: 'retired' }\n if (rel.status !== 'live' || canonicalLabel(rel.label) === null) return { status: 'unknown' }\n // from here a failure is the host's (derivation, WebCrypto) and throws\n const k = await derive(rel.label)\n if (k.keyAgreement !== rkid) return { status: 'unknown' }\n if (!(epk instanceof Uint8Array) || epk.length !== 32) return { status: 'invalid' }\n let pub: CryptoKey\n try { pub = await S.importKey('raw', new Uint8Array(epk), { name: 'X25519' }, false, []) } catch (e) {\n if ((e as { name?: string })?.name === 'DataError') return { status: 'invalid' }\n throw e\n }\n let shared: Uint8Array\n try { shared = new Uint8Array(await S.deriveBits({ name: 'X25519', public: pub }, k.x, 256)) } catch (e) {\n // WebCrypto refuses a low-order point with OperationError: the sender's fault\n if ((e as { name?: string })?.name === 'OperationError') return { status: 'invalid' }\n throw e\n }\n if (shared.every((b) => b === 0)) return { status: 'invalid' }\n return { status: 'available', shared }\n },\n\n carrierPrincipal (nonce, carrier) {\n if (!validCarrierIdentifier(carrier)) return Promise.reject(new Error('invalid carrier identifier (7a.2)'))\n if (!(nonce instanceof Uint8Array) || nonce.length !== 32) return Promise.reject(new Error('carrier nonce must be 32 bytes (7a.3)'))\n const n = new Uint8Array(nonce)\n const key = carrier + '\\u0000' + b64uOf(n)\n let p = carriers.get(key)\n if (!p) {\n p = (async () => {\n const info = CARRIER_INFO_PREFIX + await mh(te.encode(carrier)) + await mh(n)\n const priv = await edKey(await hkdf(info))\n const principal = 'did:key:z' + base58(cat(Uint8Array.from([0xed, 0x01]), await pubOf(priv)))\n return { principal, sign: async (bytes: Uint8Array) => new Uint8Array(await S.sign({ name: 'Ed25519' }, priv, bytes)) }\n })()\n p.catch(() => carriers.delete(key))\n carriers.set(key, p)\n }\n return p\n },\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { Json } from './core.js';
2
+ import type { Log } from './ports.js';
3
+ export interface MemoryLog extends Log {
4
+ readonly genesis: string;
5
+ /** the entries held, chain order (copies) */
6
+ entries(): Json[];
7
+ /** catch up from another replica of the same log: its first `upTo` entries (all by default) */
8
+ syncFrom(other: MemoryLog, upTo?: number): Promise<void>;
9
+ }
10
+ /** An in-memory replica of the personal community `genesis`'s lineage log. */
11
+ export declare function memoryLog(genesis: string): MemoryLog;
12
+ //# sourceMappingURL=log-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-memory.d.ts","sourceRoot":"","sources":["../src/log-memory.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGrC,OAAO,KAAK,EAAgB,GAAG,EAAwB,MAAM,YAAY,CAAA;AAKzE,MAAM,WAAW,SAAU,SAAQ,GAAG;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,6CAA6C;IAC7C,OAAO,IAAK,IAAI,EAAE,CAAA;IAClB,+FAA+F;IAC/F,QAAQ,CAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1D;AAQD,8EAA8E;AAC9E,wBAAgB,SAAS,CAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAiDrD"}
@@ -0,0 +1,101 @@
1
+ // log-memory — an in-memory Log port (lib Stage 2, note §3 Log; ./testing):
2
+ // one replica of a personal community's lineage of `anchor.rotate`
3
+ // entries (Access §5.6), for tests and simulators. Not a log of Access
4
+ // operations: an entry is the anchor.rotate body `{rotation}` alone; the
5
+ // operation envelope, its author (the founder's pair anchor), the sole-
6
+ // member check, the ancestor closure and the canonical walk of forks are
7
+ // the Access port's, which graduates later. One instance shared by two
8
+ // holders is one log two devices write to.
9
+ //
10
+ // What it does:
11
+ // head() {genesis, empty} or the last entry: its id (the
12
+ // document digest of the entry), the generation it
13
+ // introduced (entries + 1: the first entry leaves
14
+ // generation 1, RLTP-ACC-5980), its next and commit
15
+ // at(gen) the entry that introduced generation gen, or null
16
+ // append(entry, over) idempotent over exactly (entry, over): the same
17
+ // closure again is `exists`; the same entry over
18
+ // another head is head-conflict (RLTP-ACC-5965: one
19
+ // entry); `over` must name the current head (null:
20
+ // empty), else head-conflict; the rotation must
21
+ // verify under both signatures (5956) and continue
22
+ // the head: prev = head.next, next meets head.commit
23
+ // (5958, 5960), else failure. Atomic: every await
24
+ // (digest, signatures, binding) runs first, then
25
+ // idempotence, head and continuation are checked
26
+ // and the entry inserted in one synchronous step
27
+ // entries(), syncFrom() for tests: a copy of the entries, and catching up
28
+ // from another replica (the device's encrypted state
29
+ // synchronized, Identity §5.4) up to `upTo` entries
30
+ import { jcs } from './core.js';
31
+ import { digestDoc } from './crypto.js';
32
+ import { bindingOf, verifyAnchorRotation } from './anchor.js';
33
+ const bodyOf = (entry) => {
34
+ const r = entry?.rotation;
35
+ const b = r?.body;
36
+ return b && typeof b.prev === 'string' && typeof b.next === 'string' && typeof b.commit === 'string' ? b : null;
37
+ };
38
+ /** An in-memory replica of the personal community `genesis`'s lineage log. */
39
+ export function memoryLog(genesis) {
40
+ const held = [];
41
+ const headOf = () => {
42
+ if (!held.length)
43
+ return { genesis, empty: true };
44
+ const last = held[held.length - 1];
45
+ return { genesis, entryId: last.id, gen: held.length + 1, next: last.entry.rotation.body.next, commit: last.entry.rotation.body.commit };
46
+ };
47
+ const log = {
48
+ genesis,
49
+ async head() { return headOf(); },
50
+ async at(gen) {
51
+ const h = Number.isSafeInteger(gen) && gen >= 2 ? held[gen - 2] : undefined;
52
+ return h ? { entryId: h.id, next: h.entry.rotation.body.next, commit: h.entry.rotation.body.commit } : null;
53
+ },
54
+ async append(entry, overHead) {
55
+ const body = bodyOf(entry);
56
+ if (body === null || Object.keys(entry).length !== 1)
57
+ return { status: 'failure', reason: 'not an anchor.rotate body {rotation} (RLTP-ACC-5955)' };
58
+ // every await first
59
+ const id = await digestDoc(entry);
60
+ const verified = await verifyAnchorRotation(entry.rotation);
61
+ let nextBinding = null;
62
+ try {
63
+ nextBinding = await bindingOf(body.next);
64
+ }
65
+ catch {
66
+ nextBinding = null;
67
+ }
68
+ // then one synchronous step: idempotence, head, continuation, insert
69
+ const same = held.find((h) => jcs(h.entry.rotation.body) === jcs(body));
70
+ if (same)
71
+ return same.id === id && same.over === overHead ? { status: 'exists', head: headOf() } : { status: 'head-conflict', head: headOf() };
72
+ const cur = held.length ? held[held.length - 1] : null;
73
+ if (overHead !== (cur?.id ?? null))
74
+ return { status: 'head-conflict', head: headOf() };
75
+ if (!verified)
76
+ return { status: 'failure', reason: 'the rotation does not verify (RLTP-ACC-5956)' };
77
+ if (cur && (body.prev !== cur.entry.rotation.body.next || nextBinding !== cur.entry.rotation.body.commit)) {
78
+ return { status: 'failure', reason: 'the rotation does not continue the lineage head (RLTP-ACC-5958, 5960)' };
79
+ }
80
+ held.push({ id, entry: structuredClone(entry), over: overHead });
81
+ return { status: 'appended', head: headOf() };
82
+ },
83
+ entries: () => held.map((h) => structuredClone(h.entry)),
84
+ async syncFrom(other, upTo) {
85
+ if (other.genesis !== genesis)
86
+ throw new Error('memoryLog: another personal community');
87
+ const theirs = other.entries().slice(0, upTo);
88
+ const ids = await Promise.all(theirs.map((e) => digestDoc(e)));
89
+ for (let i = 0; i < theirs.length; i++) {
90
+ if (i < held.length) {
91
+ if (held[i].id !== ids[i])
92
+ throw new Error('memoryLog: the replicas diverge');
93
+ continue;
94
+ }
95
+ held.push({ id: ids[i], entry: structuredClone(theirs[i]), over: i ? ids[i - 1] : null });
96
+ }
97
+ },
98
+ };
99
+ return Object.freeze(log);
100
+ }
101
+ //# sourceMappingURL=log-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-memory.js","sourceRoot":"","sources":["../src/log-memory.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,mEAAmE;AACnE,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,2CAA2C;AAC3C,EAAE;AACF,gBAAgB;AAChB,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAc7D,MAAM,MAAM,GAAG,CAAC,KAAc,EAA2B,EAAE;IACzD,MAAM,CAAC,GAAI,KAAkD,EAAE,QAAQ,CAAA;IACvE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAoC,CAAA;IACjD,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAA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AAC,CAAC,CAAC,CAAA;YAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;oBACpB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;wBAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;oBAC7E,SAAQ;gBACV,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAA6B,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;YACvH,CAAC;QACH,CAAC;KACF,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC","sourcesContent":["// log-memory — an in-memory Log port (lib Stage 2, note §3 Log; ./testing):\n// one replica of a personal community's lineage of `anchor.rotate`\n// entries (Access §5.6), for tests and simulators. Not a log of Access\n// operations: an entry is the anchor.rotate body `{rotation}` alone; the\n// operation envelope, its author (the founder's pair anchor), the sole-\n// member check, the ancestor closure and the canonical walk of forks are\n// the Access port's, which graduates later. One instance shared by two\n// holders is one log two devices write to.\n//\n// What it does:\n// head() {genesis, empty} or the last entry: its id (the\n// document digest of the entry), the generation it\n// introduced (entries + 1: the first entry leaves\n// generation 1, RLTP-ACC-5980), its next and commit\n// at(gen) the entry that introduced generation gen, or null\n// append(entry, over) idempotent over exactly (entry, over): the same\n// closure again is `exists`; the same entry over\n// another head is head-conflict (RLTP-ACC-5965: one\n// entry); `over` must name the current head (null:\n// empty), else head-conflict; the rotation must\n// verify under both signatures (5956) and continue\n// the head: prev = head.next, next meets head.commit\n// (5958, 5960), else failure. Atomic: every await\n// (digest, signatures, binding) runs first, then\n// idempotence, head and continuation are checked\n// and the entry inserted in one synchronous step\n// entries(), syncFrom() for tests: a copy of the entries, and catching up\n// from another replica (the device's encrypted state\n// synchronized, Identity §5.4) up to `upTo` entries\nimport { jcs } from './core.js'\nimport type { Json } from './core.js'\nimport { digestDoc } from './crypto.js'\nimport { bindingOf, verifyAnchorRotation } from './anchor.js'\nimport type { AppendResult, Log, LogEntryRef, LogHead } from './ports.js'\n\ntype Rotation = { body: { type: string, prev: string, next: string, commit: string }, proof: Json }\ninterface Held { id: string, entry: { rotation: Rotation }, over: string | null }\n\nexport interface MemoryLog extends Log {\n readonly genesis: string\n /** the entries held, chain order (copies) */\n entries (): Json[]\n /** catch up from another replica of the same log: its first `upTo` entries (all by default) */\n syncFrom (other: MemoryLog, upTo?: number): Promise<void>\n}\n\nconst bodyOf = (entry: unknown): Rotation['body'] | null => {\n const r = (entry as { rotation?: { body?: unknown } } | null)?.rotation\n const b = r?.body as Rotation['body'] | undefined\n return b && typeof b.prev === 'string' && typeof b.next === 'string' && typeof b.commit === 'string' ? b : null\n}\n\n/** An in-memory replica of the personal community `genesis`'s lineage log. */\nexport function memoryLog (genesis: string): MemoryLog {\n const held: Held[] = []\n const headOf = (): LogHead => {\n if (!held.length) return { genesis, empty: true }\n const last = held[held.length - 1]\n return { genesis, entryId: last.id, gen: held.length + 1, next: last.entry.rotation.body.next, commit: last.entry.rotation.body.commit }\n }\n const log: MemoryLog = {\n genesis,\n async head () { return headOf() },\n async at (gen: number): Promise<LogEntryRef | null> {\n const h = Number.isSafeInteger(gen) && gen >= 2 ? held[gen - 2] : undefined\n return h ? { entryId: h.id, next: h.entry.rotation.body.next, commit: h.entry.rotation.body.commit } : null\n },\n async append (entry: Json, overHead: string | null): Promise<AppendResult> {\n const body = bodyOf(entry)\n if (body === null || Object.keys(entry as object).length !== 1) return { status: 'failure', reason: 'not an anchor.rotate body {rotation} (RLTP-ACC-5955)' }\n // every await first\n const id = await digestDoc(entry)\n const verified = await verifyAnchorRotation((entry as { rotation: unknown }).rotation)\n let nextBinding: string | null = null\n try { nextBinding = await bindingOf(body.next) } catch { nextBinding = null }\n // then one synchronous step: idempotence, head, continuation, insert\n const same = held.find((h) => jcs(h.entry.rotation.body) === jcs(body))\n if (same) return same.id === id && same.over === overHead ? { status: 'exists', head: headOf() } : { status: 'head-conflict', head: headOf() }\n const cur = held.length ? held[held.length - 1] : null\n if (overHead !== (cur?.id ?? null)) return { status: 'head-conflict', head: headOf() }\n if (!verified) return { status: 'failure', reason: 'the rotation does not verify (RLTP-ACC-5956)' }\n if (cur && (body.prev !== cur.entry.rotation.body.next || nextBinding !== cur.entry.rotation.body.commit)) {\n return { status: 'failure', reason: 'the rotation does not continue the lineage head (RLTP-ACC-5958, 5960)' }\n }\n held.push({ id, entry: structuredClone(entry) as Held['entry'], over: overHead })\n return { status: 'appended', head: headOf() }\n },\n entries: () => held.map((h) => structuredClone(h.entry) as unknown as Json),\n async syncFrom (other: MemoryLog, upTo?: number) {\n if (other.genesis !== genesis) throw new Error('memoryLog: another personal community')\n const theirs = other.entries().slice(0, upTo)\n const ids = await Promise.all(theirs.map((e) => digestDoc(e)))\n for (let i = 0; i < theirs.length; i++) {\n if (i < held.length) {\n if (held[i].id !== ids[i]) throw new Error('memoryLog: the replicas diverge')\n continue\n }\n held.push({ id: ids[i], entry: structuredClone(theirs[i]) as unknown as Held['entry'], over: i ? ids[i - 1] : null })\n }\n },\n }\n return Object.freeze(log)\n}\n"]}