@real-life/trust-protocol 0.3.1 → 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 +58 -11
  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 -70
  250. package/dist/probe/introduce.d.ts.map +0 -1
  251. package/dist/probe/introduce.js +0 -295
  252. package/dist/probe/introduce.js.map +0 -1
  253. package/dist/probe/membership.d.ts +0 -90
  254. package/dist/probe/membership.d.ts.map +0 -1
  255. package/dist/probe/membership.js +0 -450
  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-state-v1.d.ts","sourceRoot":"","sources":["../src/holder-state-v1.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,+gBAA+gB;AAC/gB,MAAM,MAAM,aAAa,GAAG;IAC1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AAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IACT,IAAI,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAA;IACnC,SAAS,EAAE,QAAQ,CAAA;IACnB,KAAK,EAAE,IAAI,CAAA;IACX,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,mBAAmB,GAAG,cAAc,GAAG,cAAc,CAAA;IAC3D,QAAQ,EAAE,QAAQ,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,QAAQ,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,KAAK,CAAA;IAChB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,EAAE,EAAE,QAAQ,CAAA;CACb,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=holder-state-v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holder-state-v1.js","sourceRoot":"","sources":["../src/holder-state-v1.ts"],"names":[],"mappings":"","sourcesContent":["// GENERATED by scripts/build-holder-state-types.mjs — DO NOT EDIT.\n// Source: lib/schemas/holder-state-v1.schema.json (NON-NORMATIVE: the\n// library's storage format at codec 1, not a protocol artifact). The\n// structural projection only; the codec's validator (codec.ts) and the\n// schema carry what a type cannot. holder-state-check.ts holds this type\n// and state.ts's HolderState against each other.\nimport type { Json } from './core.js'\n\n/** NON-NORMATIVE. The stored state of an @real-life/trust-protocol holder at codec 1 (lib/src/codec.ts): the library's storage format, not a protocol artifact. lib/src/holder-state-v1.ts is generated from it (scripts/build-holder-state-types.mjs). Not expressible here and checked by the codec alone: a record's id equals its key (contacts, relationships, groups, duties, rotations, prompts, acts, roster, invitations, records, introductions, offers, challenges), and an envelope's rkid equals its recipient's keyAgreement. */\nexport type HolderStateV1 = {\n codec: 1\n commitSeq: DecV1\n lastWhen: MillisV1\n register: {\n labels: string[]\n pairNonces: Record<string, string>\n carriers: Record<string, {\n nonce: string\n generation: DecV1\n }[]>\n devices: {\n names: string[]\n revoked: string[]\n }\n community: ({\n genesis: string\n head: DecV1\n }) | (null)\n lineage: { [k: string]: Json }[]\n }\n addresses: {\n keys: Record<string, {\n label: string\n lastShown: MillisV1\n retiredAt?: MillisV1\n }>\n tombstones: string[]\n }\n contacts: Record<string, ContactV1>\n relationships: Record<string, RelationshipV1>\n entryOrder: {\n nextPos: DecV1\n heads: string[]\n }\n groups: Record<string, GroupV1>\n profile: {\n body: Json\n revision: DecV1\n }\n effects: Record<string, {\n ack: (StoredAckV1) | (null)\n expiresAt: MillisV1\n }>\n outbox: Record<string, OutboxItemV1>\n duties: Record<string, DutyV1>\n rotations: Record<string, RotationV1>\n prompts: Record<string, PromptV1>\n acts: Record<string, ActRecordV1>\n encounter: {\n challenges: Record<string, {\n value: string\n tCh: MillisV1\n label: string\n card: { [k: string]: Json }\n }>\n records: Record<string, EnactmentRecordV1>\n introductions: Record<string, IntroActV1>\n offers: Record<string, {\n id: string\n mediatorContactId: string\n pin: string\n target: string\n at: MillisV1\n label?: string\n }>\n designators: Record<string, string>\n declarations: Record<string, {\n issuer: string\n role: string\n revision: DecV1\n constants: Record<string, string>\n at: MillisV1\n }>\n }\n joining: {\n preludes: Record<string, {\n group: string\n inviter: string\n contactId: string\n rkid: string\n memberLabel: string\n at: MillisV1\n }>\n invites: Record<string, {\n credDigest: string\n group: string\n name: string\n contactId: string\n rkid: string\n memberLabel: string\n invite: { [k: string]: Json }\n promptId: string\n validUntil: MillisV1\n status: \"open\" | \"accepted\" | \"declined\" | \"joined\"\n at: MillisV1\n acceptDigest?: string\n }>\n }\n}\n\n/** a counter as a canonical decimal string */\nexport type DecV1 = string\n\n/** milliseconds since the epoch, a safe non-negative integer */\nexport type MillisV1 = number\n\nexport type SettingV1 = \"default\" | \"on\" | \"off\"\n\nexport type TrustClassV1 = \"star\" | \"groupStar\" | \"anchorMapping\" | \"sealedGroupStar\" | \"profile\"\n\nexport type RecipientV1 = {\n contactId: string\n rkid: string\n keyAgreement: string\n anchor?: string\n via?: string\n}\n\nexport type EnvelopeV1 = {\n rkid: string\n epk: string\n nonce: string\n ciphertext: string\n}\n\nexport type AssemblyV1 = {\n salt: DecV1\n chunks: { [k: string]: Json }\n}\n\nexport type StarPairV1 = {\n member: string\n head: string\n}\n\nexport type GroupStarItemV1 = ({\n group: string\n mode: \"digest\"\n}) | ({\n group: string\n mode: \"sealed\"\n member: string\n memberOp: string\n})\n\nexport type StarOutInflightV1 = {\n view: StarPairV1[]\n viewDigest: string\n digests: string[]\n acked: string[]\n}\n\n/** the sender side of one reconciled sequence (5.4); snapshot and snapshotDigest are null together */\nexport type StarOutV1 = {\n lastSalt: DecV1\n exhausted: boolean\n hwm: DecV1\n snapshot: (StarPairV1[]) | (null)\n snapshotDigest: (string) | (null)\n inflight: Record<string, StarOutInflightV1>\n}\n\nexport type StarInV1 = {\n hwm: DecV1\n lowerBound: DecV1\n assembly: (AssemblyV1) | (null)\n accepted: ({\n salt: DecV1\n blinded: string[]\n matches: string[]\n }) | (null)\n}\n\nexport type GroupStarOutInflightV1 = {\n view: GroupStarItemV1[]\n viewDigest: string\n digests: string[]\n acked: string[]\n}\n\n/** the sender side of one reconciled sequence (5.4); snapshot and snapshotDigest are null together */\nexport type GroupStarOutV1 = {\n lastSalt: DecV1\n exhausted: boolean\n hwm: DecV1\n snapshot: (GroupStarItemV1[]) | (null)\n snapshotDigest: (string) | (null)\n inflight: Record<string, GroupStarOutInflightV1>\n}\n\nexport type GroupStarInV1 = {\n hwm: DecV1\n lowerBound: DecV1\n assembly: (AssemblyV1) | (null)\n accepted: ({\n salt: DecV1\n entries: {\n d: string\n c: string\n }[]\n groups: string[]\n }) | (null)\n}\n\nexport type ContinuityDueV1 = ({\n kind: \"choice\"\n prior: string\n alts: string[]\n}) | ({\n kind: \"report\" | \"align\"\n prior: string\n})\n\nexport type LogHeadV1 = ({\n genesis: string\n empty: true\n}) | ({\n genesis: string\n entryId: string\n gen: number\n next: string\n commit: string\n})\n\n/** one enactment's tuple of a relationship (Trust 6.4) */\nexport type TupleV1 = {\n ownPairLabel: string\n counterpartAnchor: string\n counterpartKeyAgreement: string\n rkid: string\n entryId: string\n priorCandidates: {\n ownPairLabel: string\n counterpartAnchor: string\n replaces?: string[]\n }[]\n starOut: StarOutV1\n starIn: StarInV1\n groupStarOut: GroupStarOutV1\n groupStarIn: GroupStarInV1\n probeOut: {\n seq: DecV1\n inflight: Record<string, {\n digests: string[]\n acked: string[]\n }>\n done: boolean\n }\n probeIn: {\n hwm: DecV1\n lowerBound: DecV1\n assembly: (AssemblyV1) | (null)\n }\n continuityOut: {\n rev: DecV1\n body: Json\n proof: Json\n sent: string[]\n align: boolean\n chosen: (string) | (null)\n reported: (string) | (null)\n aligned: boolean\n due: (ContinuityDueV1) | (null)\n }\n continuityIn: {\n rev: DecV1\n body: Json\n recordPrior: (string) | (null)\n }\n mappingOut: {\n rev: DecV1\n body: Json\n underAnchor: (string) | (null)\n }\n mappingIn: {\n rev: DecV1\n body: Json\n self: (string) | (null)\n card: Json\n }\n profileOut: {\n rev: DecV1\n }\n profileIn: {\n rev: DecV1\n body: Json\n verifiedSeq: DecV1\n }\n deactivated: boolean\n}\n\nexport type RelationshipV1 = {\n id: string\n contactId: string\n tuples: TupleV1[]\n activeHead: string\n earliestAnchor: (string) | (null)\n links: {\n prev: string\n next: string\n }[]\n bindings: Record<string, string[]>\n heldCounterpartHead: (string) | (null)\n memory: { [k: string]: Json }\n provenance: {\n kind: \"ceremony\" | \"introduced\"\n at: MillisV1\n via?: string\n viaPin?: string\n }\n chainedInto: (string) | (null)\n firstVerified: (DecV1) | (null)\n}\n\n/** one entry of the deliverable set (Trust 2120, 2140); its id equals its key */\nexport type ContactV1 = {\n id: string\n pos: (DecV1) | (null)\n status: \"none\" | \"admitted\" | \"pending\"\n aliases: string[]\n relIds: string[]\n anchorHead: (string) | (null)\n settings: {\n star: SettingV1\n groupStar: SettingV1\n anchorMapping: SettingV1\n sealedGroupStar: SettingV1\n profile: SettingV1\n }\n groupSettings: Record<string, SettingV1>\n}\n\nexport type OutboxStepV1 = ({\n status: \"submitted\"\n at: MillisV1\n attempt: number\n}) | ({\n status: \"awaiting-transport\"\n at: MillisV1\n reason: \"offline\" | \"transport-unreachable\" | \"carrier-refused-retriable\"\n}) | ({\n status: \"accepted\"\n at: MillisV1\n}) | ({\n status: \"delivered\"\n at: MillisV1\n late: boolean\n}) | ({\n status: \"failed\"\n at: MillisV1\n reason: \"unroutable\" | \"oversize\" | \"expired-by-adapter-policy\"\n}) | ({\n status: \"failed\"\n at: MillisV1\n reason: \"rejected-by-receiver\"\n code: \"malformedRequest\" | \"unsupportedType\" | \"proofRequired\" | \"proofInvalid\" | \"wrongRecipient\" | \"identityMismatch\"\n})\n\n/** an issued document; its envelope's rkid equals recipient.keyAgreement (not expressible here, checked by the codec) */\nexport type OutboxItemV1 = {\n type: string\n threadId: string\n recipient: RecipientV1\n envelope: EnvelopeV1\n attempt: number\n history: OutboxStepV1[]\n nextAttemptAt?: MillisV1\n}\n\nexport type StoredAckV1 = {\n digest: string\n envelope: EnvelopeV1\n threadId: string\n recipient: RecipientV1\n at: MillisV1\n attempt: number\n sent: boolean\n nextAttemptAt?: MillisV1\n sentBy?: \"report\" | \"horizon\"\n}\n\nexport type ReissueMappingDutyV1 = {\n kind: \"reissue-mapping\"\n v: 1\n id: string\n contactId: string\n relId: string\n awaitHead: (string) | (null)\n dueAt?: MillisV1\n}\n\nexport type ClassOnDutyV1 = {\n kind: \"class-on\"\n v: 1\n id: string\n contactId: string\n relId: string\n cls: TrustClassV1\n dueAt?: MillisV1\n}\n\nexport type ProfileDutyV1 = {\n kind: \"profile\"\n v: 1\n id: string\n contactId: string\n relId: string\n rev: DecV1\n dueAt?: MillisV1\n}\n\nexport type ContinuityDutyV1 = {\n kind: \"continuity\"\n v: 1\n id: string\n relId: string\n tuple: string\n step: \"probe\" | \"mapping\"\n dueAt?: MillisV1\n attempt?: number\n lastAt?: MillisV1\n}\n\nexport type MergeDutyV1 = {\n kind: \"merge\"\n v: 1\n id: string\n entryIds: string[]\n relId: string\n witness: {\n heads: Record<string, string>\n superseded: Record<string, string[]>\n }\n dueAt?: MillisV1\n}\n\nexport type RotationDutyV1 = {\n kind: \"rotation\"\n v: 1\n id: string\n rotationId: string\n dueAt?: MillisV1\n attempt?: number\n lastAt?: MillisV1\n}\n\nexport type IntroAckDutyV1 = {\n kind: \"intro-ack\"\n v: 1\n id: string\n act: string\n dueAt?: MillisV1\n}\n\n/** a duty of a kind or version this library does not handle: kept as it is */\nexport type UnknownDutyV1 = {\n kind: string\n v: number\n id: string\n [k: string]: Json\n}\n\nexport type DutyV1 = (ReissueMappingDutyV1) | (ClassOnDutyV1) | (ProfileDutyV1) | (ContinuityDutyV1) | (MergeDutyV1) | (RotationDutyV1) | (IntroAckDutyV1) | (UnknownDutyV1)\n\n/** a journaled event (events.ts) */\nexport type EventV1 = ({\n type: \"contact.added\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n actId?: string\n}) | ({\n type: \"contact.verified\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipId: string\n actId?: string\n}) | ({\n type: \"contact.chained\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n from: string\n into: string\n actId?: string\n}) | ({\n type: \"contact.merged\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n merged: string[]\n actId?: string\n}) | ({\n type: \"contact.split\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n leaver: string\n relationshipId: string\n actId?: string\n}) | ({\n type: \"contact.departed\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipIds: string[]\n removed: boolean\n actId?: string\n}) | ({\n type: \"trust.given\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n actId?: string\n}) | ({\n type: \"trust.received\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n actId?: string\n}) | ({\n type: \"trust.paused\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n paused: boolean\n actId?: string\n}) | ({\n type: \"group.joined\"\n eventId: string\n commitSeq: DecV1\n groupId: string\n actId?: string\n}) | ({\n type: \"prompt.opened\"\n eventId: string\n commitSeq: DecV1\n promptId: string\n kind: \"encounter-confirm\" | \"group-invite\" | \"introduction\"\n actId?: string\n}) | ({\n type: \"prompt.decided\"\n eventId: string\n commitSeq: DecV1\n promptId: string\n kind: \"encounter-confirm\" | \"group-invite\" | \"introduction\"\n choice: \"accept\" | \"decline\"\n actId?: string\n}) | ({\n type: \"delivery.status\"\n eventId: string\n commitSeq: DecV1\n digest: string\n threadId: string\n status: \"submitted\" | \"accepted\" | \"delivered\" | \"failed\"\n actId?: string\n late?: boolean\n}) | ({\n type: \"profile.updated\"\n eventId: string\n commitSeq: DecV1\n contactId: (string) | (null)\n actId?: string\n}) | ({\n type: \"anchor.rotated\"\n eventId: string\n commitSeq: DecV1\n generation: DecV1\n actId?: string\n}) | ({\n type: \"device.added\"\n eventId: string\n commitSeq: DecV1\n name: string\n actId?: string\n}) | ({\n type: \"device.revoked\"\n eventId: string\n commitSeq: DecV1\n name: string\n actId?: string\n}) | ({\n type: \"duty.unsupported\"\n eventId: string\n commitSeq: DecV1\n dutyId: string\n kind: string\n v: number\n actId?: string\n}) | ({\n type: \"star.accepted\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipId: string\n salt: DecV1\n actId?: string\n}) | ({\n type: \"groupStar.accepted\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipId: string\n salt: DecV1\n actId?: string\n}) | ({\n type: \"encounter.shown\"\n eventId: string\n commitSeq: DecV1\n challenge: string\n card: { [k: string]: Json }\n actId?: string\n}) | ({\n type: \"encounter.scanned\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n card: { [k: string]: Json }\n actId?: string\n}) | ({\n type: \"encounter.recorded\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipId: string\n role: \"scanner\" | \"displayer\"\n actId?: string\n}) | ({\n type: \"encounter.accepted\"\n eventId: string\n commitSeq: DecV1\n contactId: string\n relationshipId: string\n mutual: boolean\n actId?: string\n}) | ({\n type: \"group.founded\"\n eventId: string\n commitSeq: DecV1\n groupId: string\n actId?: string\n}) | ({\n type: \"group.admitted\"\n eventId: string\n commitSeq: DecV1\n groupId: string\n member: string\n actId?: string\n}) | ({\n type: \"group.vouched\"\n eventId: string\n commitSeq: DecV1\n groupId: string\n member: string\n actId?: string\n})\n\nexport type RosterEntryV1 = {\n anchor: string\n op: string\n keyAgreement: string\n addedAt: MillisV1\n name?: string\n contactId?: string\n rkid?: string\n}\n\nexport type OpenInvitationV1 = {\n invitee: string\n keyAgreement: string\n contactId: string\n rkid: string\n threadId: string\n credDigest: string\n invite: { [k: string]: Json }\n validUntil: MillisV1\n}\n\nexport type EvidenceV1 = {\n invite: { [k: string]: Json }\n accept: { [k: string]: Json }\n vouches: { [k: string]: Json }[]\n at: MillisV1\n}\n\n/** a group the holder is in; a listed group carries memberAnchor and memberOp (Trust 5400) */\nexport type GroupV1 = {\n id: string\n name: string\n memberLabel: string\n rules: {\n vouchThreshold: DecV1\n }\n listed: boolean\n roster: Record<string, RosterEntryV1>\n invitations: Record<string, OpenInvitationV1>\n evidence: Record<string, EvidenceV1>\n preludes: Record<string, {\n contactId: string\n rkid: string\n at: MillisV1\n }>\n did?: string\n genesis?: { [k: string]: Json }\n memberAnchor?: string\n memberOp?: string\n acceptDigest?: string\n}\n\nexport type HeldCredentialV1 = {\n digest: string\n credential: { [k: string]: Json }\n}\n\nexport type EnactmentRecordV1 = {\n ceremony: string\n own: string\n tCh: MillisV1\n peer: string\n counterpart: string\n card: { [k: string]: Json }\n bind: string\n at: MillisV1\n label: string\n relId: string\n role: \"scanner\" | \"displayer\"\n out: (HeldCredentialV1) | (null)\n in: (HeldCredentialV1) | (null)\n thread: (string) | (null)\n bundleDigest: (string) | (null)\n threads: Record<string, string>\n sentCard: ({ [k: string]: Json }) | (null)\n counterPending: boolean\n}\n\nexport type IntroActV1 = {\n key: string\n act: string\n role: \"requester\" | \"mediator\" | \"target\"\n status: \"sent\" | \"acked\" | \"completed\" | \"failed\" | \"received\" | \"forwarded\" | \"consented\" | \"refused\"\n issuedAt: MillisV1\n request: { [k: string]: Json }\n requestCard: { [k: string]: Json }\n reply: ({ [k: string]: Json }) | (null)\n replyCard: ({ [k: string]: Json }) | (null)\n pins: {\n requester?: string\n target?: string\n mediator?: string\n }\n threads: {\n request: string\n forward?: string\n }\n at: MillisV1\n ackDelayMs: number\n ownLabel: (string) | (null)\n ack: ({ [k: string]: Json }) | (null)\n replyForwarded: boolean\n vouchersSent: boolean\n pendingVoucher: ({ [k: string]: Json }) | (null)\n voucher: ({ [k: string]: Json }) | (null)\n vouched: boolean\n promptId: (string) | (null)\n peerName?: string\n}\n\nexport type RotationV1 = {\n id: string\n from: DecV1\n to: DecV1\n step: \"register\" | \"log\" | \"duties\"\n startedAt: MillisV1\n entry: Json\n overHead: LogHeadV1\n awaitHead: Record<string, (string) | (null)>\n}\n\nexport type PromptV1 = {\n id: string\n kind: \"encounter-confirm\" | \"group-invite\" | \"introduction\"\n openedAt: MillisV1\n contactId?: string\n groupId?: string\n expiresAt?: MillisV1\n}\n\nexport type ActRecordV1 = {\n actId: string\n inputHash: string\n commitSeq: DecV1\n outboundDigests: string[]\n events: EventV1[]\n at: MillisV1\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import type { HolderModule } from './engine.js';
