@real-life/trust-protocol 0.3.2 → 0.4.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 (264) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +187 -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 +154 -0
  8. package/dist/adapters/vti-mediator.d.ts.map +1 -0
  9. package/dist/adapters/vti-mediator.js +621 -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 +46 -0
  29. package/dist/codec.d.ts.map +1 -0
  30. package/dist/codec.js +410 -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 +291 -0
  56. package/dist/engine.d.ts.map +1 -0
  57. package/dist/engine.js +1395 -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 +177 -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 +137 -0
  80. package/dist/holder-api.d.ts.map +1 -0
  81. package/dist/holder-api.js +132 -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/identity-state.d.ts +43 -0
  88. package/dist/identity-state.d.ts.map +1 -0
  89. package/dist/identity-state.js +345 -0
  90. package/dist/identity-state.js.map +1 -0
  91. package/dist/identity.d.ts +24 -2
  92. package/dist/identity.d.ts.map +1 -1
  93. package/dist/identity.js +70 -11
  94. package/dist/identity.js.map +1 -1
  95. package/dist/index.d.ts +26 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +77 -29
  98. package/dist/index.js.map +1 -1
  99. package/dist/internal.d.ts +36 -0
  100. package/dist/internal.d.ts.map +1 -0
  101. package/dist/internal.js +22 -0
  102. package/dist/internal.js.map +1 -0
  103. package/dist/introduction/holder.d.ts +18 -0
  104. package/dist/introduction/holder.d.ts.map +1 -0
  105. package/dist/introduction/holder.js +757 -0
  106. package/dist/introduction/holder.js.map +1 -0
  107. package/dist/introduction.d.ts +101 -0
  108. package/dist/introduction.d.ts.map +1 -0
  109. package/dist/introduction.js +132 -0
  110. package/dist/introduction.js.map +1 -0
  111. package/dist/invariants.d.ts +43 -0
  112. package/dist/invariants.d.ts.map +1 -0
  113. package/dist/invariants.js +883 -0
  114. package/dist/invariants.js.map +1 -0
  115. package/dist/keys-seed.d.ts +7 -0
  116. package/dist/keys-seed.d.ts.map +1 -0
  117. package/dist/keys-seed.js +133 -0
  118. package/dist/keys-seed.js.map +1 -0
  119. package/dist/log-memory.d.ts +12 -0
  120. package/dist/log-memory.d.ts.map +1 -0
  121. package/dist/log-memory.js +101 -0
  122. package/dist/log-memory.js.map +1 -0
  123. package/dist/membership/holder.d.ts +35 -0
  124. package/dist/membership/holder.d.ts.map +1 -0
  125. package/dist/membership/holder.js +852 -0
  126. package/dist/membership/holder.js.map +1 -0
  127. package/dist/membership.d.ts +92 -0
  128. package/dist/membership.d.ts.map +1 -0
  129. package/dist/membership.js +157 -0
  130. package/dist/membership.js.map +1 -0
  131. package/dist/ports.d.ts +237 -0
  132. package/dist/ports.d.ts.map +1 -0
  133. package/dist/ports.js +2 -0
  134. package/dist/ports.js.map +1 -0
  135. package/dist/profile.d.ts +56 -0
  136. package/dist/profile.d.ts.map +1 -0
  137. package/dist/profile.js +193 -0
  138. package/dist/profile.js.map +1 -0
  139. package/dist/prompts.d.ts +14 -0
  140. package/dist/prompts.d.ts.map +1 -0
  141. package/dist/prompts.js +69 -0
  142. package/dist/prompts.js.map +1 -0
  143. package/dist/receive.d.ts +133 -0
  144. package/dist/receive.d.ts.map +1 -0
  145. package/dist/receive.js +298 -0
  146. package/dist/receive.js.map +1 -0
  147. package/dist/results.d.ts +158 -0
  148. package/dist/results.d.ts.map +1 -0
  149. package/dist/results.js +21 -0
  150. package/dist/results.js.map +1 -0
  151. package/dist/schemas.d.ts.map +1 -1
  152. package/dist/schemas.js +42 -38
  153. package/dist/schemas.js.map +1 -1
  154. package/dist/sha256.d.ts +3 -0
  155. package/dist/sha256.d.ts.map +1 -0
  156. package/dist/sha256.js +69 -0
  157. package/dist/sha256.js.map +1 -0
  158. package/dist/star.d.ts +31 -0
  159. package/dist/star.d.ts.map +1 -0
  160. package/dist/star.js +56 -0
  161. package/dist/star.js.map +1 -0
  162. package/dist/state-builder.d.ts +42 -0
  163. package/dist/state-builder.d.ts.map +1 -0
  164. package/dist/state-builder.js +100 -0
  165. package/dist/state-builder.js.map +1 -0
  166. package/dist/state.d.ts +853 -0
  167. package/dist/state.d.ts.map +1 -0
  168. package/dist/state.js +36 -0
  169. package/dist/state.js.map +1 -0
  170. package/dist/store-contract.d.ts +11 -0
  171. package/dist/store-contract.d.ts.map +1 -0
  172. package/dist/store-contract.js +189 -0
  173. package/dist/store-contract.js.map +1 -0
  174. package/dist/store-memory.d.ts +8 -0
  175. package/dist/store-memory.d.ts.map +1 -0
  176. package/dist/store-memory.js +17 -0
  177. package/dist/store-memory.js.map +1 -0
  178. package/dist/testing.d.ts +22 -0
  179. package/dist/testing.d.ts.map +1 -0
  180. package/dist/testing.js +21 -0
  181. package/dist/testing.js.map +1 -0
  182. package/dist/trust/continuity.d.ts +71 -0
  183. package/dist/trust/continuity.d.ts.map +1 -0
  184. package/dist/trust/continuity.js +1216 -0
  185. package/dist/trust/continuity.js.map +1 -0
  186. package/dist/trust/duties.d.ts +67 -0
  187. package/dist/trust/duties.d.ts.map +1 -0
  188. package/dist/trust/duties.js +179 -0
  189. package/dist/trust/duties.js.map +1 -0
  190. package/dist/trust/entries.d.ts +139 -0
  191. package/dist/trust/entries.d.ts.map +1 -0
  192. package/dist/trust/entries.js +694 -0
  193. package/dist/trust/entries.js.map +1 -0
  194. package/dist/trust/group-star.d.ts +43 -0
  195. package/dist/trust/group-star.d.ts.map +1 -0
  196. package/dist/trust/group-star.js +188 -0
  197. package/dist/trust/group-star.js.map +1 -0
  198. package/dist/trust/mapping.d.ts +56 -0
  199. package/dist/trust/mapping.d.ts.map +1 -0
  200. package/dist/trust/mapping.js +584 -0
  201. package/dist/trust/mapping.js.map +1 -0
  202. package/dist/trust/profile.d.ts +25 -0
  203. package/dist/trust/profile.d.ts.map +1 -0
  204. package/dist/trust/profile.js +249 -0
  205. package/dist/trust/profile.js.map +1 -0
  206. package/dist/trust/star.d.ts +208 -0
  207. package/dist/trust/star.d.ts.map +1 -0
  208. package/dist/trust/star.js +588 -0
  209. package/dist/trust/star.js.map +1 -0
  210. package/dist/trust/state.d.ts +83 -0
  211. package/dist/trust/state.d.ts.map +1 -0
  212. package/dist/trust/state.js +154 -0
  213. package/dist/trust/state.js.map +1 -0
  214. package/dist/util-freeze.d.ts +3 -0
  215. package/dist/util-freeze.d.ts.map +1 -0
  216. package/dist/util-freeze.js +11 -0
  217. package/dist/util-freeze.js.map +1 -0
  218. package/dist/views.d.ts +147 -0
  219. package/dist/views.d.ts.map +1 -0
  220. package/dist/views.js +268 -0
  221. package/dist/views.js.map +1 -0
  222. package/dist/visibility.d.ts +5 -5
  223. package/dist/visibility.d.ts.map +1 -1
  224. package/dist/visibility.js +22 -28
  225. package/dist/visibility.js.map +1 -1
  226. package/dist/wire.d.ts +178 -84
  227. package/dist/wire.d.ts.map +1 -1
  228. package/dist/wire.js.map +1 -1
  229. package/package.json +56 -10
  230. package/schemas/holder-state-v1.schema.json +3880 -0
  231. package/dist/holder.d.ts.map +0 -1
  232. package/dist/holder.js.map +0 -1
  233. package/dist/probe/acks.d.ts +0 -27
  234. package/dist/probe/acks.d.ts.map +0 -1
  235. package/dist/probe/acks.js +0 -152
  236. package/dist/probe/acks.js.map +0 -1
  237. package/dist/probe/continuity.d.ts +0 -20
  238. package/dist/probe/continuity.d.ts.map +0 -1
  239. package/dist/probe/continuity.js +0 -805
  240. package/dist/probe/continuity.js.map +0 -1
  241. package/dist/probe/deps.d.ts +0 -61
  242. package/dist/probe/deps.d.ts.map +0 -1
  243. package/dist/probe/deps.js +0 -54
  244. package/dist/probe/deps.js.map +0 -1
  245. package/dist/probe/encounter.d.ts +0 -26
  246. package/dist/probe/encounter.d.ts.map +0 -1
  247. package/dist/probe/encounter.js +0 -938
  248. package/dist/probe/encounter.js.map +0 -1
  249. package/dist/probe/introduce.d.ts +0 -62
  250. package/dist/probe/introduce.d.ts.map +0 -1
  251. package/dist/probe/introduce.js +0 -306
  252. package/dist/probe/introduce.js.map +0 -1
  253. package/dist/probe/membership.d.ts +0 -96
  254. package/dist/probe/membership.d.ts.map +0 -1
  255. package/dist/probe/membership.js +0 -467
  256. package/dist/probe/membership.js.map +0 -1
  257. package/dist/probe/trust.d.ts +0 -156
  258. package/dist/probe/trust.d.ts.map +0 -1
  259. package/dist/probe/trust.js +0 -1233
  260. package/dist/probe/trust.js.map +0 -1
  261. package/dist/probe.d.ts +0 -7
  262. package/dist/probe.d.ts.map +0 -1
  263. package/dist/probe.js +0 -42
  264. package/dist/probe.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holder.js","sourceRoot":"","sources":["../../src/introduction/holder.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,+DAA+D;AAC/D,EAAE;AACF,qDAAqD;AACrD,sDAAsD;AACtD,oEAAoE;AACpE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gBAAgB,CAAC,EAAE,eAAe;YACnC,CAAC,UAAU,CAAC,EAAE,SAAS;YACvB,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW;YACzC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW;YACzC,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS;YACrC,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,OAAO;YACjC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW;SAC1C,CAAC;QACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QAC/C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;QAChE,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,YAAY;QACvB,QAAQ,EAAE,UAAU;KACrB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// introduction/holder — the Introduction Act on the holder (lib Stage 2,\n// PR 7a; Trust Layer 0.31 §8 on Delivery 0.81 §4.4). The pure forms are\n// the root module's (introduction.ts). Trust 0.31 §8 relays the act\n// through the mediator; no rendezvous drop is needed or built.\n//\n// The three roles, each its own lifecycle (8320), in\n// state.encounter.introductions under `<role>:<act>`:\n// requester holds an offer (below), decides on an `introduction`\n// prompt, sends introduction-request/0.1 on its pinned tuple\n// toward the mediator (8270), with a fresh pair label and card;\n// sent → acked (the ack) → completed (an accepted reply, 8.2);\n// sent or acked → failed at the act's expiry (8340), the\n// requester waiting for the ack and the reply alike until\n// then: users are mostly offline, a mediator not online\n// within ack-delay + act-skew would fail every introduction\n// (A20, spec follow-up 18: 8690's ack timeout is not applied);\n// the discard at the absolute lifetime as before (8310)\n// mediator received (checks 1–3 of 8410–8430, the ack duty bound),\n// forwarded (the target resolved, the byte-identical payload\n// on its tuple, 8440), completed once the ack is produced, the\n// reply forwarded and both vouchers sent (8360)\n// target received (a forward verified, 8050) → an `introduction`\n// prompt; consented (its reply sent) or refused (local, silent)\n// The new relationship: the requester opens its fresh tuple toward the\n// target's card on an accepted reply, the target toward the requester's\n// card at consent (Trust openTuple, provenance `introduced` via the\n// mediator's contact, 8790); the continuity probe follows on it. A\n// verified voucher marks the relationship's memory `vouchedBy`. Both name\n// the mediator with the own pair label toward it the act pinned\n// (provenance.viaPin, memory.vouchedPin), so a split of the mediator's\n// entry moves them with that relationship (2080).\n//\n// What it registers (introductionModule):\n// human acts introduction.introduce the mediator's act (below)\n// decision introduction: on an offer, accept sends the request; on a\n// forward, accept consents (the reply), decline refuses\n// tasks introduction-request/0.1, -forward/0.1, -reply/0.1\n// (signature class: signed acks), -ack/0.1, -voucher/0.1 (DV\n// class: MAC acks), registry-declaration/0.1 (proof\n// required) and x-introduction-offer/0.1 (this library's\n// form, proof required); every one on the tuple binding,\n// the active head of a live relationship (receive.ts, 6240),\n// except the reply, ack and voucher: `pinned`, on the tuple\n// the act pinned, deactivated or not (8270)\n// duty intro-ack/1: the mediator's one ack at t_received + ack-delay\n// retain time-driven transitions (8140: the first whole second after\n// the bound) and the discard at the absolute lifetime (8310)\n// keepKeys the own rkids of every pinned tuple of a held act: a\n// chaining mid-act deactivates it, tick keeps its key (8270,\n// 8290)\n//\n// Choices this file makes where spec and note leave them open:\n// - who starts: §8 has the requester mint the act and name the target by\n// the mediator's designator (8.3), but says nothing of how the\n// requester learns that designator. This library has the mediator's\n// act `introduce(requester, target, {label?})` (the human who knows\n// both) send the requester an\n// experimental, signed x-introduction-offer/0.1 with the designator and\n// at most a label the mediator's human typed in that act — never a\n// name read from the target's profile (audience: the mediator alone,\n// 6b) or card, and no provenance of the mediator↔target relationship —\n// with the mediator's registry declaration of ack-delay (Delivery §4.4:\n// a requester never sends without holding it). The requester's human\n// accepts on an `introduction` prompt, which sends the request. Gaps\n// for Trust 0.32: the designator's way to the requester (§8.3), and\n// the residue that the offer, signed, is transferable: the requester\n// can show a third party that the mediator offered it this designator\n// and label\n// - the designator: 32 fresh bytes, u-base64url, minted once per target\n// contact and kept (stable per (mediator, target), 8610); the target\n// verifies \"designates itself\" by the channel the forward arrives on,\n// the mediator's pinned tuple toward it — it cannot read the handle\n// - ack-delay: a library constant the mediator declares, PT30S (in\n// [PT1S, PT1H]), revision 1, identical to every counterpart\n// - acks of the documents: the request, forward and reply carry\n// transferable signatures and earn signed delivery-acks (Delivery 4.4's\n// class rule); the ack and voucher artifacts are DV and earn MAC acks\n// - the forward opens a fresh thread toward the target; the reply comes\n// on it and is forwarded on the request's thread; the ack and the\n// requester's voucher travel on the request's thread, the target's on\n// the forward's\n// - an artifact outside its window is refused at stage 8 from its own\n// bytes (8110), the offer by its document's issuedAt; a refusal by a role's lifecycle (a late reply of a\n// failed act, 8350; a reply after the cutoff, 8180) commits only the\n// document's acknowledgement: the act is unchanged\n// - the requester's profile in the request is its display name (the own\n// profile's, at most 64 characters, 8450); the cards carry no name\n// - the name of an introduced contact: at the target the request's\n// displayName, at the requester the offer's label; kept in the\n// relationship's memory as `introducedName`, which the views read until\n// a profile arrives (self-declared, Encounter 6120)\nimport { iso, jcs } from '../core.js'\nimport type { Json, JsonObject } from '../core.js'\nimport { diSignWith, diVerify, digestBytes, digestDoc, xRawOfMk } from '../crypto.js'\nimport { seal } from '../delivery.js'\nimport { cardBody } from '../encounter.js'\nimport {\n ACT_EXPIRY, ACT_SKEW, DECLARATION_TYPE, INTRODUCTION_TYPES, MAC_ACK_INFO, MAC_VOUCHER_INFO, MEDIATOR_ROLE, actIdOf, designatorOf, designatorOk,\n introDigest, actFiresAt, introCardShapeOk, introMacKey, introSchemaOk, introMacArtifact, introMacOk, mediatorConstants, replyBound, replyCutoffHolds,\n requestCutoffHolds, requestFormOk, signIntroArtifact, actWindowHolds,\n} from '../introduction.js'\nimport type { AckBody, Artifact, ReplyBody, RequestBody, VoucherBody } from '../introduction.js'\nimport { b64uOf } from '../core.js'\nimport { tupleByRkid } from '../receive.js'\nimport type { TaskRefusal } from '../receive.js'\nimport type { Applied, CommandDef, DecisionDef, DutyHandler, EventDraft, HolderModule, OutboundDraft, PrepareCtx, Refusal, TaskHandler } from '../engine.js'\nimport type { Recipient } from '../ports.js'\nimport type { HolderState, IntroAct, IntroAckDuty, IntroOffer, Millis, Prompt } from '../state.js'\nimport { openTuple } from '../trust/continuity.js'\nimport { activeTuple, entryOf, findContact, liveRel, tupleByLabel } from '../trust/state.js'\nimport { idsOf } from '../encounter/ceremony.js'\nimport { withPairNonce } from '../identity-state.js'\nimport { tsec } from '../core.js'\n\nconst TT = 'https://real-life.org/trust-tasks/'\nexport const OFFER_TYPE = TT + 'x-introduction-offer/0.1'\nexport { DECLARATION_TYPE, INTRODUCTION_TYPES }\n\n/** The mediator's declared ack-delay (Delivery §4.4, Trust 8.4). */\nexport const ACK_DELAY = 'PT30S'\nexport const ACK_DELAY_MS = 30_000\n\nexport const INTRODUCTION_COMMANDS = Object.freeze({ introduce: 'introduction.introduce' })\nexport interface IntroduceInput { requesterId: string, targetId: string, label?: string }\n\nconst refuse = (reason: TaskRefusal['reason'], ref?: string): TaskRefusal => ({ ok: false, reason, ...(ref ? { ref } : {}) })\nconst no = (code: Refusal['code'], ref?: string): Refusal => ({ ok: false, code, ...(ref ? { ref } : {}) })\nconst isRefusal = (x: unknown): x is Refusal | TaskRefusal => (x as Refusal)?.ok === false\ntype Doc = Record<string, any>\nconst keyOf = (role: IntroAct['role'], act: string): string => `${role}:${act}`\nconst offerPromptId = (digest: string): string => 'intro-offer:' + digest\nconst consentPromptId = (act: string): string => 'intro:' + act\n\ninterface Sealed { digest: string, envelope: OutboundDraft['envelope'], threadId: string, type: string, recipient: Recipient }\nconst draft = (s: Sealed): OutboundDraft => ({ digest: s.digest, envelope: s.envelope, type: s.type, threadId: s.threadId, recipient: s.recipient })\n\n/** A document from an own pair label's anchor on a tuple, sealed to its counterpart. */\nasync function onTuple (ctx: PrepareCtx, label: string, type: string, payload: unknown, threadId: string, sign = false): Promise<Sealed> {\n const at = tupleByLabel(ctx.snapshot, label)\n if (!at) throw new Error(`introduction: no tuple ${label}`)\n const own = await ctx.keys.anchorOf(label)\n const issuedAt = iso(ctx.when)\n let doc: Doc = { id: ctx.entropy.id('doc.id'), type, issuer: own.anchor, recipient: at.tuple.counterpartAnchor, threadId, issuedAt, payload }\n if (sign) doc = await diSignWith(own.anchor, (b) => ctx.keys.sign(label, b), doc, issuedAt, ctx.crypto.subtle)\n const S = ctx.crypto.subtle\n return {\n digest: await digestDoc(doc, S),\n envelope: await seal(doc as Json, at.tuple.counterpartKeyAgreement, { ephSeed: ctx.entropy.bytes('seal.eph', 32), nonce: ctx.entropy.bytes('seal.nonce', 12) }, S),\n threadId, type,\n recipient: { contactId: entryOf(ctx.snapshot, at.rel)?.id ?? at.rel.contactId, rkid: at.tuple.rkid, keyAgreement: at.tuple.counterpartKeyAgreement },\n }\n}\n\n/** The MAC key of the pinned tuple `label` (8630, 8730). */\nasync function pinKey (ctx: PrepareCtx, label: string, info: string): Promise<Uint8Array | null> {\n const at = tupleByLabel(ctx.snapshot, label)\n const raw = at ? xRawOfMk(at.tuple.counterpartKeyAgreement) : null\n if (!at || !raw) return null\n const a = await ctx.keys.agree(at.tuple.rkid, raw, ctx.release)\n return a.status === 'available' ? introMacKey(a.shared, info, ctx.crypto.subtle) : null\n}\n\n/** The live active tuple toward a contact (8020: a pair relationship). */\nfunction channelTo (state: Readonly<HolderState>, contactId: string) {\n const c = findContact(state, contactId)\n if (!c) return null\n const ids = new Set([c.id, ...c.aliases])\n for (const id of c.relIds) {\n const r = state.relationships[id]\n const t = r && liveRel(r) ? activeTuple(r) : undefined\n if (t && !t.deactivated && ids.has(t.entryId)) return { contact: c, rel: r, tuple: t }\n }\n return null\n}\n\n/** The arrival tuple of a document, with the entry it feeds. */\nfunction arrival (state: Readonly<HolderState>, rkid: string) {\n const at = tupleByRkid(state, rkid)\n return at ? { label: at.tuple.ownPairLabel, contactId: entryOf(state, at.rel)?.id ?? at.rel.contactId, tuple: at.tuple, rel: at.rel } : null\n}\n\nconst withAct = (state: HolderState, a: IntroAct): HolderState =>\n ({ ...state, encounter: { ...state.encounter, introductions: { ...state.encounter.introductions, [a.key]: a } } })\n\nconst held = (state: Readonly<HolderState>, role: IntroAct['role'], act: string): IntroAct | undefined => state.encounter.introductions[keyOf(role, act)]\n\n/** The requester's status at `when` (8340, 8140): sent or acked, it fails\n * at the act's expiry, the first whole second after it, whether or not\n * tick ran; no ack timeout (A20, spec follow-up 18, against 8690). */\nfunction requesterStatus (a: Readonly<IntroAct>, when: Millis): IntroAct['status'] {\n if ((a.status === 'sent' || a.status === 'acked') && when >= actFiresAt(a.at + ACT_EXPIRY)) return 'failed'\n return a.status\n}\n\nconst lifetimeOver = (a: Readonly<IntroAct>, when: Millis): boolean => when >= actFiresAt(a.issuedAt + ACT_EXPIRY + ACT_SKEW)\n\n/** The mediator's completion (8360): ack produced, reply forwarded, vouchers sent. */\nconst completedIfDone = (a: IntroAct): IntroAct =>\n a.role === 'mediator' && a.ack !== null && a.replyForwarded && a.vouchersSent ? { ...a, status: 'completed' } : a\n\n/** The own profile name for the request's displayName (≤ 64, 8450). */\nconst displayNameOf = (state: Readonly<HolderState>): string | undefined => {\n const n = (state.profile.body as { name?: unknown } | null)?.name\n return typeof n === 'string' && n.length ? [...n].slice(0, 64).join('') : undefined\n}\n\n/** A fresh pair label and its displayed card, no challenge, no name (the\n * act's fresh anchor, 8010; an rltp-card/0.25 under Encounter's DI rules). */\nasync function freshCard (ctx: PrepareCtx): Promise<{ label: string, nonce: string, rkid: string, anchor: string, card: Doc }> {\n const n = ctx.entropy.bytes('founding.nonce', 32)\n const label = 'pair/' + await digestBytes(n, ctx.crypto.subtle)\n const me = await ctx.keys.anchorOf(label)\n const at = iso(ctx.when)\n const card = await diSignWith(me.anchor, (b) => ctx.keys.sign(label, b), cardBody(me) as unknown as Record<string, Json>, at, ctx.crypto.subtle)\n return { label, nonce: b64uOf(n), rkid: me.keyAgreement, anchor: me.anchor, card }\n}\n\n/** The fresh relationship of an act toward the counterpart's card, introduced via the mediator (8790). */\nfunction openIntroduced (state: Readonly<HolderState>, label: string, nonce: string | undefined, rkid: string, card: Doc, viaPin: string, name: string | undefined, when: Millis): Applied {\n const ids = idsOf(label)\n const opened = openTuple(state, {\n relId: ids.relId, contactId: ids.contactId, ownPairLabel: label, counterpartAnchor: card.anchor, counterpartKeyAgreement: card.keyAgreement,\n provenance: { kind: 'introduced', via: arrivalContact(state, viaPin), viaPin }, ...(nonce !== undefined ? { nonce } : {}),\n }, rkid, when)\n if (name === undefined) return opened\n const rel = opened.state.relationships[ids.relId]\n return { ...opened, state: { ...opened.state, relationships: { ...opened.state.relationships, [ids.relId]: { ...rel, memory: { ...rel.memory, introducedName: name } } } } }\n}\n\n// ── the mediator's act ─────────────────────────────────────────────────\n\ntype IntroducePrep = Refusal | { designator: string, minted: boolean, offer: Sealed, declaration: Sealed }\n\nconst introduceDef: CommandDef<IntroduceInput, IntroducePrep> = {\n human: true,\n async prepare (ctx, input) {\n const s = ctx.snapshot\n const r = channelTo(s, input?.requesterId), t = channelTo(s, input?.targetId)\n if (!r || !t) return no('no-own-channel', 'RLTP-TRU-8020')\n if (r.contact.id === t.contact.id) return no('unknown-contact')\n const held = Object.entries(s.encounter.designators).find(([, c]) => c === t.contact.id)?.[0]\n const designator = held ?? designatorOf(ctx.entropy.bytes('intro.target', 32))\n const label = input.label\n if (label !== undefined && (typeof label !== 'string' || !label.length || [...label].length > 64)) throw new TypeError('introduction.introduce: label is 1 to 64 characters')\n const declaration = await onTuple(ctx, r.tuple.ownPairLabel, DECLARATION_TYPE,\n { declaration: { role: MEDIATOR_ROLE, revision: '1', constants: { 'ack-delay': ACK_DELAY } } }, ctx.entropy.id('thread.id'), true)\n const offer = await onTuple(ctx, r.tuple.ownPairLabel, OFFER_TYPE,\n { target: designator, ...(label !== undefined ? { label } : {}) }, ctx.entropy.id('thread.id'), true)\n return { designator, minted: held === undefined, offer, declaration }\n },\n apply (state, prepared, input) {\n const p = prepared.value\n if (isRefusal(p)) return p\n const designators = p.minted ? { ...state.encounter.designators, [p.designator]: findContact(state, input.targetId)!.id } : state.encounter.designators\n return { state: { ...state, encounter: { ...state.encounter, designators } }, outbound: [draft(p.declaration), draft(p.offer)] }\n },\n}\n\n// ── the registry declaration (Delivery §4.4) ───────────────────────────\n\nconst declarationTask: TaskHandler<Doc, null> = {\n proof: 'required',\n decode: (p) => (introSchemaOk('payload-registry-declaration.schema.json', p) ? p as Doc : refuse('malformed')),\n async prepare (ctx, doc) {\n if (!(await diVerify(doc, doc.issuer, ctx.crypto.subtle))) return refuse('validation-failed')\n const d = doc.payload.declaration\n // the registering specification closes names and domains: only the mediator role is known here\n if (d.role !== MEDIATOR_ROLE || mediatorConstants(d.constants) === null) return refuse('validation-failed')\n return null\n },\n // the generic revision rule: higher wins, equal and identical is\n // idempotent, equal and different or lower is refused\n apply (state, _p, doc, arr) {\n const d = doc.payload.declaration\n const k = `${doc.issuer} ${d.role}`\n const h = state.encounter.declarations[k]\n if (h) {\n const cmp = BigInt(d.revision) - BigInt(h.revision)\n if (cmp < 0n) return refuse('validation-failed')\n if (cmp === 0n) return jcs(h.constants) === jcs(d.constants) ? { state: state as HolderState } : refuse('validation-failed')\n }\n return { state: { ...state, encounter: { ...state.encounter, declarations: { ...state.encounter.declarations, [k]: { issuer: doc.issuer, role: d.role, revision: d.revision, constants: d.constants, at: arr.when } } } } }\n },\n}\n\n// ── the offer at the requester (this library's form) ───────────────────\n\nconst offerTask: TaskHandler<Doc, null> = {\n proof: 'required',\n decode (p) {\n const x = p as Record<string, unknown>\n if (x === null || typeof x !== 'object' || !designatorOk(x.target) ||\n (x.label !== undefined && (typeof x.label !== 'string' || !x.label.length || [...x.label].length > 64)) || Object.keys(x).some((k) => !['target', 'label'].includes(k))) return refuse('malformed')\n return x as Doc\n },\n async prepare (ctx, doc) {\n // the act window, like the request's and the forward's (8110): a replay\n // after the effect cache let the offer go opens no prompt again\n if (!actWindowHolds(doc.issuedAt, ctx.when)) return refuse('validation-failed', 'RLTP-TRU-8110')\n return (await diVerify(doc, doc.issuer, ctx.crypto.subtle)) ? null : refuse('validation-failed')\n },\n apply (state, _p, doc, arr) {\n const a = arrival(state, arr.rkid)!\n const o: IntroOffer = {\n id: offerPromptId(arr.digest), mediatorContactId: a.contactId, pin: a.label, target: doc.payload.target,\n ...(doc.payload.label !== undefined ? { label: doc.payload.label } : {}), at: arr.when,\n }\n const prompt: Prompt = { id: o.id, kind: 'introduction', contactId: a.contactId, openedAt: arr.when, expiresAt: arr.when + ACT_EXPIRY }\n return {\n state: { ...state, encounter: { ...state.encounter, offers: { ...state.encounter.offers, [o.id]: o } }, prompts: { ...state.prompts, [prompt.id]: prompt } },\n events: [{ type: 'prompt.opened', promptId: prompt.id, kind: 'introduction' }],\n }\n },\n}\n\n// ── the request: the requester's decision on an offer ──────────────────\n\ninterface RequestPrep { act: string, fresh: Awaited<ReturnType<typeof freshCard>>, request: Artifact<RequestBody>, doc: Sealed, ackDelayMs: number }\n\nasync function prepareRequest (ctx: PrepareCtx, o: Readonly<IntroOffer>): Promise<RequestPrep | Refusal> {\n const pin = tupleByLabel(ctx.snapshot, o.pin)\n if (!pin || pin.tuple.deactivated) return no('no-own-channel', 'RLTP-TRU-8270')\n // Delivery §4.4: never a request to a mediator whose declaration is not held\n const dec = ctx.snapshot.encounter.declarations[`${pin.tuple.counterpartAnchor} ${MEDIATOR_ROLE}`]\n const c = dec ? mediatorConstants(dec.constants) : null\n if (!c) return no('no-declaration')\n const fresh = await freshCard(ctx)\n const act = actIdOf(ctx.entropy.bytes('intro.act', 32))\n const name = displayNameOf(ctx.snapshot)\n const body: RequestBody = {\n type: 'introduction-request@1', act, issuedAt: iso(ctx.when), target: o.target,\n cardDigest: await introDigest(fresh.card, ctx.crypto.subtle), profile: name !== undefined ? { displayName: name } : {},\n }\n const request = await signIntroArtifact(body, (b) => ctx.keys.sign(fresh.label, b))\n const doc = await onTuple(ctx, o.pin, INTRODUCTION_TYPES.request, { introduction: request, card: fresh.card }, ctx.entropy.id('thread.id'))\n return { act, fresh, request, doc, ackDelayMs: c.ackDelayMs }\n}\n\nfunction applyRequest (state: Readonly<HolderState>, o: Readonly<IntroOffer>, p: RequestPrep, when: Millis): Applied | Refusal {\n if (held(state, 'requester', p.act)) throw new Error('introduction: the act id is not fresh (8080)')\n if (state.register.labels.includes(p.fresh.label)) throw new Error('introduction: the pair label is not fresh')\n const a: IntroAct = {\n key: keyOf('requester', p.act), act: p.act, role: 'requester', status: 'sent', issuedAt: tsec(when), request: p.request as unknown as JsonObject,\n requestCard: p.fresh.card as JsonObject, reply: null, replyCard: null, pins: { mediator: o.pin }, threads: { request: p.doc.threadId },\n at: when, ackDelayMs: p.ackDelayMs, ownLabel: p.fresh.label, ack: null, replyForwarded: false, vouchersSent: false,\n pendingVoucher: null, voucher: null, vouched: false, promptId: null, ...(o.label !== undefined ? { peerName: o.label } : {}),\n }\n const offers = { ...state.encounter.offers }\n delete offers[o.id]\n const next: HolderState = {\n ...state,\n // the act's fresh label in the register before its card is shown (Identity 6.1)\n register: withPairNonce(state.register, p.fresh.label, p.fresh.nonce),\n addresses: { ...state.addresses, keys: { ...state.addresses.keys, [p.fresh.rkid]: { label: p.fresh.label, lastShown: when } } },\n encounter: { ...state.encounter, offers },\n }\n return { state: withAct(next, a), outbound: [draft(p.doc)] }\n}\n\n// ── the mediator: the request (8410–8440) ──────────────────────────────\n\ninterface RequestPayload { introduction: Artifact<RequestBody>, card: Doc }\ntype MediatorPrep = { dup: 'same' | 'none', forward: Sealed | null, target: string | null, ack: Sealed | null }\n\nconst requestTask: TaskHandler<RequestPayload, MediatorPrep> = {\n proof: 'absent',\n decode: (p) => (introSchemaOk('visibility-payload-introduction-request.schema.json', p) ? p as RequestPayload : refuse('malformed')),\n async prepare (ctx, doc, arr) {\n const s = ctx.snapshot\n const a = arrival(s, arr.rkid)!\n const body = doc.payload.introduction.body\n // step 1: an active channel (the pin set at arrival)\n if (!liveRel(a.rel) || a.tuple.deactivated || a.rel.activeHead !== a.label) return refuse('validation-failed', 'RLTP-TRU-8410')\n // step 2: form — schema (decode), digest, signature, the window, the ack cutoff\n if (!introCardShapeOk(doc.payload.card) || !(await diVerify(doc.payload.card, doc.payload.card.anchor, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8420')\n if (!(await requestFormOk(doc.payload, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8420')\n if (!actWindowHolds(body.issuedAt, ctx.when) || !requestCutoffHolds(body.issuedAt, ctx.when, ACK_DELAY_MS)) return refuse('validation-failed', 'RLTP-TRU-8160')\n const h = held(s, 'mediator', body.act)\n if (h) {\n if (jcs((h.request as Doc).body) !== jcs(doc.payload.introduction.body)) return refuse('validation-failed', 'RLTP-TRU-8240')\n // a byte-identical repeat: the one ack value, once produced (8220, 8230)\n const ack = h.ack ? await onTuple(ctx, a.label, INTRODUCTION_TYPES.ack, { introduction: h.ack }, h.threads.request) : null\n return { dup: 'same', forward: null, target: null, ack }\n }\n // step 4: resolution, for forwarding only and silently (8440)\n const targetId = s.encounter.designators[body.target]\n const t = targetId !== undefined ? channelTo(s, targetId) : null\n const forward = t && t.tuple.ownPairLabel !== a.label\n ? await onTuple(ctx, t.tuple.ownPairLabel, INTRODUCTION_TYPES.forward, doc.payload, ctx.entropy.id('thread.id'))\n : null\n return { dup: 'none', forward, target: forward ? t!.tuple.ownPairLabel : null, ack: null }\n },\n // step 3: received, the ack duty bound before and independent of resolution (8430)\n apply (state, prepared, doc, arr) {\n const p = prepared.value\n if (p.dup === 'same') return { state: state as HolderState, outbound: p.ack ? [draft(p.ack)] : [] }\n const a = arrival(state, arr.rkid)!\n const body = doc.payload.introduction.body\n const act: IntroAct = {\n key: keyOf('mediator', body.act), act: body.act, role: 'mediator', status: p.forward ? 'forwarded' : 'received',\n issuedAt: Date.parse(body.issuedAt), request: doc.payload.introduction as unknown as JsonObject, requestCard: doc.payload.card as JsonObject,\n reply: null, replyCard: null, pins: { requester: a.label, ...(p.target ? { target: p.target } : {}) },\n threads: { request: doc.threadId, ...(p.forward ? { forward: p.forward.threadId } : {}) }, at: arr.when, ackDelayMs: ACK_DELAY_MS,\n ownLabel: null, ack: null, replyForwarded: false, vouchersSent: false, pendingVoucher: null, voucher: null, vouched: false, promptId: null,\n }\n const duty: IntroAckDuty = { kind: 'intro-ack', v: 1, id: 'intro-ack:' + body.act, dueAt: arr.when + ACK_DELAY_MS, act: body.act }\n return { state: withAct(state as HolderState, act), duties: [duty], outbound: p.forward ? [draft(p.forward)] : [] }\n },\n}\n\n/** The mediator's one ack, at t_received + ack-delay (8640), identical for\n * every target (8650); none after the absolute lifetime (8280). */\nconst ackDuty: DutyHandler<{ sealed: Sealed, ack: Json } | null> = {\n v: 1,\n async prepare (ctx, duty) {\n const a = held(ctx.snapshot, 'mediator', (duty as IntroAckDuty).act)\n if (!a || a.ack || lifetimeOver(a, ctx.when) || !a.pins.requester) return null\n const key = await pinKey(ctx, a.pins.requester, MAC_ACK_INFO)\n if (!key) return null\n const ack = await introMacArtifact<AckBody>({ type: 'introduction-ack@1', act: a.act }, key, ctx.crypto.subtle)\n return { sealed: await onTuple(ctx, a.pins.requester, INTRODUCTION_TYPES.ack, { introduction: ack }, a.threads.request), ack: ack as unknown as JsonObject }\n },\n apply (state, duty, ctx, when) {\n const a = held(state, 'mediator', (duty as IntroAckDuty).act)\n const p = ctx.prepared.value\n // past the lifetime, or the pinned key gone: the duty ends without production (8280)\n if (!a || a.ack || lifetimeOver(a, when) || p === null) return { state: state as HolderState }\n // the ack value as produced, retained for re-delivery (8200, 8230)\n return { state: withAct(state as HolderState, completedIfDone({ ...a, ack: p.ack as JsonObject })), outbound: [draft(p.sealed)] }\n },\n}\n\n// ── the target: the forward (8050) and its consent ─────────────────────\n\nconst forwardTask: TaskHandler<RequestPayload, { known: boolean }> = {\n proof: 'absent',\n decode: (p) => (introSchemaOk('visibility-payload-introduction-forward.schema.json', p) ? p as RequestPayload : refuse('malformed')),\n async prepare (ctx, doc) {\n const body = doc.payload.introduction.body\n if (!actWindowHolds(body.issuedAt, ctx.when)) return refuse('validation-failed', 'RLTP-TRU-8110')\n const h = held(ctx.snapshot, 'target', body.act)\n if (h) return jcs((h.request as Doc).body) === jcs(doc.payload.introduction.body) ? { known: true } : refuse('validation-failed', 'RLTP-TRU-8260')\n // the request signature under the card's anchor, cardDigest, the card (8050)\n if (!(await requestFormOk(doc.payload, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8050')\n if (!introCardShapeOk(doc.payload.card) || !(await diVerify(doc.payload.card, doc.payload.card.anchor, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8050')\n return { known: false }\n },\n // received: the pin at the forward's arrival (8270); the human decides\n // on its own device (8810); \"designates itself\" is the channel it came on\n apply (state, prepared, doc, arr) {\n if (prepared.value.known) return { state: state as HolderState }\n const a = arrival(state, arr.rkid)!\n const body = doc.payload.introduction.body\n const promptId = consentPromptId(body.act)\n const act: IntroAct = {\n key: keyOf('target', body.act), act: body.act, role: 'target', status: 'received', issuedAt: Date.parse(body.issuedAt),\n request: doc.payload.introduction as unknown as JsonObject, requestCard: doc.payload.card as JsonObject, reply: null, replyCard: null,\n pins: { mediator: a.label }, threads: { request: '', forward: doc.threadId }, at: arr.when, ackDelayMs: 0, ownLabel: null, ack: null,\n replyForwarded: false, vouchersSent: false, pendingVoucher: null, voucher: null, vouched: false, promptId,\n }\n const prompt: Prompt = { id: promptId, kind: 'introduction', contactId: a.contactId, openedAt: arr.when, expiresAt: actFiresAt(act.issuedAt + ACT_EXPIRY + ACT_SKEW) }\n return {\n state: { ...withAct(state as HolderState, act), prompts: { ...state.prompts, [promptId]: prompt } },\n events: [{ type: 'prompt.opened', promptId, kind: 'introduction' }],\n }\n },\n}\n\ninterface ReplyPrep { fresh: Awaited<ReturnType<typeof freshCard>>, reply: Artifact<ReplyBody>, doc: Sealed }\n\nasync function prepareReply (ctx: PrepareCtx, a: Readonly<IntroAct>): Promise<ReplyPrep | Refusal> {\n if (!a.pins.mediator || !tupleByLabel(ctx.snapshot, a.pins.mediator)) return no('no-own-channel', 'RLTP-TRU-8270')\n const fresh = await freshCard(ctx)\n const S = ctx.crypto.subtle\n const request = a.request as unknown as Artifact<RequestBody>\n const body: ReplyBody = {\n type: 'introduction-reply@1', act: a.act, requestDigest: await introDigest(request.body, S),\n requesterPair: (a.requestCard as Doc).anchor, cardDigest: await introDigest(fresh.card, S),\n }\n const reply = await signIntroArtifact(body, (b) => ctx.keys.sign(fresh.label, b))\n const doc = await onTuple(ctx, a.pins.mediator, INTRODUCTION_TYPES.reply, { introduction: reply, card: fresh.card }, a.threads.forward!)\n return { fresh, reply, doc }\n}\n\n/** The target consents: its reply out, its fresh tuple toward the requester's card (8380). */\nfunction applyConsent (state: Readonly<HolderState>, a: Readonly<IntroAct>, p: ReplyPrep, when: Millis): Applied | Refusal {\n if (a.status !== 'received') return no('unknown-act')\n if (lifetimeOver(a, when)) return no('prompt-expired', 'RLTP-TRU-8280')\n const name = ((a.request as Doc).body.profile as { displayName?: string }).displayName\n const opened = openIntroduced(state, p.fresh.label, p.fresh.nonce, p.fresh.rkid, a.requestCard as Doc, a.pins.mediator!, name, when)\n const next: IntroAct = { ...a, status: 'consented', reply: p.reply as unknown as JsonObject, replyCard: p.fresh.card as JsonObject, ownLabel: p.fresh.label }\n return { state: withAct(opened.state, next), outbound: [draft(p.doc)], events: opened.events, duties: opened.duties }\n}\n\nconst arrivalContact = (state: Readonly<HolderState>, label: string): string => {\n const at = tupleByLabel(state, label)\n return at ? (entryOf(state, at.rel)?.id ?? at.rel.contactId) : ''\n}\n\n/** introduction: on an offer, accept sends the request; on a forward,\n * accept consents and decline refuses, locally and silently (8380). */\nconst introductionDecision: DecisionDef<RequestPrep | ReplyPrep | Refusal | null> = {\n async prepare (ctx, prompt, choice) {\n if (choice !== 'accept') return null\n const o = ctx.snapshot.encounter.offers[prompt.id]\n if (o) return prepareRequest(ctx, o)\n const a = Object.values(ctx.snapshot.encounter.introductions).find((x) => x.promptId === prompt.id && x.role === 'target')\n return a ? prepareReply(ctx, a) : no('unknown-act')\n },\n apply (state, prompt, choice, when, prepared) {\n const o = state.encounter.offers[prompt.id]\n const a = Object.values(state.encounter.introductions).find((x) => x.promptId === prompt.id && x.role === 'target')\n if (choice === 'decline') {\n if (o) {\n const offers = { ...state.encounter.offers }\n delete offers[o.id]\n return { state: { ...state, encounter: { ...state.encounter, offers } } }\n }\n return a ? { state: withAct(state as HolderState, { ...a, status: 'refused' }) } : { state: state as HolderState }\n }\n const p = prepared.value\n if (p === null || isRefusal(p)) return p ?? no('unknown-act')\n if (o) return applyRequest(state, o, p as RequestPrep, when)\n return a ? applyConsent(state, a, p as ReplyPrep, when) : no('unknown-act')\n },\n}\n\n// ── the reply at the mediator (8480–8540) and at the requester (8550–8600) ─\n\ninterface ReplyPayload { introduction: Artifact<ReplyBody>, card: Doc }\ntype MediatorReplyPrep = { repeat: boolean, toRequester: Sealed | null, vouchers: Sealed[], orphaned?: true }\ntype RequesterReplyPrep = { ignore: boolean }\n\nconst replyChecks = async (ctx: PrepareCtx, a: Readonly<IntroAct>, payload: ReplyPayload): Promise<string | null> => {\n const r = payload.introduction.body\n if (!(await replyBound(payload, ctx.crypto.subtle))) return a.role === 'mediator' ? 'RLTP-TRU-8500' : 'RLTP-TRU-8560'\n if (r.requestDigest !== await introDigest((a.request as Doc).body, ctx.crypto.subtle)) return a.role === 'mediator' ? 'RLTP-TRU-8510' : 'RLTP-TRU-8570'\n if (r.requesterPair !== (a.requestCard as Doc).anchor) return a.role === 'mediator' ? 'RLTP-TRU-8520' : 'RLTP-TRU-8580'\n if (!introCardShapeOk(payload.card) || !(await diVerify(payload.card, payload.card.anchor, ctx.crypto.subtle))) return a.role === 'mediator' ? 'RLTP-TRU-8530' : 'RLTP-TRU-8590'\n return null\n}\n\nconst replyTask: TaskHandler<ReplyPayload, MediatorReplyPrep | RequesterReplyPrep> = {\n proof: 'absent',\n // on the tuple the act pinned, even one a chaining deactivated since (8270)\n pinned: true,\n decode: (p) => (introSchemaOk('visibility-payload-introduction-reply.schema.json', p) ? p as ReplyPayload : refuse('malformed')),\n async prepare (ctx, doc, arr) {\n const s = ctx.snapshot\n const r = doc.payload.introduction.body\n const at = arrival(s, arr.rkid)!\n const m = held(s, 'mediator', r.act)\n if (m && m.pins.target === at.label) {\n // step 2: on the pinned mediator↔target tuple; step 3: forwarded, window and cutoff\n if (m.status !== 'forwarded' && m.status !== 'completed') return refuse('validation-failed', 'RLTP-TRU-8490')\n // a held reply first: a differing one is rejected at any time (8250)\n if (m.reply) {\n if (jcs((m.reply as Doc).body) !== jcs(doc.payload.introduction.body)) return refuse('validation-failed', 'RLTP-TRU-8250')\n return { repeat: true, toRequester: null, vouchers: [] }\n }\n const issuedAt = (m.request as Doc).body.issuedAt as string\n if (!actWindowHolds(issuedAt, ctx.when) || !replyCutoffHolds(issuedAt, ctx.when)) return { repeat: true, toRequester: null, vouchers: [] } // 8180: dropped silently\n const bad = await replyChecks(ctx, m, doc.payload)\n if (bad) return refuse('validation-failed', bad)\n // the requester's relationship departed while the act ran: the reply is\n // taken (an authentic document on the pinned target tuple), the relay\n // ends as failed; nothing goes to a departed relationship\n if (!tupleByLabel(s, m.pins.requester!)) return { repeat: false, toRequester: null, vouchers: [], orphaned: true }\n // forward unchanged (8060) and both vouchers (8740)\n const toRequester = await onTuple(ctx, m.pins.requester!, INTRODUCTION_TYPES.reply, doc.payload, m.threads.request)\n const vouchers: Sealed[] = []\n const vb: VoucherBody = { type: 'introduction-voucher@1', act: r.act, requesterPair: (m.requestCard as Doc).anchor, targetPair: doc.payload.card.anchor }\n for (const [side, thread] of [[m.pins.requester!, m.threads.request], [m.pins.target!, m.threads.forward!]] as const) {\n const key = await pinKey(ctx, side, MAC_VOUCHER_INFO)\n if (!key) return refuse('validation-failed')\n vouchers.push(await onTuple(ctx, side, INTRODUCTION_TYPES.voucher, { voucher: await introMacArtifact(vb, key, ctx.crypto.subtle) }, thread))\n }\n return { repeat: false, toRequester, vouchers }\n }\n const q = held(s, 'requester', r.act)\n if (!q || q.pins.mediator !== at.label) return refuse('validation-failed', 'RLTP-TRU-8550')\n if (!actWindowHolds((q.request as Doc).body.issuedAt, ctx.when)) return refuse('validation-failed', 'RLTP-TRU-8550')\n if (q.reply) return jcs((q.reply as Doc).body) === jcs(doc.payload.introduction.body) ? { ignore: true } : refuse('validation-failed', 'RLTP-TRU-8260')\n // a late reply of a failed act is ignored (8350)\n if (requesterStatus(q, ctx.when) === 'failed') return { ignore: true }\n const bad = await replyChecks(ctx, q, doc.payload)\n return bad ? refuse('validation-failed', bad) : { ignore: false }\n },\n apply (state, prepared, doc, arr) {\n const r = doc.payload.introduction.body\n const p = prepared.value\n if ('vouchers' in p) {\n const m = held(state, 'mediator', r.act)!\n if (p.repeat) return { state: state as HolderState }\n if (p.orphaned) return { state: withAct(state as HolderState, { ...m, status: 'failed', reply: doc.payload.introduction as unknown as JsonObject, replyCard: doc.payload.card as JsonObject }) }\n const next = completedIfDone({ ...m, reply: doc.payload.introduction as unknown as JsonObject, replyCard: doc.payload.card as JsonObject, replyForwarded: true, vouchersSent: true })\n return { state: withAct(state as HolderState, next), outbound: [draft(p.toRequester!), ...p.vouchers.map(draft)] }\n }\n if (p.ignore) return { state: state as HolderState }\n const q = held(state, 'requester', r.act)!\n const opened = openIntroduced(state, q.ownLabel!, state.register.pairNonces[q.ownLabel!], rkidOf(state, q.ownLabel!), doc.payload.card, q.pins.mediator!, q.peerName, arr.when)\n let next: IntroAct = { ...q, status: 'completed', reply: doc.payload.introduction as unknown as JsonObject, replyCard: doc.payload.card as JsonObject }\n // the pending voucher, re-evaluated (8600, 8770)\n let st = opened.state\n if (q.pendingVoucher) {\n // matched it is accepted and retained; unmatched it vouches for nothing and goes\n next = voucherMatches(next, q.pendingVoucher as Doc)\n ? { ...next, pendingVoucher: null, voucher: q.pendingVoucher, vouched: true }\n : { ...next, pendingVoucher: null }\n if (next.vouched) st = markVouched(st, next)\n }\n return { state: withAct(st, next), events: opened.events, duties: opened.duties }\n },\n}\n\n/** The own key-agreement id a label derives under, from `addresses`. */\nfunction rkidOf (state: Readonly<HolderState>, label: string): string {\n for (const [rkid, k] of Object.entries(state.addresses.keys)) if (k.label === label) return rkid\n throw new Error(`introduction: no address key for ${label}`)\n}\n\n// ── the ack at the requester (8680) ────────────────────────────────────\n\nconst ackTask: TaskHandler<{ introduction: Artifact<AckBody> }, { ok: boolean }> = {\n proof: 'absent',\n // on the tuple the act pinned, even one a chaining deactivated since (8270)\n pinned: true,\n decode: (p) => (introSchemaOk('visibility-payload-introduction-ack.schema.json', p) ? p as { introduction: Artifact<AckBody> } : refuse('malformed')),\n async prepare (ctx, doc, arr) {\n const q = held(ctx.snapshot, 'requester', doc.payload.introduction.body.act)\n const at = arrival(ctx.snapshot, arr.rkid)!\n if (!q || q.pins.mediator !== at.label) return refuse('validation-failed', 'RLTP-TRU-8680')\n // after the absolute lifetime, whether or not tick ran (8300)\n if (lifetimeOver(q, ctx.when)) return refuse('validation-failed', 'RLTP-TRU-8300')\n const key = await pinKey(ctx, q.pins.mediator, MAC_ACK_INFO)\n if (!key || !(await introMacOk(doc.payload.introduction, key, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8680')\n return { ok: true }\n },\n // sent → acked; absorbed after completion (8330); ignored after failed (8710)\n apply (state, _p, doc, arr) {\n const q = held(state, 'requester', doc.payload.introduction.body.act)!\n if (requesterStatus(q, arr.when) !== 'sent') return { state: state as HolderState }\n return { state: withAct(state as HolderState, { ...q, status: 'acked' }) }\n },\n}\n\n// ── vouchers at both sides (8.5) ───────────────────────────────────────\n\nconst voucherMatches = (a: Readonly<IntroAct>, v: Doc): boolean => {\n const own = a.role === 'requester'\n const requesterPair = (a.requestCard as Doc).anchor\n const targetPair = (a.replyCard as Doc | null)?.anchor\n return v.body.requesterPair === requesterPair && targetPair !== undefined && v.body.targetPair === targetPair && (own || a.role === 'target')\n}\n\n/** The relationship the act made, marked as vouched by the mediator. */\nfunction markVouched (state: HolderState, a: Readonly<IntroAct>): HolderState {\n const at = a.ownLabel ? tupleByLabel(state, a.ownLabel) : null\n if (!at) return state\n const rel = at.rel\n return { ...state, relationships: { ...state.relationships, [rel.id]: { ...rel, memory: { ...rel.memory, vouchedBy: arrivalContact(state, a.pins.mediator!), vouchedPin: a.pins.mediator! } } } }\n}\n\nconst voucherTask: TaskHandler<{ voucher: Artifact<VoucherBody> }, { role: 'requester' | 'target' }> = {\n proof: 'absent',\n // on the tuple the act pinned, even one a chaining deactivated since (8270)\n pinned: true,\n decode: (p) => (introSchemaOk('visibility-payload-introduction-voucher.schema.json', p) ? p as { voucher: Artifact<VoucherBody> } : refuse('malformed')),\n async prepare (ctx, doc, arr) {\n const act = doc.payload.voucher.body.act\n const at = arrival(ctx.snapshot, arr.rkid)!\n const a = [held(ctx.snapshot, 'requester', act), held(ctx.snapshot, 'target', act)].find((x) => x && x.pins.mediator === at.label)\n // a held act within its lifetime, role-terminal states included (8760, 8290)\n if (!a || lifetimeOver(a, ctx.when)) return refuse('validation-failed', 'RLTP-TRU-8760')\n const key = await pinKey(ctx, a.pins.mediator!, MAC_VOUCHER_INFO)\n if (!key || !(await introMacOk(doc.payload.voucher, key, ctx.crypto.subtle))) return refuse('validation-failed', 'RLTP-TRU-8730')\n return { role: a.role as 'requester' | 'target' }\n },\n // 8260: a repeat is byte-identical in JCS(body) (8210) and ignored, a\n // differing one rejected — against the accepted voucher, retained until\n // the lifetime (8200), and against a pending one alike\n apply (state, prepared, doc) {\n const v = doc.payload.voucher as unknown as Doc\n const a = held(state, prepared.value.role, v.body.act)!\n const kept = (a.voucher ?? a.pendingVoucher) as Doc | null\n if (kept) return jcs(kept.body) === jcs(v.body) ? { state: state as HolderState } : refuse('validation-failed', 'RLTP-TRU-8260')\n if (a.reply === null) return { state: withAct(state as HolderState, { ...a, pendingVoucher: v as JsonObject }) } // 8770\n if (!voucherMatches(a, v)) return refuse('validation-failed', 'RLTP-TRU-8760')\n const next = { ...a, voucher: v as JsonObject, vouched: true }\n return { state: withAct(markVouched(state as HolderState, next), next) }\n },\n}\n\n// ── time: the transitions and the discard (8140, 8340, 8310) ───────────\n\nfunction retainActs (state: Readonly<HolderState>, when: Millis): HolderState {\n let out: Record<string, IntroAct> | null = null\n for (const a of Object.values(state.encounter.introductions)) {\n if (lifetimeOver(a, when)) {\n out ??= { ...state.encounter.introductions }\n delete out[a.key]\n continue\n }\n if (a.role === 'requester') {\n const st = requesterStatus(a, when)\n if (st !== a.status) (out ??= { ...state.encounter.introductions })[a.key] = { ...a, status: st }\n }\n }\n // offers leave with their prompt\n const offers = Object.values(state.encounter.offers).filter((o) => !Object.hasOwn(state.prompts, o.id))\n if (!out && !offers.length) return state as HolderState\n const kept = { ...state.encounter.offers }\n for (const o of offers) delete kept[o.id]\n return { ...state, encounter: { ...state.encounter, introductions: out ?? state.encounter.introductions, offers: kept } }\n}\n\n/** When retainActs changes something: a requester's timeout fires, an\n * act's absolute lifetime ends (the timer contract, engine.ts). */\nfunction actDeadlines (state: Readonly<HolderState>): Millis[] {\n const out: Millis[] = []\n for (const a of Object.values(state.encounter.introductions)) {\n out.push(actFiresAt(a.issuedAt + ACT_EXPIRY + ACT_SKEW))\n if (a.role === 'requester' && (a.status === 'sent' || a.status === 'acked')) out.push(actFiresAt(a.at + ACT_EXPIRY))\n }\n return out\n}\n\n/** The own rkids of every tuple a held act pinned (8270): a chaining\n * during the act deactivates such a tuple, but the act's artifacts stay\n * on it and verify under its key until the absolute lifetime (8290), when\n * retainActs discards the act and with it this claim. */\nfunction pinnedKeys (state: Readonly<HolderState>): string[] {\n const out = new Set<string>()\n for (const a of Object.values(state.encounter.introductions)) {\n for (const label of [a.pins.requester, a.pins.target, a.pins.mediator]) {\n const at = label === undefined ? null : tupleByLabel(state, label)\n if (at) out.add(at.tuple.rkid)\n }\n }\n return [...out]\n}\n\n/** The introduction module createHolder registers. */\nexport function introductionModule (): HolderModule {\n return Object.freeze({\n name: 'introduction',\n commands: Object.freeze({ [INTRODUCTION_COMMANDS.introduce]: introduceDef }),\n tasks: Object.freeze({\n [DECLARATION_TYPE]: declarationTask,\n [OFFER_TYPE]: offerTask,\n [INTRODUCTION_TYPES.request]: requestTask,\n [INTRODUCTION_TYPES.forward]: forwardTask,\n [INTRODUCTION_TYPES.reply]: replyTask,\n [INTRODUCTION_TYPES.ack]: ackTask,\n [INTRODUCTION_TYPES.voucher]: voucherTask,\n }),\n duties: Object.freeze({ 'intro-ack': ackDuty }),\n decisions: Object.freeze({ introduction: introductionDecision }),\n retain: retainActs,\n deadlines: actDeadlines,\n keepKeys: pinnedKeys,\n })\n}\n"]}