2
+ import type { Dec, HolderState, Register } from './state.js';
3
+ import type { KeyProvider } from './ports.js';
4
+ /** The identity module's command names. */
5
+ export declare const IDENTITY_COMMANDS: Readonly<{
6
+ readonly addDevice: "identity.addDevice";
7
+ readonly revokeDevice: "identity.revokeDevice";
8
+ readonly rotate: "identity.rotate";
9
+ }>;
10
+ /** The last generation a rotation moves to (Identity §5.4): 2^53 − 2. */
11
+ export declare const GENERATION_LAST: number;
12
+ export interface DeviceInput {
13
+ name: string;
14
+ }
15
+ /** The register with `label` among its labels (a set: added once). */
16
+ export declare const withLabel: (r: Readonly<Register>, label: string) => Register;
17
+ /** The register with a pair label and its relationship nonce (Identity
18
+ * §6.1): the nonce is recorded alongside the label and never changes. */
19
+ export declare function withPairNonce(r: Readonly<Register>, label: string, nonce: string): Register;
20
+ /** The rotation duty's id for a rotation. */
21
+ export declare const rotationDutyId: (rotationId: string) => string;
22
+ /** A re-issue duty's id after the rotation to generation `to` (6370). */
23
+ export declare const reissueId: (to: Dec, relId: string) => string;
24
+ /** A device key as deviceKey derives it: the device label, the device's
25
+ * did:key and its key-agreement multikey (Identity §5.5). */
26
+ export type DeviceKeyResult = {
27
+ ok: true;
28
+ label: string;
29
+ device: string;
30
+ keyAgreement: string;
31
+ } | {
32
+ ok: false;
33
+ code: 'unknown-device' | 'device-revoked' | 'unknown-context';
34
+ };
35
+ /**
36
+ * The device key of a held, unrevoked device name under an own anchor
37
+ * context (Identity §5.5): derived through the KeyProvider, never stored
38
+ * (keys are not state, 9.3).
39
+ */
40
+ export declare function deviceKeyOf(state: Readonly<HolderState>, keys: KeyProvider, name: string, contextLabel: string): Promise<DeviceKeyResult>;
41
+ /** The identity module createHolder builds in (see the header). */
42
+ export declare function identityModule(): HolderModule;
43
+ //# sourceMappingURL=identity-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-state.d.ts","sourceRoot":"","sources":["../src/identity-state.ts"],"names":[],"mappings":"AA4FA,OAAO,KAAK,EAAoC,YAAY,EAAuB,MAAM,aAAa,CAAA;AACtG,OAAO,KAAK,EAAE,GAAG,EAAQ,WAAW,EAAU,QA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,0 +1,345 @@
1
+ import { canonicalLabel, communityLabel, deviceLabel, deviceName } from './identity.js';
2
+ import { jcs } from './core.js';
3
+ import { bindingOf, rawProofValue } from './anchor.js';
4
+ import { classOnToward, entryOf, entryRelationships, lags, liveRel } from './trust/state.js';
5
+ /** The identity module's command names. */
6
+ export const IDENTITY_COMMANDS = Object.freeze({
7
+ addDevice: 'identity.addDevice', revokeDevice: 'identity.revokeDevice', rotate: 'identity.rotate',
8
+ });
9
+ /** The last generation a rotation moves to (Identity §5.4): 2^53 − 2. */
10
+ export const GENERATION_LAST = Number.MAX_SAFE_INTEGER - 1;
11
+ /** The register with `label` among its labels (a set: added once). */
12
+ export const withLabel = (r, label) => r.labels.includes(label) ? r : { ...r, labels: [...r.labels, label] };
13
+ /** The register with a pair label and its relationship nonce (Identity
14
+ * §6.1): the nonce is recorded alongside the label and never changes. */
15
+ export function withPairNonce(r, label, nonce) {
16
+ if (Object.hasOwn(r.pairNonces, label)) {
17
+ if (r.pairNonces[label] !== nonce)
18
+ throw new Error(`identity: ${label} already holds another relationship nonce (§6.1)`);
19
+ return withLabel(r, label);
20
+ }
21
+ return { ...withLabel(r, label), pairNonces: { ...r.pairNonces, [label]: nonce } };
22
+ }
23
+ const needName = (x, cmd) => {
24
+ if (x === null || typeof x !== 'object' || Array.isArray(x))
25
+ throw new TypeError(`${cmd} needs an input object`);
26
+ const n = x.name;
27
+ if (typeof n !== 'string')
28
+ throw new TypeError(`${cmd}: name must be a string`);
29
+ return n;
30
+ };
31
+ const refuse = (code, ref) => ({ ok: false, code, ...(ref ? { ref } : {}) });
32
+ const commands = {
33
+ // §5.5: the name is persisted before any key derived from it is presented
34
+ [IDENTITY_COMMANDS.addDevice]: {
35
+ human: true,
36
+ apply(state, _p, input) {
37
+ const n = deviceName(needName(input, IDENTITY_COMMANDS.addDevice));
38
+ if (n === null)
39
+ return refuse('device-name-invalid', 'Identity §6.2');
40
+ const d = state.register.devices;
41
+ if (d.revoked.includes(n))
42
+ return refuse('device-name-revoked', 'Identity §5.5');
43
+ if (d.names.includes(n))
44
+ return refuse('device-name-held', 'Identity §5.5');
45
+ return {
46
+ state: { ...state, register: { ...state.register, devices: { ...d, names: [...d.names, n] } } },
47
+ events: [{ type: 'device.added', name: n }],
48
+ };
49
+ },
50
+ },
51
+ // §5.5: revocation consumes the name; the mark is never removed
52
+ [IDENTITY_COMMANDS.revokeDevice]: {
53
+ human: true,
54
+ apply(state, _p, input) {
55
+ const n = deviceName(needName(input, IDENTITY_COMMANDS.revokeDevice));
56
+ const d = state.register.devices;
57
+ if (n === null || !d.names.includes(n))
58
+ return refuse('unknown-device', 'Identity §5.5');
59
+ if (d.revoked.includes(n))
60
+ return { state: state };
61
+ return {
62
+ state: { ...state, register: { ...state.register, devices: { ...d, revoked: [...d.revoked, n] } } },
63
+ events: [{ type: 'device.revoked', name: n }],
64
+ };
65
+ },
66
+ },
67
+ };
68
+ // ── the rotation (Identity §5.4, Trust 6360–6420, 6596, Access §5.6) ──
69
+ /** The rotation duty's id for a rotation. */
70
+ export const rotationDutyId = (rotationId) => `rotation:${rotationId}`;
71
+ /** A re-issue duty's id after the rotation to generation `to` (6370). */
72
+ export const reissueId = (to, relId) => `reissue:${to}:${relId}`;
73
+ /**
74
+ * Where the log stands for the rotation g → g+1 (Identity §5.4, RLTP-ACC-
75
+ * 5980): `present`, its generation g+1 holds this rotation (at(g+1) names
76
+ * this next and commit — appended by this device with its answer lost, or
77
+ * by another device of the same seed, the log since moved on or not);
78
+ * `{over}`, the device may append over that head (empty for g = 1, else
79
+ * the entry that introduced g: gen g, next = prev, commit = the binding of
80
+ * next); `behind`, the log has not reached g; `diverged`, another genesis,
81
+ * another entry at g+1 (a fork), or a head the rotation does not continue.
82
+ */
83
+ async function standing(ctx, head, genesis, from, rot) {
84
+ if (head.genesis !== genesis)
85
+ return 'diverged';
86
+ if ('empty' in head)
87
+ return from === 1 ? { over: null } : 'behind';
88
+ if (head.gen >= from + 1) {
89
+ const e = await ctx.log.at(from + 1);
90
+ return e && e.next === rot.next && e.commit === rot.commit ? 'present' : 'diverged';
91
+ }
92
+ if (head.gen === from && head.next === rot.prev && head.commit === await bindingOf(rot.next, ctx.crypto.subtle))
93
+ return { over: head.entryId };
94
+ return head.gen < from ? 'behind' : 'diverged';
95
+ }
96
+ const headId = (h) => ('empty' in h ? null : h.entryId);
97
+ /**
98
+ * Step 2 through the Log port (see the header): where the log stands, then
99
+ * append(entry, the persisted overHead) — only ever over the head the
100
+ * rotation record names, so the port's idempotence over exactly (entry,
101
+ * overHead) holds across a lost answer; a head that moved is persisted
102
+ * first ('moved'). head-conflict re-reads. A port that throws is a
103
+ * failure: the rotation stays pending.
104
+ */
105
+ async function logStep(ctx, r, genesis) {
106
+ const log = ctx.log;
107
+ if (!log)
108
+ return { status: 'log-missing' };
109
+ const rot = r.entry.rotation;
110
+ try {
111
+ for (let i = 0; i < 4; i++) {
112
+ const head = await log.head();
113
+ const at = await standing(ctx, head, genesis, Number(r.from), rot.body);
114
+ if (at === 'present')
115
+ return { status: 'done', head };
116
+ if (at === 'behind' || at === 'diverged')
117
+ return { status: at, head };
118
+ if (at.over !== headId(r.overHead) || head.genesis !== r.overHead.genesis)
119
+ return { status: 'moved', head };
120
+ const a = await log.append({ rotation: rot }, at.over);
121
+ if (a.status === 'appended' || a.status === 'exists')
122
+ return { status: 'done', head: a.head };
123
+ if (a.status === 'failure')
124
+ return { status: 'failure', reason: a.reason };
125
+ // head-conflict: re-read
126
+ }
127
+ return { status: 'failure', reason: 'head-conflict persisted' };
128
+ }
129
+ catch (e) {
130
+ return { status: 'failure', reason: e?.message ?? String(e) };
131
+ }
132
+ }
133
+ /** 6596, per relationship: the anchor mapping class on for it (live, under
134
+ * its entry), and whether it lags there — then H, else null. */
135
+ function withholding(state, relId) {
136
+ const r = state.relationships[relId];
137
+ if (!r || !liveRel(r))
138
+ return null;
139
+ const e = entryOf(state, r);
140
+ if (!e || !e.relIds.includes(r.id) || !classOnToward(e, 'anchorMapping'))
141
+ return null;
142
+ return { contactId: e.id, awaitHead: lags(r, entryRelationships(state, e)) && e.anchorHead !== null ? e.anchorHead : null };
143
+ }
144
+ /** Step 1's commit (see the header). */
145
+ function startRotation(state, p, when) {
146
+ const com = state.register.community;
147
+ if (com === null || com.head !== p.from || Object.keys(state.rotations).length)
148
+ return refuse('in-flight');
149
+ const awaitHead = {};
150
+ for (const id of Object.keys(state.relationships).sort()) {
151
+ const w = withholding(state, id);
152
+ if (w)
153
+ awaitHead[id] = w.awaitHead;
154
+ }
155
+ const rotation = { id: p.id, from: p.from, to: p.to, step: 'log', startedAt: when, entry: p.entry, overHead: p.overHead, awaitHead };
156
+ const duty = { kind: 'rotation', v: 1, id: rotationDutyId(p.id), rotationId: p.id };
157
+ return {
158
+ state: { ...state, register: withLabel(state.register, p.label), rotations: { ...state.rotations, [p.id]: rotation } },
159
+ duties: [duty],
160
+ };
161
+ }
162
+ /** The completion's commit: head, lineage, the re-issues of 6370 (6596). */
163
+ function completeRotation(state, r) {
164
+ const com = state.register.community;
165
+ if (com === null || com.head !== r.from)
166
+ return refuse('in-flight');
167
+ const rot = r.entry.rotation;
168
+ const duties = [];
169
+ const reissue = (relId, contactId, awaitHead) => {
170
+ duties.push({ kind: 'reissue-mapping', v: 1, id: reissueId(r.to, relId), contactId, relId, awaitHead });
171
+ };
172
+ // decided at step 1 (6596), where the class is still on for it now
173
+ for (const [relId, awaitHead] of Object.entries(r.awaitHead).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {
174
+ const w = withholding(state, relId);
175
+ if (w)
176
+ reissue(relId, w.contactId, awaitHead);
177
+ }
178
+ // on for it now, unknown to step 1: decided now
179
+ for (const relId of Object.keys(state.relationships).sort()) {
180
+ if (Object.hasOwn(r.awaitHead, relId))
181
+ continue;
182
+ const w = withholding(state, relId);
183
+ if (w)
184
+ reissue(relId, w.contactId, w.awaitHead);
185
+ }
186
+ const rotations = { ...state.rotations };
187
+ delete rotations[r.id];
188
+ const left = { ...state.duties };
189
+ delete left[rotationDutyId(r.id)];
190
+ return {
191
+ state: {
192
+ ...state,
193
+ register: { ...withLabel(state.register, communityLabel(com.genesis, Number(r.to))), community: { ...com, head: r.to }, lineage: [...state.register.lineage, rot] },
194
+ rotations,
195
+ duties: left,
196
+ },
197
+ events: [{ type: 'anchor.rotated', generation: r.to }],
198
+ duties,
199
+ };
200
+ }
201
+ /** What step 2's outcome means for the rotation: completion, or why not. */
202
+ function afterLog(state, rotationId, o, when) {
203
+ const r = Object.hasOwn(state.rotations, rotationId) ? state.rotations[rotationId] : undefined;
204
+ if (!r)
205
+ return refuse('in-flight');
206
+ switch (o.status) {
207
+ case 'done': return completeRotation(state, r);
208
+ case 'moved': {
209
+ // the closure's head, persisted before any append over it; the duty
210
+ // runs again at once (lastAt marks the change, no dueAt)
211
+ const id = rotationDutyId(r.id);
212
+ const held = Object.hasOwn(state.duties, id) ? state.duties[id] : { kind: 'rotation', v: 1, id, rotationId: r.id };
213
+ const { dueAt: _, ...rest } = held;
214
+ const duty = { ...rest, lastAt: when };
215
+ // single path: the duty leaves the state and comes back as Applied.duties,
216
+ // on the act path and in resume alike
217
+ const left = { ...state.duties };
218
+ delete left[id];
219
+ return {
220
+ state: { ...state, rotations: { ...state.rotations, [r.id]: { ...r, overHead: o.head } }, duties: left },
221
+ duties: [duty],
222
+ };
223
+ }
224
+ case 'behind': return refuse('log-behind', 'RLTP-ACC-5980');
225
+ case 'diverged': return refuse('log-diverged', 'RLTP-ACC-5980');
226
+ case 'log-missing': return refuse('log-missing');
227
+ case 'failure': return refuse('log-failure');
228
+ }
229
+ }
230
+ const rotateCommand = {
231
+ human: true,
232
+ async prepare(ctx) {
233
+ const st = ctx.snapshot;
234
+ const com = st.register.community;
235
+ if (com === null)
236
+ return { kind: 'refuse', code: 'no-community' };
237
+ if (!ctx.log)
238
+ return { kind: 'refuse', code: 'log-missing' };
239
+ const running = Object.values(st.rotations)[0];
240
+ if (running)
241
+ return { kind: 'resume', rotationId: running.id, outcome: await logStep(ctx, running, com.genesis) };
242
+ const g = Number(com.head);
243
+ if (!Number.isSafeInteger(g) || g < 1 || g + 1 > GENERATION_LAST)
244
+ return { kind: 'refuse', code: 'scope-exhausted', ref: 'Identity §5.4' };
245
+ const [prevL, nextL, afterL] = [g, g + 1, g + 2].map((k) => communityLabel(com.genesis, k));
246
+ const [prev, next, after] = await Promise.all([prevL, nextL, afterL].map((l) => ctx.keys.anchorOf(l)));
247
+ const body = { type: 'anchor-rotation@2', prev: prev.anchor, next: next.anchor, commit: await bindingOf(after.anchor, ctx.crypto.subtle) };
248
+ const bytes = new TextEncoder().encode(jcs(body));
249
+ const rotation = {
250
+ body,
251
+ proof: { proofValue: rawProofValue(await ctx.keys.sign(prevL, bytes)), successorProofValue: rawProofValue(await ctx.keys.sign(nextL, bytes)) },
252
+ };
253
+ // §5.4: the device rotates only over the log it holds — checked before
254
+ // anything commits, so label and 6596 decision persist only when it may
255
+ const overHead = await ctx.log.head();
256
+ const at = await standing(ctx, overHead, com.genesis, g, body);
257
+ if (at === 'behind')
258
+ return { kind: 'refuse', code: 'log-behind', ref: 'RLTP-ACC-5980' };
259
+ if (at === 'diverged')
260
+ return { kind: 'refuse', code: 'log-diverged', ref: 'RLTP-ACC-5980' };
261
+ const to = String(g + 1);
262
+ return { kind: 'start', id: to, from: com.head, to, entry: { rotation }, overHead, label: nextL };
263
+ },
264
+ apply(state, prepared, _input, when) {
265
+ const p = prepared.value;
266
+ if (p.kind === 'refuse')
267
+ return refuse(p.code, p.ref);
268
+ if (p.kind === 'start')
269
+ return startRotation(state, p, when);
270
+ return afterLog(state, p.rotationId, p.outcome, when);
271
+ },
272
+ };
273
+ /** The rotation duty (rotation/1): step 2 on resume. */
274
+ const rotationDuty = {
275
+ v: 1,
276
+ async prepare(ctx, duty) {
277
+ const r = ctx.snapshot.rotations[duty.rotationId];
278
+ const com = ctx.snapshot.register.community;
279
+ return r && com ? logStep(ctx, r, com.genesis) : null;
280
+ },
281
+ apply(state, duty, ctx, when) {
282
+ const d = duty;
283
+ // a rotation completed (by the act) or gone: nothing left to do
284
+ if (!Object.hasOwn(state.rotations, d.rotationId))
285
+ return { state: state };
286
+ const o = ctx.prepared.value;
287
+ if (o === null)
288
+ return 'not-due';
289
+ if (o.status === 'failure') {
290
+ // pending, due again after the retry backoff (the duty's own attempt)
291
+ const attempt = (d.attempt ?? 0) + 1;
292
+ const again = { ...d, attempt, lastAt: when, dueAt: Math.min(when + Math.max(0, Math.ceil(ctx.backoff(attempt))), Number.MAX_SAFE_INTEGER) };
293
+ return { state: state, duties: [again] };
294
+ }
295
+ return afterLog(state, d.rotationId, o, when);
296
+ },
297
+ };
298
+ /** Whether `label` names an own anchor context: a label of the register,
299
+ * or a generation of the community anchor up to its head (§5.4). */
300
+ function ownContext(state, label) {
301
+ if (label.startsWith('device/'))
302
+ return false;
303
+ // the community's generations first, bounded by the head: the label of
304
+ // a pending g+1 is recorded, but no key is presented under it before the
305
+ // rotation completes (§5.4)
306
+ const c = state.register.community;
307
+ if (c !== null) {
308
+ const base = communityLabel(c.genesis, 1);
309
+ if (label === base)
310
+ return true;
311
+ if (label.startsWith(base + '/')) {
312
+ const g = BigInt(label.slice(base.length + 1));
313
+ return g >= 2n && g <= BigInt(c.head);
314
+ }
315
+ }
316
+ return state.register.labels.includes(label);
317
+ }
318
+ /**
319
+ * The device key of a held, unrevoked device name under an own anchor
320
+ * context (Identity §5.5): derived through the KeyProvider, never stored
321
+ * (keys are not state, 9.3).
322
+ */
323
+ export async function deviceKeyOf(state, keys, name, contextLabel) {
324
+ const n = deviceName(name);
325
+ const d = state.register.devices;
326
+ if (n === null || !d.names.includes(n))
327
+ return { ok: false, code: 'unknown-device' };
328
+ if (d.revoked.includes(n))
329
+ return { ok: false, code: 'device-revoked' };
330
+ const a = canonicalLabel(contextLabel);
331
+ if (a === null || !ownContext(state, a))
332
+ return { ok: false, code: 'unknown-context' };
333
+ const label = await deviceLabel(n, a);
334
+ const k = await keys.anchorOf(label);
335
+ return { ok: true, label, device: k.anchor, keyAgreement: k.keyAgreement };
336
+ }
337
+ /** The identity module createHolder builds in (see the header). */
338
+ export function identityModule() {
339
+ return Object.freeze({
340
+ name: 'identity',
341
+ commands: Object.freeze({ ...commands, [IDENTITY_COMMANDS.rotate]: rotateCommand }),
342
+ duties: Object.freeze({ rotation: rotationDuty }),
343
+ });
344
+ }
345
+ //# sourceMappingURL=identity-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-state.js","sourceRoot":"","sources":["../src/identity-state.ts"],"names":[],"mappings":"AA8FA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEvF,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE5F,2CAA2C;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,oBAAoB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB;CACzF,CAAC,CAAA;AAEX,yEAAyE;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,gBAAgB,GAAG,CAAC,CAAA;AAI1D,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAqB,EAAE,KAAa,EAAY,EAAE,CAC1E,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAA;AAEnF;0EAC0E;AAC1E,MAAM,UAAU,aAAa,CAAE,CA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,CAAC,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAA;IACtF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACrC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,CAAA;AAC5E,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,cAAc;IAC5B,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;QACnF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;KAClD,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// identity-state — the Identity Layer on the holder (lib Stage 2, PR 6):\n// the label register (Identity §2, §6.3) with its device names and\n// revocation marks (§5.5), and the community anchor's rotation as a\n// resumable procedure over the Log port (§5.4; Trust 6360–6420, 6596;\n// Access §5.6). Module `identity`, built into createHolder.\n//\n// Labels and addresses: a pair label's key is a delivery address (Delivery\n// §5): retired, it becomes a tombstone for ever. A member label\n// group/<digest> is an identity context (§6.1): one derivation per group,\n// reused whenever the holder is invited to that group again, so its key\n// leaves `addresses` without a tombstone (engine.ts tick). The register\n// keeps every label either way.\n//\n// What the module registers:\n// commands identity.addDevice {name} a device name into the\n// register (§5.5), before any key derived from it is\n// presented; human\n// identity.revokeDevice {name} the name's revocation mark\n// (§5.5): never removed, the name never given again; human\n// identity.rotate {} the community anchor's rotation\n// (§5.4): step 1 when none runs, else step 2 of the running\n// one; human (holder.rotateAnchor)\n// duty rotation/1 {rotationId} step 2 on resume, until the log\n// holds the entry\n//\n// The rotation, a procedure in state.rotations (note §2.1, §3 Log: head,\n// at, append):\n// where the log stands (standing), for a rotation g → g+1 (§5.4, RLTP-\n// ACC-5980): the genesis must match; a log whose generation g+1 is\n// held (head.gen ≥ g+1) holds this rotation where at(g+1) names its\n// next and commit (present: this device's append whose answer was\n// lost, or another device of the seed, the log since moved on or not),\n// else a fork (diverged); otherwise the device may append over the\n// head that holds the lineage through g (empty for g = 1, else gen g,\n// next = prev, commit = the binding of next); an earlier head is\n// behind, any other diverged\n// step 1 (identity.rotate, one commit) anchor-rotation@2 built (prev g,\n// next g+1, commit = the binding of g+2) and signed by prev and next\n// through the KeyProvider; the head read and the log's standing checked\n// BEFORE anything commits: behind and diverged are refused (log-behind,\n// log-diverged), so the label and the 6596 decision persist only when\n// the device may rotate. Then in one commit the label of g+1 (§5.4:\n// persisted before any presentation; 6360: before the log entry), per\n// relationship the withholding of 6596 decided against the entry state\n// now (awaitHead: H, the entry's anchor head, where it lags; null where\n// it does not; only where the anchor mapping class is on), the closure\n// {entry: {rotation}, overHead: the head read}, the rotation duty. The\n// register's head stays g: nothing is issued under g+1 before the log\n// holds it, and no device key derives under g+1 (deviceKey)\n// step 2 (the rotation duty on resume, or identity.rotate again) the\n// standing again: present completes without an append; behind and\n// diverged keep the rotation pending (the duty refused, no timer: the\n// log's sync is the cue; the act answers log-behind, log-diverged). An\n// append goes only ever over the head the rotation record names, so the\n// port's idempotence over exactly (entry, overHead) holds across a lost\n// answer: where the head the device may append over is another, it is\n// persisted first (the record's overHead, the duty due at once) and the\n// append follows on the next run. append on appended/exists completes the\n// rotation in one commit: the register's head g+1, the rotation in\n// register.lineage, the rotation and its duty gone, anchor.rotated, and\n// the re-issue duties of 6370 opened from the awaitHead decided at step\n// 1 (reissue-mapping/1, id reissue:<g+1>:<relId>) — and for a live\n// relationship the class is on for now that was not in it (new since\n// step 1), decided at completion. A chaining in between unions the\n// decisions onto the chain (null wins). head-conflict re-reads (four\n// reads); failure, or a port that throws, keeps the rotation pending:\n// the duty is due again after the retry backoff (attempt, lastAt), the\n// act answers log-failure\n// 6380 (the self card under the new anchor wherever it is carried): the\n// card travels only inside anchor-mapping@4 here (6.1 card), so the\n// re-issue of 6370 carries it; no duty of its own until the encounter\n// (PR 7) carries a card elsewhere\n// A throw of the Log port at step 1 is InfraError('log'): nothing\n// commits. Without a Log port the rotation is refused (log-missing); at the last\n// generation 2^53 − 2 it is refused (scope-exhausted, Identity §5.4)\n//\n// Pure register helpers for the modules that open contexts (the encounter\n// in PR 7, continuity.newTuple until then): withLabel, withPairNonce.\n//\n// Choices this file makes where note and spec leave them open:\n// - a device name is stored in its 6.2 canonical form (NFC applied), so\n// the register compares what the derivation uses\n// - a name the register already holds is refused (device-name-held: the\n// SHOULD of §5.5 is followed); a revoked name is refused as\n// device-name-revoked (the MUST)\n// - revoking a name already revoked is ok and changes nothing; revoking\n// a name the register does not hold is unknown-device\n// - deviceKey (holder) derives only for a held, unrevoked name and an\n// own anchor context: a label of the register or a generation of the\n// community anchor up to its head (§5.5: names recorded before any\n// derived key is presented; a revoked name offers no key for a new\n// binding). Reading it changes nothing\nimport type { Applied, CommandDef, DutyHandler, HolderModule, PrepareCtx, Refusal } from './engine.js'\nimport type { Dec, Duty, HolderState, Millis, Register, ReissueMappingDuty, Rotation, RotationDuty } from './state.js'\nimport { canonicalLabel, communityLabel, deviceLabel, deviceName } from './identity.js'\nimport type { KeyProvider, LogHead } from './ports.js'\nimport { jcs } from './core.js'\nimport type { Json } from './core.js'\nimport { bindingOf, rawProofValue } from './anchor.js'\nimport { classOnToward, entryOf, entryRelationships, lags, liveRel } from './trust/state.js'\n\n/** The identity module's command names. */\nexport const IDENTITY_COMMANDS = Object.freeze({\n addDevice: 'identity.addDevice', revokeDevice: 'identity.revokeDevice', rotate: 'identity.rotate',\n} as const)\n\n/** The last generation a rotation moves to (Identity §5.4): 2^53 − 2. */\nexport const GENERATION_LAST = Number.MAX_SAFE_INTEGER - 1\n\nexport interface DeviceInput { name: string }\n\n/** The register with `label` among its labels (a set: added once). */\nexport const withLabel = (r: Readonly<Register>, label: string): Register =>\n r.labels.includes(label) ? r as Register : { ...r, labels: [...r.labels, label] }\n\n/** The register with a pair label and its relationship nonce (Identity\n * §6.1): the nonce is recorded alongside the label and never changes. */\nexport function withPairNonce (r: Readonly<Register>, label: string, nonce: string): Register {\n if (Object.hasOwn(r.pairNonces, label)) {\n if (r.pairNonces[label] !== nonce) throw new Error(`identity: ${label} already holds another relationship nonce (§6.1)`)\n return withLabel(r, label)\n }\n return { ...withLabel(r, label), pairNonces: { ...r.pairNonces, [label]: nonce } }\n}\n\nconst needName = (x: unknown, cmd: string): string => {\n if (x === null || typeof x !== 'object' || Array.isArray(x)) throw new TypeError(`${cmd} needs an input object`)\n const n = (x as { name?: unknown }).name\n if (typeof n !== 'string') throw new TypeError(`${cmd}: name must be a string`)\n return n\n}\n\nconst refuse = (code: Refusal['code'], ref?: string): Refusal => ({ ok: false, code, ...(ref ? { ref } : {}) })\n\nconst commands: Record<string, CommandDef> = {\n // §5.5: the name is persisted before any key derived from it is presented\n [IDENTITY_COMMANDS.addDevice]: {\n human: true,\n apply (state, _p, input: DeviceInput) {\n const n = deviceName(needName(input, IDENTITY_COMMANDS.addDevice))\n if (n === null) return refuse('device-name-invalid', 'Identity §6.2')\n const d = state.register.devices\n if (d.revoked.includes(n)) return refuse('device-name-revoked', 'Identity §5.5')\n if (d.names.includes(n)) return refuse('device-name-held', 'Identity §5.5')\n return {\n state: { ...state, register: { ...state.register, devices: { ...d, names: [...d.names, n] } } },\n events: [{ type: 'device.added', name: n }],\n }\n },\n } satisfies CommandDef<DeviceInput>,\n // §5.5: revocation consumes the name; the mark is never removed\n [IDENTITY_COMMANDS.revokeDevice]: {\n human: true,\n apply (state, _p, input: DeviceInput) {\n const n = deviceName(needName(input, IDENTITY_COMMANDS.revokeDevice))\n const d = state.register.devices\n if (n === null || !d.names.includes(n)) return refuse('unknown-device', 'Identity §5.5')\n if (d.revoked.includes(n)) return { state: state as HolderState }\n return {\n state: { ...state, register: { ...state.register, devices: { ...d, revoked: [...d.revoked, n] } } },\n events: [{ type: 'device.revoked', name: n }],\n }\n },\n } satisfies CommandDef<DeviceInput>,\n}\n\n\n// ── the rotation (Identity §5.4, Trust 6360–6420, 6596, Access §5.6) ──\n\n/** The rotation duty's id for a rotation. */\nexport const rotationDutyId = (rotationId: string): string => `rotation:${rotationId}`\n/** A re-issue duty's id after the rotation to generation `to` (6370). */\nexport const reissueId = (to: Dec, relId: string): string => `reissue:${to}:${relId}`\n\ntype RotationArtifact = { body: { type: 'anchor-rotation@2', prev: string, next: string, commit: string }, proof: { proofValue: string, successorProofValue: string } }\n\n/** What step 2 found at the log. */\ntype LogOutcome =\n | { status: 'done', head: LogHead }\n /** the log stands where this device may rotate, over a head other than\n * the persisted closure's: persist it before appending over it */\n | { status: 'moved', head: LogHead }\n | { status: 'behind' | 'diverged', head: LogHead }\n | { status: 'failure', reason: string }\n | { status: 'log-missing' }\n\ntype Rot = RotationArtifact['body']\n\n/**\n * Where the log stands for the rotation g → g+1 (Identity §5.4, RLTP-ACC-\n * 5980): `present`, its generation g+1 holds this rotation (at(g+1) names\n * this next and commit — appended by this device with its answer lost, or\n * by another device of the same seed, the log since moved on or not);\n * `{over}`, the device may append over that head (empty for g = 1, else\n * the entry that introduced g: gen g, next = prev, commit = the binding of\n * next); `behind`, the log has not reached g; `diverged`, another genesis,\n * another entry at g+1 (a fork), or a head the rotation does not continue.\n */\nasync function standing (ctx: PrepareCtx, head: LogHead, genesis: string, from: number, rot: Rot): Promise<'present' | 'behind' | 'diverged' | { over: string | null }> {\n if (head.genesis !== genesis) return 'diverged'\n if ('empty' in head) return from === 1 ? { over: null } : 'behind'\n if (head.gen >= from + 1) {\n const e = await ctx.log!.at(from + 1)\n return e && e.next === rot.next && e.commit === rot.commit ? 'present' : 'diverged'\n }\n if (head.gen === from && head.next === rot.prev && head.commit === await bindingOf(rot.next, ctx.crypto.subtle)) return { over: head.entryId }\n return head.gen < from ? 'behind' : 'diverged'\n}\n\nconst headId = (h: LogHead): string | null => ('empty' in h ? null : h.entryId)\n\n/**\n * Step 2 through the Log port (see the header): where the log stands, then\n * append(entry, the persisted overHead) — only ever over the head the\n * rotation record names, so the port's idempotence over exactly (entry,\n * overHead) holds across a lost answer; a head that moved is persisted\n * first ('moved'). head-conflict re-reads. A port that throws is a\n * failure: the rotation stays pending.\n */\nasync function logStep (ctx: PrepareCtx, r: Readonly<Rotation>, genesis: string): Promise<LogOutcome> {\n const log = ctx.log\n if (!log) return { status: 'log-missing' }\n const rot = (r.entry as { rotation: RotationArtifact }).rotation\n try {\n for (let i = 0; i < 4; i++) {\n const head = await log.head()\n const at = await standing(ctx, head, genesis, Number(r.from), rot.body)\n if (at === 'present') return { status: 'done', head }\n if (at === 'behind' || at === 'diverged') return { status: at, head }\n if (at.over !== headId(r.overHead) || head.genesis !== r.overHead.genesis) return { status: 'moved', head }\n const a = await log.append({ rotation: rot } as unknown as Json, at.over)\n if (a.status === 'appended' || a.status === 'exists') return { status: 'done', head: a.head }\n if (a.status === 'failure') return { status: 'failure', reason: a.reason }\n // head-conflict: re-read\n }\n return { status: 'failure', reason: 'head-conflict persisted' }\n } catch (e) {\n return { status: 'failure', reason: (e as Error)?.message ?? String(e) }\n }\n}\n\n/** 6596, per relationship: the anchor mapping class on for it (live, under\n * its entry), and whether it lags there — then H, else null. */\nfunction withholding (state: Readonly<HolderState>, relId: string): { contactId: string, awaitHead: string | null } | null {\n const r = state.relationships[relId]\n if (!r || !liveRel(r)) return null\n const e = entryOf(state, r)\n if (!e || !e.relIds.includes(r.id) || !classOnToward(e, 'anchorMapping')) return null\n return { contactId: e.id, awaitHead: lags(r, entryRelationships(state, e)) && e.anchorHead !== null ? e.anchorHead : null }\n}\n\n/** Step 1's commit (see the header). */\nfunction startRotation (state: Readonly<HolderState>, p: { id: string, from: Dec, to: Dec, entry: Json, overHead: LogHead, label: string }, when: Millis): Applied | Refusal {\n const com = state.register.community\n if (com === null || com.head !== p.from || Object.keys(state.rotations).length) return refuse('in-flight')\n const awaitHead: Record<string, string | null> = {}\n for (const id of Object.keys(state.relationships).sort()) {\n const w = withholding(state, id)\n if (w) awaitHead[id] = w.awaitHead\n }\n const rotation: Rotation = { id: p.id, from: p.from, to: p.to, step: 'log', startedAt: when, entry: p.entry, overHead: p.overHead, awaitHead }\n const duty: RotationDuty = { kind: 'rotation', v: 1, id: rotationDutyId(p.id), rotationId: p.id }\n return {\n state: { ...state, register: withLabel(state.register, p.label), rotations: { ...state.rotations, [p.id]: rotation } },\n duties: [duty],\n }\n}\n\n/** The completion's commit: head, lineage, the re-issues of 6370 (6596). */\nfunction completeRotation (state: Readonly<HolderState>, r: Readonly<Rotation>): Applied | Refusal {\n const com = state.register.community\n if (com === null || com.head !== r.from) return refuse('in-flight')\n const rot = (r.entry as { rotation: RotationArtifact }).rotation\n const duties: ReissueMappingDuty[] = []\n const reissue = (relId: string, contactId: string, awaitHead: string | null): void => {\n duties.push({ kind: 'reissue-mapping', v: 1, id: reissueId(r.to, relId), contactId, relId, awaitHead })\n }\n // decided at step 1 (6596), where the class is still on for it now\n for (const [relId, awaitHead] of Object.entries(r.awaitHead).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {\n const w = withholding(state, relId)\n if (w) reissue(relId, w.contactId, awaitHead)\n }\n // on for it now, unknown to step 1: decided now\n for (const relId of Object.keys(state.relationships).sort()) {\n if (Object.hasOwn(r.awaitHead, relId)) continue\n const w = withholding(state, relId)\n if (w) reissue(relId, w.contactId, w.awaitHead)\n }\n const rotations = { ...state.rotations }\n delete rotations[r.id]\n const left = { ...state.duties }\n delete left[rotationDutyId(r.id)]\n return {\n state: {\n ...state,\n register: { ...withLabel(state.register, communityLabel(com.genesis, Number(r.to))), community: { ...com, head: r.to }, lineage: [...state.register.lineage, rot as unknown as Json as Register['lineage'][number]] },\n rotations,\n duties: left,\n },\n events: [{ type: 'anchor.rotated', generation: r.to }],\n duties,\n }\n}\n\n/** What step 2's outcome means for the rotation: completion, or why not. */\nfunction afterLog (state: Readonly<HolderState>, rotationId: string, o: LogOutcome, when: Millis): Applied | Refusal {\n const r = Object.hasOwn(state.rotations, rotationId) ? state.rotations[rotationId] : undefined\n if (!r) return refuse('in-flight')\n switch (o.status) {\n case 'done': return completeRotation(state, r)\n case 'moved': {\n // the closure's head, persisted before any append over it; the duty\n // runs again at once (lastAt marks the change, no dueAt)\n const id = rotationDutyId(r.id)\n const held = Object.hasOwn(state.duties, id) ? state.duties[id] as RotationDuty : { kind: 'rotation' as const, v: 1 as const, id, rotationId: r.id }\n const { dueAt: _, ...rest } = held\n const duty: RotationDuty = { ...rest, lastAt: when }\n // single path: the duty leaves the state and comes back as Applied.duties,\n // on the act path and in resume alike\n const left = { ...state.duties }\n delete left[id]\n return {\n state: { ...state, rotations: { ...state.rotations, [r.id]: { ...r, overHead: o.head } }, duties: left },\n duties: [duty],\n }\n }\n case 'behind': return refuse('log-behind', 'RLTP-ACC-5980')\n case 'diverged': return refuse('log-diverged', 'RLTP-ACC-5980')\n case 'log-missing': return refuse('log-missing')\n case 'failure': return refuse('log-failure')\n }\n}\n\ntype RotatePrepared =\n | { kind: 'refuse', code: Refusal['code'], ref?: string }\n | { kind: 'start', id: string, from: Dec, to: Dec, entry: Json, overHead: LogHead, label: string }\n | { kind: 'resume', rotationId: string, outcome: LogOutcome }\n\nconst rotateCommand: CommandDef<Record<string, never>, RotatePrepared> = {\n human: true,\n async prepare (ctx) {\n const st = ctx.snapshot\n const com = st.register.community\n if (com === null) return { kind: 'refuse', code: 'no-community' }\n if (!ctx.log) return { kind: 'refuse', code: 'log-missing' }\n const running = Object.values(st.rotations)[0]\n if (running) return { kind: 'resume', rotationId: running.id, outcome: await logStep(ctx, running, com.genesis) }\n const g = Number(com.head)\n if (!Number.isSafeInteger(g) || g < 1 || g + 1 > GENERATION_LAST) return { kind: 'refuse', code: 'scope-exhausted', ref: 'Identity §5.4' }\n const [prevL, nextL, afterL] = [g, g + 1, g + 2].map((k) => communityLabel(com.genesis, k))\n const [prev, next, after] = await Promise.all([prevL, nextL, afterL].map((l) => ctx.keys.anchorOf(l)))\n const body = { type: 'anchor-rotation@2' as const, prev: prev.anchor, next: next.anchor, commit: await bindingOf(after.anchor, ctx.crypto.subtle) }\n const bytes = new TextEncoder().encode(jcs(body))\n const rotation: RotationArtifact = {\n body,\n proof: { proofValue: rawProofValue(await ctx.keys.sign(prevL, bytes)), successorProofValue: rawProofValue(await ctx.keys.sign(nextL, bytes)) },\n }\n // §5.4: the device rotates only over the log it holds — checked before\n // anything commits, so label and 6596 decision persist only when it may\n const overHead = await ctx.log.head()\n const at = await standing(ctx, overHead, com.genesis, g, body)\n if (at === 'behind') return { kind: 'refuse', code: 'log-behind', ref: 'RLTP-ACC-5980' }\n if (at === 'diverged') return { kind: 'refuse', code: 'log-diverged', ref: 'RLTP-ACC-5980' }\n const to = String(g + 1)\n return { kind: 'start', id: to, from: com.head, to, entry: { rotation } as unknown as Json, overHead, label: nextL }\n },\n apply (state, prepared, _input, when) {\n const p = prepared.value\n if (p.kind === 'refuse') return refuse(p.code, p.ref)\n if (p.kind === 'start') return startRotation(state, p, when)\n return afterLog(state, p.rotationId, p.outcome, when)\n },\n}\n\n/** The rotation duty (rotation/1): step 2 on resume. */\nconst rotationDuty: DutyHandler<LogOutcome | null> = {\n v: 1,\n async prepare (ctx, duty) {\n const r = ctx.snapshot.rotations[(duty as RotationDuty).rotationId]\n const com = ctx.snapshot.register.community\n return r && com ? logStep(ctx, r, com.genesis) : null\n },\n apply (state, duty, ctx, when) {\n const d = duty as RotationDuty\n // a rotation completed (by the act) or gone: nothing left to do\n if (!Object.hasOwn(state.rotations, d.rotationId)) return { state: state as HolderState }\n const o = ctx.prepared.value\n if (o === null) return 'not-due'\n if (o.status === 'failure') {\n // pending, due again after the retry backoff (the duty's own attempt)\n const attempt = (d.attempt ?? 0) + 1\n const again: RotationDuty = { ...d, attempt, lastAt: when, dueAt: Math.min(when + Math.max(0, Math.ceil(ctx.backoff(attempt))), Number.MAX_SAFE_INTEGER) }\n return { state: state as HolderState, duties: [again] }\n }\n return afterLog(state, d.rotationId, o, when)\n },\n}\n\n/** A device key as deviceKey derives it: the device label, the device's\n * did:key and its key-agreement multikey (Identity §5.5). */\nexport type DeviceKeyResult =\n | { ok: true, label: string, device: string, keyAgreement: string }\n | { ok: false, code: 'unknown-device' | 'device-revoked' | 'unknown-context' }\n\n/** Whether `label` names an own anchor context: a label of the register,\n * or a generation of the community anchor up to its head (§5.4). */\nfunction ownContext (state: Readonly<HolderState>, label: string): boolean {\n if (label.startsWith('device/')) return false\n // the community's generations first, bounded by the head: the label of\n // a pending g+1 is recorded, but no key is presented under it before the\n // rotation completes (§5.4)\n const c = state.register.community\n if (c !== null) {\n const base = communityLabel(c.genesis, 1)\n if (label === base) return true\n if (label.startsWith(base + '/')) {\n const g = BigInt(label.slice(base.length + 1))\n return g >= 2n && g <= BigInt(c.head)\n }\n }\n return state.register.labels.includes(label)\n}\n\n/**\n * The device key of a held, unrevoked device name under an own anchor\n * context (Identity §5.5): derived through the KeyProvider, never stored\n * (keys are not state, 9.3).\n */\nexport async function deviceKeyOf (state: Readonly<HolderState>, keys: KeyProvider, name: string, contextLabel: string): Promise<DeviceKeyResult> {\n const n = deviceName(name)\n const d = state.register.devices\n if (n === null || !d.names.includes(n)) return { ok: false, code: 'unknown-device' }\n if (d.revoked.includes(n)) return { ok: false, code: 'device-revoked' }\n const a = canonicalLabel(contextLabel)\n if (a === null || !ownContext(state, a)) return { ok: false, code: 'unknown-context' }\n const label = await deviceLabel(n, a)\n const k = await keys.anchorOf(label)\n return { ok: true, label, device: k.anchor, keyAgreement: k.keyAgreement }\n}\n\n/** The identity module createHolder builds in (see the header). */\nexport function identityModule (): HolderModule {\n return Object.freeze({\n name: 'identity',\n commands: Object.freeze({ ...commands, [IDENTITY_COMMANDS.rotate]: rotateCommand }),\n duties: Object.freeze({ rotation: rotationDuty }),\n })\n}\n"]}
@@ -18,8 +18,30 @@ export interface Context {
18
18
  * anchor identity, so derivation always uses the canonical form.
19
19
  */
20
20
  export declare function canonicalLabel(label: string): string | null;
21
+ /** A device name per 6.2 (Identity §5.5), NFC-normalized, or null. */
22
+ export declare const deviceName: (raw: string) => string | null;
23
+ /**
24
+ * The device label of one device under one anchor context (Identity
25
+ * §5.5): device/<n>/<c>, c the 6.1 encoding of sha2-256 over the UTF-8
26
+ * bytes of the context's canonical label — a group/…, persona/… or pair/…
27
+ * label, never a device/… one. One device key per anchor context: the
28
+ * context is part of the label.
29
+ */
30
+ export declare function deviceLabel(name: string, contextLabel: string, subtle?: SubtleCrypto): Promise<string>;
21
31
  export declare function labeledContext(rootIkm: Uint8Array, label: string): Promise<Context>;
22
32
  export declare function pairContext(rootIkm: Uint8Array, nonce: Uint8Array): Promise<Context>;
23
- /** The community anchor: an ordinary group context over the community's genesis digest. */
24
- export declare const communityContext: (rootIkm: Uint8Array, genesisDigest: string) => Promise<Context>;
33
+ /**
34
+ * The label of the community anchor at a generation (Identity §5.4,
35
+ * §6.1): generation 1 is the ordinary group/<digest> context, a later
36
+ * one group/<digest>/<generation>. The label string is the whole
37
+ * derivation context — the generation enters nowhere else.
38
+ */
39
+ export declare function communityLabel(genesisDigest: string, generation?: number): string;
40
+ /**
41
+ * The community anchor: the group context over the personal community's
42
+ * genesis digest at the holder's current generation (Identity §2, §5.4).
43
+ * It is not a member of the personal community — that group is founded,
44
+ * like every group, under a fresh pair anchor (Access §3.4.1).
45
+ */
46
+ export declare const communityContext: (rootIkm: Uint8Array, genesisDigest: string, generation?: number) => Promise<Context>;
25
47
  //# sourceMappingURL=identity.d.ts.map