@@ -0,0 +1,101 @@
1
+ export declare const INTRODUCTION_TYPES: Readonly<{
2
+ request: string;
3
+ forward: string;
4
+ reply: string;
5
+ ack: string;
6
+ voucher: string;
7
+ }>;
8
+ /** Delivery §4.4's carrier of a role's published constants. */
9
+ export declare const DECLARATION_TYPE: string;
10
+ /** The mediator's role URI: the type it serves as receiver (Delivery §4.4). */
11
+ export declare const MEDIATOR_ROLE: string;
12
+ /** act-expiry PT72H and act-skew PT5M (8110), in ms. */
13
+ export declare const ACT_EXPIRY: number;
14
+ export declare const ACT_SKEW: number;
15
+ /** ack-delay's domain, PT1S to PT1H (Delivery §4.4, Trust 8.4). */
16
+ export declare const ACK_DELAY_MIN = 1000;
17
+ export declare const ACK_DELAY_MAX = 3600000;
18
+ export declare const MAC_ACK_INFO = "rltp/visibility/mac/ack";
19
+ export declare const MAC_VOUCHER_INFO = "rltp/visibility/mac/voucher";
20
+ export declare const introSchemaOk: (file: string, data: unknown) => boolean;
21
+ export interface Artifact<B> {
22
+ body: B;
23
+ proof: Record<string, string>;
24
+ }
25
+ export interface RequestBody {
26
+ type: 'introduction-request@1';
27
+ act: string;
28
+ issuedAt: string;
29
+ target: string;
30
+ cardDigest: string;
31
+ profile: {
32
+ displayName?: string;
33
+ note?: string;
34
+ };
35
+ }
36
+ export interface ReplyBody {
37
+ type: 'introduction-reply@1';
38
+ act: string;
39
+ requestDigest: string;
40
+ requesterPair: string;
41
+ cardDigest: string;
42
+ }
43
+ export interface AckBody {
44
+ type: 'introduction-ack@1';
45
+ act: string;
46
+ }
47
+ export interface VoucherBody {
48
+ type: 'introduction-voucher@1';
49
+ act: string;
50
+ requesterPair: string;
51
+ targetPair: string;
52
+ }
53
+ /** An act id: 32 fresh random bytes, u-base64url, 44 characters (8070, 8450). */
54
+ export declare const actIdOf: (bytes32: Uint8Array) => string;
55
+ /** A raw Ed25519 proofValue over JCS(body) (2450), from a signing function. */
56
+ export declare function signIntroArtifact<B>(body: B, sign: (bytes: Uint8Array) => Promise<Uint8Array>): Promise<Artifact<B>>;
57
+ /** Does a raw Ed25519 proofValue verify under the anchor over JCS(body)? */
58
+ export declare function introSignedBy(a: Artifact<unknown>, anchor: string, subtle?: SubtleCrypto): Promise<boolean>;
59
+ /** The MAC key of an ack or a voucher from the pinned tuple's X25519 secret (8630, 8730). */
60
+ export declare const introMacKey: (shared: Uint8Array, info: string, subtle?: SubtleCrypto) => Promise<Uint8Array>;
61
+ /** A MAC-proved artifact (ack, voucher). */
62
+ export declare function introMacArtifact<B>(body: B, key: Uint8Array, subtle?: SubtleCrypto): Promise<Artifact<B>>;
63
+ export declare const introMacOk: (a: Artifact<unknown>, key: Uint8Array, subtle?: SubtleCrypto) => Promise<boolean>;
64
+ /** 2.1 digests: of a body (requestDigest) and of a complete card (cardDigest). */
65
+ export declare const introDigest: (x: unknown, subtle?: SubtleCrypto) => Promise<string>;
66
+ /** The acceptance window of 8110–8130 at `now`, from the artifact's own
67
+ * issuedAt: whole seconds (2.1), both bounds inclusive. */
68
+ export declare function actWindowHolds(issuedAt: string, now: number): boolean;
69
+ /** The mediator's request cutoff (8160): now + ack-delay ≤ issuedAt + act-expiry. */
70
+ export declare const requestCutoffHolds: (issuedAt: string, now: number, ackDelayMs: number) => boolean;
71
+ /** The mediator's reply cutoff (8170): now ≤ issuedAt + act-expiry. */
72
+ export declare const replyCutoffHolds: (issuedAt: string, now: number) => boolean;
73
+ /** The first whole second strictly after a bound (8140): when a
74
+ * time-driven transition fires. */
75
+ export declare const actFiresAt: (boundMs: number) => number;
76
+ /** A duration of the day-and-time subset of ISO 8601 (Access 7.3: both
77
+ * parts optional, no fraction), in ms; null where the grammar refuses it. */
78
+ export declare function durationMs(s: unknown): number | null;
79
+ /** A declaration's constants for the mediator role (Delivery §4.4: the
80
+ * registering specification closes the names and domains): exactly
81
+ * ack-delay within its domain; else null. */
82
+ export declare function mediatorConstants(constants: Record<string, string>): {
83
+ ackDelayMs: number;
84
+ } | null;
85
+ /** The mediator's step 2 (8420) on a request payload past its schema:
86
+ * cardDigest, the signature under the card's anchor. */
87
+ export declare function requestFormOk(payload: {
88
+ introduction: Artifact<RequestBody>;
89
+ card: any;
90
+ }, subtle?: SubtleCrypto): Promise<boolean>;
91
+ /** A reply's card binding (8500/8560): cardDigest and the signature under the card's anchor. */
92
+ export declare function replyBound(payload: {
93
+ introduction: Artifact<ReplyBody>;
94
+ card: any;
95
+ }, subtle?: SubtleCrypto): Promise<boolean>;
96
+ /** An introduction card: rltp-card/0.25 under Encounter's DI rules (8050, 8530), no sentTo/boundTo. */
97
+ export declare const introCardShapeOk: (card: any) => boolean;
98
+ /** The bytes of 32 random bytes encoded as a designator (8610): u + base64url, never from an anchor. */
99
+ export declare const designatorOf: (bytes: Uint8Array) => string;
100
+ export declare const designatorOk: (d: unknown) => boolean;
101
+ //# sourceMappingURL=introduction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introduction.d.ts","sourceRoot":"","sources":["../src/introduction.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB;;;;;;EAM7B,CAAA;AACF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,QAAkC,CAAA;AAC/D,+EAA+E;AAC/E,eAAO,MAAM,aAAa,QAA6B,CAAA;AAEvD,wDAAwD;AACxD,eAAO,MAAM,UAAU,QAAiB,CAAA;AACxC,eAAO,MAA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AAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,MAA8B,CAAA;AAE3E;8EAC8E;AAC9E,wBAAgB,UAAU,CAAE,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOrD;AAED;;8CAE8C;AAC9C,wBAAgB,iBAAiB,CAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKnG;AAED;yDACyD;AACzD,wBAAsB,aAAa,CAAE,OAAO,EAAE;IAAE,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAIzI;AAED,gGAAgG;AAChG,wBAAsB,UAAU,CAAE,OAAO,EAAE;IAAE,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAIpI;AAED,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,GAAI,MAAM,GAAG,KAAG,OACoE,CAAA;AAEjH,wGAAwG;AACxG,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,MAA6B,CAAA;AAC9E,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,KAAG,OAAwH,CAAA"}
@@ -0,0 +1,132 @@
1
+ // introduction — the pure forms and checks of the Introduction Act (Trust
2
+ // Layer 0.31 §8) and of the registry declaration that publishes the
3
+ // mediator's ack-delay (Delivery 0.81 §4.4), shared by the holder's
4
+ // introduction module (introduction/holder.ts). State-free: which acts a
5
+ // holder holds, its pins and lifecycles, are the module's.
6
+ //
7
+ // Artifacts (2.1): `{ body, proof }`, canonical bytes JCS(body);
8
+ // introduction-request@1 and -reply@1 carry a raw Ed25519 `proofValue`
9
+ // under the fresh card's anchor (2450), -ack@1 and -voucher@1 a `mac`,
10
+ // HMAC-SHA-256 under HKDF(ECDH(pair keys of the pinned tuple), info)
11
+ // (2460, 8630, 8730).
12
+ import { b64uOf, calOK, fromB64u, fromBase58, jcs, makeValidator, tsec } from './core.js';
13
+ import { digestDoc, edRawOfAnchor, hkdf, platformSubtle } from './crypto.js';
14
+ import { macU, rawProofValue } from './anchor.js';
15
+ import { SCHEMAS } from './schemas.js';
16
+ const TT = 'https://real-life.org/trust-tasks/';
17
+ export const INTRODUCTION_TYPES = Object.freeze({
18
+ request: TT + 'introduction-request/0.1',
19
+ forward: TT + 'introduction-forward/0.1',
20
+ reply: TT + 'introduction-reply/0.1',
21
+ ack: TT + 'introduction-ack/0.1',
22
+ voucher: TT + 'introduction-voucher/0.1',
23
+ });
24
+ /** Delivery §4.4's carrier of a role's published constants. */
25
+ export const DECLARATION_TYPE = TT + 'registry-declaration/0.1';
26
+ /** The mediator's role URI: the type it serves as receiver (Delivery §4.4). */
27
+ export const MEDIATOR_ROLE = INTRODUCTION_TYPES.request;
28
+ /** act-expiry PT72H and act-skew PT5M (8110), in ms. */
29
+ export const ACT_EXPIRY = 72 * 3_600_000;
30
+ export const ACT_SKEW = 5 * 60_000;
31
+ /** ack-delay's domain, PT1S to PT1H (Delivery §4.4, Trust 8.4). */
32
+ export const ACK_DELAY_MIN = 1000;
33
+ export const ACK_DELAY_MAX = 3_600_000;
34
+ export const MAC_ACK_INFO = 'rltp/visibility/mac/ack';
35
+ export const MAC_VOUCHER_INFO = 'rltp/visibility/mac/voucher';
36
+ const V = makeValidator(SCHEMAS);
37
+ export const introSchemaOk = (file, data) => V.validate(data, SCHEMAS[file], SCHEMAS[file]).length === 0;
38
+ const te = new TextEncoder();
39
+ /** An act id: 32 fresh random bytes, u-base64url, 44 characters (8070, 8450). */
40
+ export const actIdOf = (bytes32) => {
41
+ if (!(bytes32 instanceof Uint8Array) || bytes32.length !== 32)
42
+ throw new Error('an act id is exactly 32 fresh bytes (8070)');
43
+ return 'u' + b64uOf(bytes32);
44
+ };
45
+ /** A raw Ed25519 proofValue over JCS(body) (2450), from a signing function. */
46
+ export async function signIntroArtifact(body, sign) {
47
+ return { body, proof: { proofValue: rawProofValue(await sign(te.encode(jcs(body)))) } };
48
+ }
49
+ /** Does a raw Ed25519 proofValue verify under the anchor over JCS(body)? */
50
+ export async function introSignedBy(a, anchor, subtle) {
51
+ const S = subtle ?? platformSubtle();
52
+ const raw = edRawOfAnchor(anchor);
53
+ const pv = a?.proof?.proofValue;
54
+ if (!raw || typeof pv !== 'string' || pv[0] !== 'z')
55
+ return false;
56
+ const sig = fromBase58(pv.slice(1));
57
+ if (!sig || sig.length !== 64)
58
+ return false;
59
+ const pub = await S.importKey('raw', raw, { name: 'Ed25519' }, false, ['verify']);
60
+ return S.verify({ name: 'Ed25519' }, pub, sig, te.encode(jcs(a.body)));
61
+ }
62
+ /** The MAC key of an ack or a voucher from the pinned tuple's X25519 secret (8630, 8730). */
63
+ export const introMacKey = (shared, info, subtle) => {
64
+ if (shared.every((b) => b === 0))
65
+ throw new Error('all-zero X25519 output');
66
+ return hkdf(shared, info, 32, subtle);
67
+ };
68
+ /** A MAC-proved artifact (ack, voucher). */
69
+ export async function introMacArtifact(body, key, subtle) {
70
+ return { body, proof: { mac: await macU(key, jcs(body), subtle) } };
71
+ }
72
+ export const introMacOk = async (a, key, subtle) => typeof a?.proof?.mac === 'string' && (await macU(key, jcs(a.body), subtle)) === a.proof.mac;
73
+ /** 2.1 digests: of a body (requestDigest) and of a complete card (cardDigest). */
74
+ export const introDigest = (x, subtle) => digestDoc(x, subtle);
75
+ /** The acceptance window of 8110–8130 at `now`, from the artifact's own
76
+ * issuedAt: whole seconds (2.1), both bounds inclusive. */
77
+ export function actWindowHolds(issuedAt, now) {
78
+ if (!calOK(issuedAt))
79
+ return false;
80
+ const t = tsec(issuedAt), n = tsec(now);
81
+ return t <= n + ACT_SKEW && n <= t + ACT_EXPIRY + ACT_SKEW;
82
+ }
83
+ /** The mediator's request cutoff (8160): now + ack-delay ≤ issuedAt + act-expiry. */
84
+ export const requestCutoffHolds = (issuedAt, now, ackDelayMs) => tsec(now) + ackDelayMs <= tsec(issuedAt) + ACT_EXPIRY;
85
+ /** The mediator's reply cutoff (8170): now ≤ issuedAt + act-expiry. */
86
+ export const replyCutoffHolds = (issuedAt, now) => tsec(now) <= tsec(issuedAt) + ACT_EXPIRY;
87
+ /** The first whole second strictly after a bound (8140): when a
88
+ * time-driven transition fires. */
89
+ export const actFiresAt = (boundMs) => tsec(boundMs) + 1000;
90
+ /** A duration of the day-and-time subset of ISO 8601 (Access 7.3: both
91
+ * parts optional, no fraction), in ms; null where the grammar refuses it. */
92
+ export function durationMs(s) {
93
+ if (typeof s !== 'string')
94
+ return null;
95
+ const m = /^P(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)S)?)?$/.exec(s);
96
+ if (!m || s === 'P' || s.endsWith('T'))
97
+ return null;
98
+ const [d, h, mi, se] = [m[1], m[2], m[3], m[4]].map((x) => (x === undefined ? 0 : Number(x)));
99
+ const ms = (((d * 24 + h) * 60 + mi) * 60 + se) * 1000;
100
+ return Number.isSafeInteger(ms) ? ms : null;
101
+ }
102
+ /** A declaration's constants for the mediator role (Delivery §4.4: the
103
+ * registering specification closes the names and domains): exactly
104
+ * ack-delay within its domain; else null. */
105
+ export function mediatorConstants(constants) {
106
+ const names = Object.keys(constants);
107
+ if (names.length !== 1 || names[0] !== 'ack-delay')
108
+ return null;
109
+ const ms = durationMs(constants['ack-delay']);
110
+ return ms !== null && ms >= ACK_DELAY_MIN && ms <= ACK_DELAY_MAX ? { ackDelayMs: ms } : null;
111
+ }
112
+ /** The mediator's step 2 (8420) on a request payload past its schema:
113
+ * cardDigest, the signature under the card's anchor. */
114
+ export async function requestFormOk(payload, subtle) {
115
+ const { introduction, card } = payload;
116
+ if ((await introDigest(card, subtle)) !== introduction.body.cardDigest)
117
+ return false;
118
+ return introSignedBy(introduction, card.anchor, subtle);
119
+ }
120
+ /** A reply's card binding (8500/8560): cardDigest and the signature under the card's anchor. */
121
+ export async function replyBound(payload, subtle) {
122
+ const { introduction, card } = payload;
123
+ if ((await introDigest(card, subtle)) !== introduction.body.cardDigest)
124
+ return false;
125
+ return introSignedBy(introduction, card.anchor, subtle);
126
+ }
127
+ /** An introduction card: rltp-card/0.25 under Encounter's DI rules (8050, 8530), no sentTo/boundTo. */
128
+ export const introCardShapeOk = (card) => introSchemaOk('contact-card-0.25.schema.json', card) && card.sentTo === undefined && card.boundTo === undefined;
129
+ /** The bytes of 32 random bytes encoded as a designator (8610): u + base64url, never from an anchor. */
130
+ export const designatorOf = (bytes) => 'u' + b64uOf(bytes);
131
+ export const designatorOk = (d) => typeof d === 'string' && /^u[A-Za-z0-9_-]+$/.test(d) && d.length <= 343 && fromB64u(d.slice(1)).length <= 256;
132
+ //# sourceMappingURL=introduction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introduction.js","sourceRoot":"","sources":["../src/introduction.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oEAAoE;AACpE,oEAAoE;AACpE,yEAAyE;AACzE,2DAA2D;AAC3D,EAAE;AACF,iEAAiE;AACjE,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,sBAAsB;AACtB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,EAAE,GAAG,oCAAoC,CAAA;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,M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D,EAAE,MAAqB;IAChH,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IACtC,IAAI,CAAC,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAA;IACpF,OAAO,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACzD,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAAW,EAAE,CACrD,aAAa,CAAC,+BAA+B,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,CAAA;AAEjH,wGAAwG;AACxG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAU,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,GAAG,CAAA","sourcesContent":["// introduction — the pure forms and checks of the Introduction Act (Trust\n// Layer 0.31 §8) and of the registry declaration that publishes the\n// mediator's ack-delay (Delivery 0.81 §4.4), shared by the holder's\n// introduction module (introduction/holder.ts). State-free: which acts a\n// holder holds, its pins and lifecycles, are the module's.\n//\n// Artifacts (2.1): `{ body, proof }`, canonical bytes JCS(body);\n// introduction-request@1 and -reply@1 carry a raw Ed25519 `proofValue`\n// under the fresh card's anchor (2450), -ack@1 and -voucher@1 a `mac`,\n// HMAC-SHA-256 under HKDF(ECDH(pair keys of the pinned tuple), info)\n// (2460, 8630, 8730).\nimport { b64uOf, calOK, fromB64u, fromBase58, jcs, makeValidator, tsec } from './core.js'\nimport { digestDoc, edRawOfAnchor, hkdf, platformSubtle } from './crypto.js'\nimport { macU, rawProofValue } from './anchor.js'\nimport { SCHEMAS } from './schemas.js'\n\nconst TT = 'https://real-life.org/trust-tasks/'\nexport const INTRODUCTION_TYPES = Object.freeze({\n request: TT + 'introduction-request/0.1',\n forward: TT + 'introduction-forward/0.1',\n reply: TT + 'introduction-reply/0.1',\n ack: TT + 'introduction-ack/0.1',\n voucher: TT + 'introduction-voucher/0.1',\n})\n/** Delivery §4.4's carrier of a role's published constants. */\nexport const DECLARATION_TYPE = TT + 'registry-declaration/0.1'\n/** The mediator's role URI: the type it serves as receiver (Delivery §4.4). */\nexport const MEDIATOR_ROLE = INTRODUCTION_TYPES.request\n\n/** act-expiry PT72H and act-skew PT5M (8110), in ms. */\nexport const ACT_EXPIRY = 72 * 3_600_000\nexport const ACT_SKEW = 5 * 60_000\n/** ack-delay's domain, PT1S to PT1H (Delivery §4.4, Trust 8.4). */\nexport const ACK_DELAY_MIN = 1000\nexport const ACK_DELAY_MAX = 3_600_000\n\nexport const MAC_ACK_INFO = 'rltp/visibility/mac/ack'\nexport const MAC_VOUCHER_INFO = 'rltp/visibility/mac/voucher'\n\nconst V = makeValidator(SCHEMAS)\nexport const introSchemaOk = (file: string, data: unknown): boolean => V.validate(data, SCHEMAS[file], SCHEMAS[file]).length === 0\nconst te = new TextEncoder()\n\nexport interface Artifact<B> { body: B, proof: Record<string, string> }\nexport interface RequestBody { type: 'introduction-request@1', act: string, issuedAt: string, target: string, cardDigest: string, profile: { displayName?: string, note?: string } }\nexport interface ReplyBody { type: 'introduction-reply@1', act: string, requestDigest: string, requesterPair: string, cardDigest: string }\nexport interface AckBody { type: 'introduction-ack@1', act: string }\nexport interface VoucherBody { type: 'introduction-voucher@1', act: string, requesterPair: string, targetPair: string }\n\n/** An act id: 32 fresh random bytes, u-base64url, 44 characters (8070, 8450). */\nexport const actIdOf = (bytes32: Uint8Array): string => {\n if (!(bytes32 instanceof Uint8Array) || bytes32.length !== 32) throw new Error('an act id is exactly 32 fresh bytes (8070)')\n return 'u' + b64uOf(bytes32)\n}\n\n/** A raw Ed25519 proofValue over JCS(body) (2450), from a signing function. */\nexport async function signIntroArtifact<B> (body: B, sign: (bytes: Uint8Array) => Promise<Uint8Array>): Promise<Artifact<B>> {\n return { body, proof: { proofValue: rawProofValue(await sign(te.encode(jcs(body)))) } }\n}\n\n/** Does a raw Ed25519 proofValue verify under the anchor over JCS(body)? */\nexport async function introSignedBy (a: Artifact<unknown>, anchor: string, subtle?: SubtleCrypto): Promise<boolean> {\n const S = subtle ?? platformSubtle()\n const raw = edRawOfAnchor(anchor)\n const pv = a?.proof?.proofValue\n if (!raw || typeof pv !== 'string' || pv[0] !== 'z') return false\n const sig = fromBase58(pv.slice(1))\n if (!sig || sig.length !== 64) return false\n const pub = await S.importKey('raw', raw, { name: 'Ed25519' }, false, ['verify'])\n return S.verify({ name: 'Ed25519' }, pub, sig, te.encode(jcs(a.body)))\n}\n\n/** The MAC key of an ack or a voucher from the pinned tuple's X25519 secret (8630, 8730). */\nexport const introMacKey = (shared: Uint8Array, info: string, subtle?: SubtleCrypto): Promise<Uint8Array> => {\n if (shared.every((b) => b === 0)) throw new Error('all-zero X25519 output')\n return hkdf(shared, info, 32, subtle)\n}\n\n/** A MAC-proved artifact (ack, voucher). */\nexport async function introMacArtifact<B> (body: B, key: Uint8Array, subtle?: SubtleCrypto): Promise<Artifact<B>> {\n return { body, proof: { mac: await macU(key, jcs(body), subtle) } }\n}\nexport const introMacOk = async (a: Artifact<unknown>, key: Uint8Array, subtle?: SubtleCrypto): Promise<boolean> =>\n typeof a?.proof?.mac === 'string' && (await macU(key, jcs(a.body), subtle)) === a.proof.mac\n\n/** 2.1 digests: of a body (requestDigest) and of a complete card (cardDigest). */\nexport const introDigest = (x: unknown, subtle?: SubtleCrypto): Promise<string> => digestDoc(x, subtle)\n\n/** The acceptance window of 8110–8130 at `now`, from the artifact's own\n * issuedAt: whole seconds (2.1), both bounds inclusive. */\nexport function actWindowHolds (issuedAt: string, now: number): boolean {\n if (!calOK(issuedAt)) return false\n const t = tsec(issuedAt), n = tsec(now)\n return t <= n + ACT_SKEW && n <= t + ACT_EXPIRY + ACT_SKEW\n}\n\n/** The mediator's request cutoff (8160): now + ack-delay ≤ issuedAt + act-expiry. */\nexport const requestCutoffHolds = (issuedAt: string, now: number, ackDelayMs: number): boolean =>\n tsec(now) + ackDelayMs <= tsec(issuedAt) + ACT_EXPIRY\n\n/** The mediator's reply cutoff (8170): now ≤ issuedAt + act-expiry. */\nexport const replyCutoffHolds = (issuedAt: string, now: number): boolean => tsec(now) <= tsec(issuedAt) + ACT_EXPIRY\n\n/** The first whole second strictly after a bound (8140): when a\n * time-driven transition fires. */\nexport const actFiresAt = (boundMs: number): number => tsec(boundMs) + 1000\n\n/** A duration of the day-and-time subset of ISO 8601 (Access 7.3: both\n * parts optional, no fraction), in ms; null where the grammar refuses it. */\nexport function durationMs (s: unknown): number | null {\n if (typeof s !== 'string') return null\n const m = /^P(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)S)?)?$/.exec(s)\n if (!m || s === 'P' || s.endsWith('T')) return null\n const [d, h, mi, se] = [m[1], m[2], m[3], m[4]].map((x) => (x === undefined ? 0 : Number(x)))\n const ms = (((d * 24 + h) * 60 + mi) * 60 + se) * 1000\n return Number.isSafeInteger(ms) ? ms : null\n}\n\n/** A declaration's constants for the mediator role (Delivery §4.4: the\n * registering specification closes the names and domains): exactly\n * ack-delay within its domain; else null. */\nexport function mediatorConstants (constants: Record<string, string>): { ackDelayMs: number } | null {\n const names = Object.keys(constants)\n if (names.length !== 1 || names[0] !== 'ack-delay') return null\n const ms = durationMs(constants['ack-delay'])\n return ms !== null && ms >= ACK_DELAY_MIN && ms <= ACK_DELAY_MAX ? { ackDelayMs: ms } : null\n}\n\n/** The mediator's step 2 (8420) on a request payload past its schema:\n * cardDigest, the signature under the card's anchor. */\nexport async function requestFormOk (payload: { introduction: Artifact<RequestBody>, card: any }, subtle?: SubtleCrypto): Promise<boolean> {\n const { introduction, card } = payload\n if ((await introDigest(card, subtle)) !== introduction.body.cardDigest) return false\n return introSignedBy(introduction, card.anchor, subtle)\n}\n\n/** A reply's card binding (8500/8560): cardDigest and the signature under the card's anchor. */\nexport async function replyBound (payload: { introduction: Artifact<ReplyBody>, card: any }, subtle?: SubtleCrypto): Promise<boolean> {\n const { introduction, card } = payload\n if ((await introDigest(card, subtle)) !== introduction.body.cardDigest) return false\n return introSignedBy(introduction, card.anchor, subtle)\n}\n\n/** An introduction card: rltp-card/0.25 under Encounter's DI rules (8050, 8530), no sentTo/boundTo. */\nexport const introCardShapeOk = (card: any): boolean =>\n introSchemaOk('contact-card-0.25.schema.json', card) && card.sentTo === undefined && card.boundTo === undefined\n\n/** The bytes of 32 random bytes encoded as a designator (8610): u + base64url, never from an anchor. */\nexport const designatorOf = (bytes: Uint8Array): string => 'u' + b64uOf(bytes)\nexport const designatorOk = (d: unknown): boolean => typeof d === 'string' && /^u[A-Za-z0-9_-]+$/.test(d) && d.length <= 343 && fromB64u(d.slice(1)).length <= 256\n"]}
@@ -0,0 +1,43 @@
1
+ import type { Duty, HolderState } from './state.js';
2
+ import type { HolderEvent } from './events.js';
3
+ /** What a commit was: the operation that produced it. */
4
+ export type CommitOp =
5
+ /** events: what the act announces (the engine passes them) */
6
+ {
7
+ kind: 'act';
8
+ command: string;
9
+ events?: readonly HolderEvent[];
10
+ } | {
11
+ kind: 'tick';
12
+ }
13
+ /** fulfilled: the duties whose handler returned Applied in this commit */
14
+ | {
15
+ kind: 'resume';
16
+ fulfilled?: readonly string[];
17
+ } | {
18
+ kind: 'report';
19
+ status?: string;
20
+ }
21
+ /** type: the received document's; ref: the acknowledged outbox digest of
22
+ * a delivery-ack; rkid: the own key the document arrived on */
23
+ | {
24
+ kind: 'receive';
25
+ disposition?: string;
26
+ digest?: string;
27
+ type?: string;
28
+ ref?: string;
29
+ rkid?: string;
30
+ };
31
+ /** One broken invariant: its name (as in the header) and what broke it. */
32
+ export interface Violation {
33
+ invariant: string;
34
+ detail: string;
35
+ }
36
+ export declare function stateViolations(state: Readonly<HolderState>): Violation[];
37
+ /** Whether a rule lets duty `d` of `before` be gone after the commit `op` (see the header). */
38
+ export declare function dutyDrops(before: Readonly<HolderState>, after: Readonly<HolderState>, d: Readonly<Duty>, op: CommitOp): boolean;
39
+ /** The invariants of one commit from `before` to `after` by `op` (see the header). */
40
+ export declare function transitionViolations(before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp): Violation[];
41
+ /** Both: the commit's invariants and those of the state it leaves. */
42
+ export declare const commitViolations: (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp) => Violation[];
43
+ //# sourceMappingURL=invariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariants.d.ts","sourceRoot":"","sources":["../src/invariants.ts"],"names":[],"mappings":"AAqKA,OAAO,KAAK,EAAW,IAAI,EAAE,WAAW,EAAsC,MAAM,YAAY,CAAA;AAMhG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAK9C,yDAAyD;AACzD,MAAM,MAAM,QAAQ;AAClB,8DAA8D;AAC5D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;AAClB,0EAA0E;GACxE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AACrC;gEACgE;GAC9D;IAAE,IAAI,EAAE,SAAS,CAAC;IAA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