@real-life/trust-protocol 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +209 -78
  3. package/dist/ack.d.ts +84 -0
  4. package/dist/ack.d.ts.map +1 -0
  5. package/dist/ack.js +114 -0
  6. package/dist/ack.js.map +1 -0
  7. package/dist/adapters/vti-mediator.d.ts +169 -0
  8. package/dist/adapters/vti-mediator.d.ts.map +1 -0
  9. package/dist/adapters/vti-mediator.js +659 -0
  10. package/dist/adapters/vti-mediator.js.map +1 -0
  11. package/dist/anchor.d.ts +226 -0
  12. package/dist/anchor.d.ts.map +1 -0
  13. package/dist/anchor.js +347 -0
  14. package/dist/anchor.js.map +1 -0
  15. package/dist/{holder.d.ts → carrier-holder.d.ts} +1 -1
  16. package/dist/carrier-holder.d.ts.map +1 -0
  17. package/dist/{holder.js → carrier-holder.js} +5 -4
  18. package/dist/carrier-holder.js.map +1 -0
  19. package/dist/carrier-identity.js +4 -4
  20. package/dist/carrier-identity.js.map +1 -1
  21. package/dist/carrier.d.ts.map +1 -1
  22. package/dist/carrier.js +4 -3
  23. package/dist/carrier.js.map +1 -1
  24. package/dist/ceremony.d.ts +3 -2
  25. package/dist/ceremony.d.ts.map +1 -1
  26. package/dist/ceremony.js +16 -26
  27. package/dist/ceremony.js.map +1 -1
  28. package/dist/codec.d.ts +54 -0
  29. package/dist/codec.d.ts.map +1 -0
  30. package/dist/codec.js +494 -0
  31. package/dist/codec.js.map +1 -0
  32. package/dist/continuity.d.ts +67 -0
  33. package/dist/continuity.d.ts.map +1 -0
  34. package/dist/continuity.js +110 -0
  35. package/dist/continuity.js.map +1 -0
  36. package/dist/core.d.ts +4 -0
  37. package/dist/core.d.ts.map +1 -1
  38. package/dist/core.js.map +1 -1
  39. package/dist/crypto.d.ts +23 -7
  40. package/dist/crypto.d.ts.map +1 -1
  41. package/dist/crypto.js +54 -20
  42. package/dist/crypto.js.map +1 -1
  43. package/dist/delivery.d.ts +31 -3
  44. package/dist/delivery.d.ts.map +1 -1
  45. package/dist/delivery.js +75 -28
  46. package/dist/delivery.js.map +1 -1
  47. package/dist/encounter/ceremony.d.ts +37 -0
  48. package/dist/encounter/ceremony.d.ts.map +1 -0
  49. package/dist/encounter/ceremony.js +662 -0
  50. package/dist/encounter/ceremony.js.map +1 -0
  51. package/dist/encounter.d.ts +91 -1
  52. package/dist/encounter.d.ts.map +1 -1
  53. package/dist/encounter.js +191 -12
  54. package/dist/encounter.js.map +1 -1
  55. package/dist/engine.d.ts +303 -0
  56. package/dist/engine.d.ts.map +1 -0
  57. package/dist/engine.js +1509 -0
  58. package/dist/engine.js.map +1 -0
  59. package/dist/entropy.d.ts +28 -0
  60. package/dist/entropy.d.ts.map +1 -0
  61. package/dist/entropy.js +96 -0
  62. package/dist/entropy.js.map +1 -0
  63. package/dist/events.d.ts +198 -0
  64. package/dist/events.d.ts.map +1 -0
  65. package/dist/events.js +2 -0
  66. package/dist/events.js.map +1 -0
  67. package/dist/fixtures.d.ts +30 -0
  68. package/dist/fixtures.d.ts.map +1 -0
  69. package/dist/fixtures.js +155 -0
  70. package/dist/fixtures.js.map +1 -0
  71. package/dist/forge.d.ts +47 -0
  72. package/dist/forge.d.ts.map +1 -0
  73. package/dist/forge.js +20 -0
  74. package/dist/forge.js.map +1 -0
  75. package/dist/group-star.d.ts +251 -0
  76. package/dist/group-star.d.ts.map +1 -0
  77. package/dist/group-star.js +348 -0
  78. package/dist/group-star.js.map +1 -0
  79. package/dist/holder-api.d.ts +165 -0
  80. package/dist/holder-api.d.ts.map +1 -0
  81. package/dist/holder-api.js +142 -0
  82. package/dist/holder-api.js.map +1 -0
  83. package/dist/holder-state-v1.d.ts +801 -0
  84. package/dist/holder-state-v1.d.ts.map +1 -0
  85. package/dist/holder-state-v1.js +2 -0
  86. package/dist/holder-state-v1.js.map +1 -0
  87. package/dist/holder-state-v2.d.ts +858 -0
  88. package/dist/holder-state-v2.d.ts.map +1 -0
  89. package/dist/holder-state-v2.js +2 -0
  90. package/dist/holder-state-v2.js.map +1 -0
  91. package/dist/identity-state.d.ts +43 -0
  92. package/dist/identity-state.d.ts.map +1 -0
  93. package/dist/identity-state.js +345 -0
  94. package/dist/identity-state.js.map +1 -0
  95. package/dist/identity.d.ts +24 -2
  96. package/dist/identity.d.ts.map +1 -1
  97. package/dist/identity.js +70 -11
  98. package/dist/identity.js.map +1 -1
  99. package/dist/index.d.ts +27 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +81 -29
  102. package/dist/index.js.map +1 -1
  103. package/dist/internal.d.ts +37 -0
  104. package/dist/internal.d.ts.map +1 -0
  105. package/dist/internal.js +22 -0
  106. package/dist/internal.js.map +1 -0
  107. package/dist/introduction/holder.d.ts +18 -0
  108. package/dist/introduction/holder.d.ts.map +1 -0
  109. package/dist/introduction/holder.js +764 -0
  110. package/dist/introduction/holder.js.map +1 -0
  111. package/dist/introduction.d.ts +101 -0
  112. package/dist/introduction.d.ts.map +1 -0
  113. package/dist/introduction.js +132 -0
  114. package/dist/introduction.js.map +1 -0
  115. package/dist/invariants.d.ts +43 -0
  116. package/dist/invariants.d.ts.map +1 -0
  117. package/dist/invariants.js +953 -0
  118. package/dist/invariants.js.map +1 -0
  119. package/dist/keys-seed.d.ts +7 -0
  120. package/dist/keys-seed.d.ts.map +1 -0
  121. package/dist/keys-seed.js +133 -0
  122. package/dist/keys-seed.js.map +1 -0
  123. package/dist/log-memory.d.ts +12 -0
  124. package/dist/log-memory.d.ts.map +1 -0
  125. package/dist/log-memory.js +101 -0
  126. package/dist/log-memory.js.map +1 -0
  127. package/dist/membership/holder.d.ts +33 -0
  128. package/dist/membership/holder.d.ts.map +1 -0
  129. package/dist/membership/holder.js +929 -0
  130. package/dist/membership/holder.js.map +1 -0
  131. package/dist/membership.d.ts +123 -0
  132. package/dist/membership.d.ts.map +1 -0
  133. package/dist/membership.js +180 -0
  134. package/dist/membership.js.map +1 -0
  135. package/dist/message/holder.d.ts +49 -0
  136. package/dist/message/holder.d.ts.map +1 -0
  137. package/dist/message/holder.js +290 -0
  138. package/dist/message/holder.js.map +1 -0
  139. package/dist/message.d.ts +43 -0
  140. package/dist/message.d.ts.map +1 -0
  141. package/dist/message.js +51 -0
  142. package/dist/message.js.map +1 -0
  143. package/dist/ports.d.ts +237 -0
  144. package/dist/ports.d.ts.map +1 -0
  145. package/dist/ports.js +2 -0
  146. package/dist/ports.js.map +1 -0
  147. package/dist/profile.d.ts +56 -0
  148. package/dist/profile.d.ts.map +1 -0
  149. package/dist/profile.js +193 -0
  150. package/dist/profile.js.map +1 -0
  151. package/dist/prompts.d.ts +14 -0
  152. package/dist/prompts.d.ts.map +1 -0
  153. package/dist/prompts.js +69 -0
  154. package/dist/prompts.js.map +1 -0
  155. package/dist/receive.d.ts +134 -0
  156. package/dist/receive.d.ts.map +1 -0
  157. package/dist/receive.js +317 -0
  158. package/dist/receive.js.map +1 -0
  159. package/dist/results.d.ts +173 -0
  160. package/dist/results.d.ts.map +1 -0
  161. package/dist/results.js +21 -0
  162. package/dist/results.js.map +1 -0
  163. package/dist/schemas.d.ts.map +1 -1
  164. package/dist/schemas.js +45 -38
  165. package/dist/schemas.js.map +1 -1
  166. package/dist/sha256.d.ts +3 -0
  167. package/dist/sha256.d.ts.map +1 -0
  168. package/dist/sha256.js +69 -0
  169. package/dist/sha256.js.map +1 -0
  170. package/dist/star.d.ts +31 -0
  171. package/dist/star.d.ts.map +1 -0
  172. package/dist/star.js +56 -0
  173. package/dist/star.js.map +1 -0
  174. package/dist/state-builder.d.ts +42 -0
  175. package/dist/state-builder.d.ts.map +1 -0
  176. package/dist/state-builder.js +100 -0
  177. package/dist/state-builder.js.map +1 -0
  178. package/dist/state.d.ts +914 -0
  179. package/dist/state.d.ts.map +1 -0
  180. package/dist/state.js +37 -0
  181. package/dist/state.js.map +1 -0
  182. package/dist/store-contract.d.ts +11 -0
  183. package/dist/store-contract.d.ts.map +1 -0
  184. package/dist/store-contract.js +189 -0
  185. package/dist/store-contract.js.map +1 -0
  186. package/dist/store-memory.d.ts +8 -0
  187. package/dist/store-memory.d.ts.map +1 -0
  188. package/dist/store-memory.js +17 -0
  189. package/dist/store-memory.js.map +1 -0
  190. package/dist/testing.d.ts +22 -0
  191. package/dist/testing.d.ts.map +1 -0
  192. package/dist/testing.js +21 -0
  193. package/dist/testing.js.map +1 -0
  194. package/dist/trust/continuity.d.ts +71 -0
  195. package/dist/trust/continuity.d.ts.map +1 -0
  196. package/dist/trust/continuity.js +1222 -0
  197. package/dist/trust/continuity.js.map +1 -0
  198. package/dist/trust/duties.d.ts +67 -0
  199. package/dist/trust/duties.d.ts.map +1 -0
  200. package/dist/trust/duties.js +179 -0
  201. package/dist/trust/duties.js.map +1 -0
  202. package/dist/trust/entries.d.ts +139 -0
  203. package/dist/trust/entries.d.ts.map +1 -0
  204. package/dist/trust/entries.js +795 -0
  205. package/dist/trust/entries.js.map +1 -0
  206. package/dist/trust/group-star.d.ts +43 -0
  207. package/dist/trust/group-star.d.ts.map +1 -0
  208. package/dist/trust/group-star.js +188 -0
  209. package/dist/trust/group-star.js.map +1 -0
  210. package/dist/trust/mapping.d.ts +56 -0
  211. package/dist/trust/mapping.d.ts.map +1 -0
  212. package/dist/trust/mapping.js +584 -0
  213. package/dist/trust/mapping.js.map +1 -0
  214. package/dist/trust/profile.d.ts +25 -0
  215. package/dist/trust/profile.d.ts.map +1 -0
  216. package/dist/trust/profile.js +249 -0
  217. package/dist/trust/profile.js.map +1 -0
  218. package/dist/trust/star.d.ts +208 -0
  219. package/dist/trust/star.d.ts.map +1 -0
  220. package/dist/trust/star.js +588 -0
  221. package/dist/trust/star.js.map +1 -0
  222. package/dist/trust/state.d.ts +83 -0
  223. package/dist/trust/state.d.ts.map +1 -0
  224. package/dist/trust/state.js +154 -0
  225. package/dist/trust/state.js.map +1 -0
  226. package/dist/util-freeze.d.ts +3 -0
  227. package/dist/util-freeze.d.ts.map +1 -0
  228. package/dist/util-freeze.js +11 -0
  229. package/dist/util-freeze.js.map +1 -0
  230. package/dist/views.d.ts +179 -0
  231. package/dist/views.d.ts.map +1 -0
  232. package/dist/views.js +286 -0
  233. package/dist/views.js.map +1 -0
  234. package/dist/visibility.d.ts +5 -5
  235. package/dist/visibility.d.ts.map +1 -1
  236. package/dist/visibility.js +22 -28
  237. package/dist/visibility.js.map +1 -1
  238. package/dist/wire.d.ts +218 -83
  239. package/dist/wire.d.ts.map +1 -1
  240. package/dist/wire.js.map +1 -1
  241. package/package.json +60 -10
  242. package/schemas/holder-state-v1.schema.json +3880 -0
  243. package/schemas/holder-state-v2.schema.json +4123 -0
  244. package/dist/holder.d.ts.map +0 -1
  245. package/dist/holder.js.map +0 -1
  246. package/dist/probe/acks.d.ts +0 -27
  247. package/dist/probe/acks.d.ts.map +0 -1
  248. package/dist/probe/acks.js +0 -152
  249. package/dist/probe/acks.js.map +0 -1
  250. package/dist/probe/continuity.d.ts +0 -20
  251. package/dist/probe/continuity.d.ts.map +0 -1
  252. package/dist/probe/continuity.js +0 -805
  253. package/dist/probe/continuity.js.map +0 -1
  254. package/dist/probe/deps.d.ts +0 -61
  255. package/dist/probe/deps.d.ts.map +0 -1
  256. package/dist/probe/deps.js +0 -54
  257. package/dist/probe/deps.js.map +0 -1
  258. package/dist/probe/encounter.d.ts +0 -26
  259. package/dist/probe/encounter.d.ts.map +0 -1
  260. package/dist/probe/encounter.js +0 -938
  261. package/dist/probe/encounter.js.map +0 -1
  262. package/dist/probe/introduce.d.ts +0 -62
  263. package/dist/probe/introduce.d.ts.map +0 -1
  264. package/dist/probe/introduce.js +0 -306
  265. package/dist/probe/introduce.js.map +0 -1
  266. package/dist/probe/membership.d.ts +0 -96
  267. package/dist/probe/membership.d.ts.map +0 -1
  268. package/dist/probe/membership.js +0 -467
  269. package/dist/probe/membership.js.map +0 -1
  270. package/dist/probe/trust.d.ts +0 -156
  271. package/dist/probe/trust.d.ts.map +0 -1
  272. package/dist/probe/trust.js +0 -1233
  273. package/dist/probe/trust.js.map +0 -1
  274. package/dist/probe.d.ts +0 -7
  275. package/dist/probe.d.ts.map +0 -1
  276. package/dist/probe.js +0 -42
  277. package/dist/probe.js.map +0 -1
@@ -0,0 +1,914 @@
1
+ import type { Json, JsonObject } from './core.js';
2
+ import type { Envelope } from './delivery.js';
3
+ import type { HolderEvent } from './events.js';
4
+ import type { DeliveryFailure, LogHead, PreTransportReason, ReceiverRefusalCode, Recipient } from './ports.js';
5
+ /** Canonical decimal integer: "0" or no leading zero, at most 18 digits (2.1). */
6
+ export type Dec = string;
7
+ /** Unpadded base64url bytes. */
8
+ export type B64u = string;
9
+ /** Milliseconds since the epoch, a non-negative safe integer. */
10
+ export type Millis = number;
11
+ declare const OPAQUE: unique symbol;
12
+ /**
13
+ * The holder's state at the consumer boundary (note §4.5): opaque. Store
14
+ * adapters persist it as JSON and hand it back; apps never read inside it
15
+ * and use the views (holder methods) instead. At runtime it is the
16
+ * structural HolderState below, which only ./internal exposes.
17
+ */
18
+ export interface OpaqueHolderState {
19
+ readonly [OPAQUE]: 'HolderState';
20
+ }
21
+ /** The structural state as the opaque one, for the store and the facade. */
22
+ export declare const toOpaque: (s: Readonly<HolderState>) => OpaqueHolderState;
23
+ export interface HolderState {
24
+ /** state format version (codec.ts) */
25
+ codec: number;
26
+ /** engine-owned commit sequence, +1 on every commit; journal and events
27
+ * carry it. The store's version token is for CAS only (ports.ts). */
28
+ commitSeq: Dec;
29
+ /** highest `when` seen; a lower `when` is raised to it (note §4.7) */
30
+ lastWhen: Millis;
31
+ register: Register;
32
+ addresses: Addresses;
33
+ /** keyed by entry id (= Contact.id) */
34
+ contacts: Record<string, Contact>;
35
+ /** keyed by relationship id */
36
+ relationships: Record<string, Relationship>;
37
+ entryOrder: EntryOrder;
38
+ /** keyed by group genesis digest */
39
+ groups: Record<string, Group>;
40
+ profile: OwnProfile;
41
+ /** completed-effect cache, keyed by document digest (Delivery §6.2 stage 4/9) */
42
+ effects: Record<string, Effect>;
43
+ /** issued documents, keyed by document digest */
44
+ outbox: Record<string, OutboxItem>;
45
+ /** open duties, keyed by duty id */
46
+ duties: Record<string, Duty>;
47
+ /** running rotations, keyed by rotation id */
48
+ rotations: Record<string, Rotation>;
49
+ /** open decisions of the human, keyed by prompt id */
50
+ prompts: Record<string, Prompt>;
51
+ /** act journal, keyed by actId (note §4.2) */
52
+ acts: Record<string, ActRecord>;
53
+ encounter: EncounterState;
54
+ /** groups on the way in: the preludes answered and the invitations
55
+ * received, before a welcome makes them groups (Membership 3.5, 3.1) */
56
+ joining: Joining;
57
+ /** Message Tasks 0.1 on the holder: the block of relationships and the
58
+ * rates per relationship (message/holder.ts) */
59
+ messages: MessagesState;
60
+ }
61
+ /** What Message Tasks 0.1 keeps on the holder (message/holder.ts). The
62
+ * time mark of RLTP-MSG-4060 is `lastWhen`: it never falls, every commit
63
+ * writes it, and the CAS commits only on the state it was read with. */
64
+ export interface MessagesState {
65
+ /** the relationships under a block (Message Tasks 6.1): chain-level
66
+ * state of a relationship (Trust 2280), by relationship id, sorted */
67
+ blocked: string[];
68
+ /** per relationship id: the times at which documents counted against a
69
+ * rate were accepted, inside the last 24 hours (Message Tasks 4.2):
70
+ * new message/0.1 document digests (4110) and invitations with a
71
+ * credential digest new to the holder (4115, Membership RLTP-MT-3105) */
72
+ rates: Record<string, Rates>;
73
+ /** the own pair labels of the tuples that are ready (5.1, 5020): a
74
+ * document whose issuer is the counterpart was accepted on them; sorted */
75
+ ready: string[];
76
+ /** the completion record (4.4), per tuple (own pair label) and inbound
77
+ * direction: mid → the body's digest and its sentAt */
78
+ records: Record<string, Record<string, MessageRecord>>;
79
+ /** the inbox (4.5): messages accepted and not yet taken over by the
80
+ * application, by the accepted document's digest */
81
+ inbox: Record<string, InboxEntry>;
82
+ }
83
+ /** The acceptance times a rate counts, oldest first. */
84
+ export interface Rates {
85
+ invites: Millis[];
86
+ messages: Millis[];
87
+ }
88
+ /** One completion-record entry (RLTP-MSG-4310). */
89
+ export interface MessageRecord {
90
+ bodyDigest: string;
91
+ sentAt: Millis;
92
+ }
93
+ /** One inbox entry (RLTP-MSG-4410): the body unchanged, the t_ref of its
94
+ * acceptance and the display time min(sentAt, receivedAt), fixed then. */
95
+ export interface InboxEntry {
96
+ /** the accepted document's digest */
97
+ id: string;
98
+ /** the own pair label of the arrival tuple */
99
+ tuple: string;
100
+ mid: string;
101
+ /** the message@1 body as it arrived */
102
+ body: JsonObject;
103
+ receivedAt: Millis;
104
+ displayAt: Millis;
105
+ }
106
+ /** The label register (Identity §2, §6.3): every set grows only. */
107
+ export interface Register {
108
+ /** canonical labels ever used (Identity §6.1) */
109
+ labels: string[];
110
+ /** pair label → its 32-byte relationship nonce (Identity §6.1) */
111
+ pairNonces: Record<string, B64u>;
112
+ /** relationship id → carrier-nonce entries; canonical is the highest
113
+ * generation, then the smallest nonce (Identity §7a.3) */
114
+ carriers: Record<string, CarrierNonce[]>;
115
+ /** device names and revocation marks, both monotone (Identity §5.5) */
116
+ devices: {
117
+ names: string[];
118
+ revoked: string[];
119
+ };
120
+ /** the personal community: genesis digest and head generation (Identity §5.4) */
121
+ community: {
122
+ genesis: string;
123
+ head: Dec;
124
+ } | null;
125
+ /** every signed anchor-rotation@2 the holder produced, chain order;
126
+ * the source of the lineage segments of 6420 */
127
+ lineage: AnchorRotation[];
128
+ }
129
+ /** A signed anchor-rotation@2 artifact (Trust §6.5). */
130
+ export type AnchorRotation = JsonObject;
131
+ export interface CarrierNonce {
132
+ nonce: B64u;
133
+ generation: Dec;
134
+ }
135
+ /** Key-agreement addresses and their lifecycle (Delivery §5). */
136
+ export interface Addresses {
137
+ /** rkid → the label it derives under and when it was last shown */
138
+ keys: Record<string, AddressKey>;
139
+ /** retired rkids, kept forever; never shrinks */
140
+ tombstones: string[];
141
+ }
142
+ export interface AddressKey {
143
+ label: string;
144
+ lastShown: Millis;
145
+ retiredAt?: Millis;
146
+ }
147
+ /** The five trust classes (2720). */
148
+ export type TrustClass = 'star' | 'groupStar' | 'anchorMapping' | 'sealedGroupStar' | 'profile';
149
+ /** One setting per class and contact (2810). */
150
+ export type Setting = 'default' | 'on' | 'off';
151
+ /** A contact, i.e. one entry of the deliverable set (2120, 2140). */
152
+ export interface Contact {
153
+ /** entry id: the surviving relationship identity (2100, 2140) */
154
+ id: string;
155
+ /** entry-commit position (2120); null while no entry is committed (2060) */
156
+ pos: Dec | null;
157
+ /** 'none' before the first verified mapping, 'pending' at a full set (2250) */
158
+ status: 'none' | 'admitted' | 'pending';
159
+ /** identities merged into this entry (2140) */
160
+ aliases: string[];
161
+ relIds: string[];
162
+ /** the entry's anchor head (5610) */
163
+ anchorHead: string | null;
164
+ /** per trust class (2810, merged by 2160) */
165
+ settings: Record<TrustClass, Setting>;
166
+ /** sealed group star per group genesis (2830) */
167
+ groupSettings: Record<string, Setting>;
168
+ }
169
+ /** Two orders, kept apart. */
170
+ export interface EntryOrder {
171
+ /** next entry-commit position (2120) */
172
+ nextPos: Dec;
173
+ /** relationship ids by creation of their active head, oldest first (2180) */
174
+ heads: string[];
175
+ }
176
+ /** A holder-local chain of tuples with one active head, plus chain state (2280). */
177
+ export interface Relationship {
178
+ id: string;
179
+ contactId: string;
180
+ /** chain order, oldest first */
181
+ tuples: Tuple[];
182
+ /** ownPairLabel of the active tuple */
183
+ activeHead: string;
184
+ /** earliest community anchor a mapping was issued under here (2285) */
185
+ earliestAnchor: string | null;
186
+ /** links held from verified lineages (6610) */
187
+ links: Array<{
188
+ prev: string;
189
+ next: string;
190
+ }>;
191
+ /** anchor → every pre-rotation binding held for it, sorted (6610: the
192
+ * union over the mappings verified on any tuple of the chain; two where
193
+ * a chaining joined tuples that disagree, a conflict the binding rule
194
+ * sees, 6605) */
195
+ bindings: Record<string, string[]>;
196
+ /** the counterpart's anchor head as last verified */
197
+ heldCounterpartHead: string | null;
198
+ /** contact memory and evidence (2280) */
199
+ memory: Record<string, Json>;
200
+ /** via: the introducer's contact; viaPin: the own pair label toward it
201
+ * the act was pinned to (8270), which a split follows (2080) */
202
+ provenance: {
203
+ kind: 'ceremony' | 'introduced';
204
+ via?: string;
205
+ viaPin?: string;
206
+ at: Millis;
207
+ };
208
+ /** set when this chain was appended into another (6a.4): the fresh
209
+ * relationship whose tuple a chaining appended to `chainedInto` stays as
210
+ * a husk without tuples, its id resolving to the chain and its contactId
211
+ * a chain alias of it (2090) */
212
+ chainedInto: string | null;
213
+ /** commitSeq of the first verification commit on this relationship
214
+ * (2190): its place in entry-commit order among the relationships of
215
+ * one entry (2100); null before any */
216
+ firstVerified: Dec | null;
217
+ }
218
+ /** One pair context toward one counterpart: per-tuple state (2280). */
219
+ export interface Tuple {
220
+ /** own `pair/…` label; identifies the tuple */
221
+ ownPairLabel: string;
222
+ counterpartAnchor: string;
223
+ /** the counterpart's key-agreement Multikey, sealed to */
224
+ counterpartKeyAgreement: string;
225
+ /** own key-agreement Multikey of this tuple (Delivery §5) */
226
+ rkid: string;
227
+ /** the entry this tuple's verifications go to (2145) */
228
+ entryId: string;
229
+ /** the active-head tuples of the holder's relationships when this
230
+ * tuple was created, frozen (2300) */
231
+ priorCandidates: TupleRef[];
232
+ starOut: StarOut;
233
+ starIn: StarIn;
234
+ /** the group star's own scope and domain (5730) */
235
+ groupStarOut: GroupStarOut;
236
+ groupStarIn: GroupStarIn;
237
+ /** 6a.2: the own probe sequence of this tuple direction (6680), the
238
+ * probes in flight and whether one completed (its delivery acked) */
239
+ probeOut: ProbeOut;
240
+ probeIn: {
241
+ hwm: Dec;
242
+ lowerBound: Dec;
243
+ assembly: Assembly | null;
244
+ };
245
+ /** 6a.4: own continuity-mapping issuance (6300) and the open work on it */
246
+ continuityOut: ContinuityOut;
247
+ /** 6a.4: verified continuity mapping; recordPrior frozen by 6290 */
248
+ continuityIn: {
249
+ rev: Dec;
250
+ body: Json | null;
251
+ recordPrior: string | null;
252
+ };
253
+ /** issued anchor mapping (6300) and the anchor it was issued under */
254
+ mappingOut: {
255
+ rev: Dec;
256
+ body: Json | null;
257
+ underAnchor: string | null;
258
+ };
259
+ /** verified anchor mapping, its self and card */
260
+ mappingIn: {
261
+ rev: Dec;
262
+ body: Json | null;
263
+ self: string | null;
264
+ card: Json | null;
265
+ };
266
+ /** the profile revision last issued in this tuple's scope (6300, 6450):
267
+ * the one counter's value it went out under, "0" before any */
268
+ profileOut: {
269
+ rev: Dec;
270
+ };
271
+ /** verified profile (6b.2) */
272
+ profileIn: {
273
+ rev: Dec;
274
+ body: Json | null;
275
+ verifiedSeq: Dec;
276
+ };
277
+ deactivated: boolean;
278
+ }
279
+ /** A frozen reference to one tuple: its own pair label and the counterpart
280
+ * anchor; in a prior-candidate set, `replaces` holds the counterpart
281
+ * anchors of the candidates it took the place of in this tuple's flow
282
+ * (spec follow-up 17), transitively, absent where none */
283
+ export interface TupleRef {
284
+ ownPairLabel: string;
285
+ counterpartAnchor: string;
286
+ replaces?: string[];
287
+ }
288
+ /** Continuity work the tuple still owes (today's contMappingDue): the
289
+ * record side's choice (with the remaining alternatives), the non-record
290
+ * side's match report, or the alignment re-issue. */
291
+ export type ContinuityDue = {
292
+ kind: 'choice';
293
+ prior: string;
294
+ alts: string[];
295
+ } | {
296
+ kind: 'report';
297
+ prior: string;
298
+ } | {
299
+ kind: 'align';
300
+ prior: string;
301
+ };
302
+ /** A probe's sender state (6680, 6830). */
303
+ export interface ProbeOut {
304
+ /** last assigned probe sequence, "0" before the first */
305
+ seq: Dec;
306
+ /** probe → its chunks' digests and those acked */
307
+ inflight: Record<string, {
308
+ digests: string[];
309
+ acked: string[];
310
+ }>;
311
+ /** a probe completed: the standing probe duty ends (6830) */
312
+ done: boolean;
313
+ }
314
+ export interface ContinuityOut {
315
+ /** last issued revision and body (6300/6310) */
316
+ rev: Dec;
317
+ body: Json | null;
318
+ /** the MACs of the last issued body: a resend (6840) re-seals the same
319
+ * artifact without the prior tuple's key */
320
+ proof: Json | null;
321
+ /** digests of the documents that carried the last issued body: this
322
+ * issuance's alone, reset by the next (an ack of an earlier issuance
323
+ * completes nothing of a later one) */
324
+ sent: string[];
325
+ /** the last issuance is the non-record side's alignment: issued after
326
+ * the record side's mapping was verified (6930) */
327
+ align: boolean;
328
+ /** record side: the prior it chose, final once set (contChosen) */
329
+ chosen: string | null;
330
+ /** non-record side: the match it reported (contReported) */
331
+ reported: string | null;
332
+ /** an alignment re-issue was acknowledged (contAligned) */
333
+ aligned: boolean;
334
+ due: ContinuityDue | null;
335
+ }
336
+ /** Sender side of one reconciled sequence over view elements V (5.4):
337
+ * the salt scope, the baseline automaton and what is in flight. */
338
+ export interface SeqOut<V> {
339
+ /** last issued salt, "0" before the first (5690) */
340
+ lastSalt: Dec;
341
+ /** the scope issued its maximum and issues nothing further (2600/2610) */
342
+ exhausted: boolean;
343
+ /** high-water mark H, highest completed salt (5630) */
344
+ hwm: Dec;
345
+ /** snapshot S completed at H, or absent (5630) */
346
+ snapshot: V[] | null;
347
+ /** SHA-256 hex of JCS(snapshot), null exactly when snapshot is: the
348
+ * comparison key of the reconciliation (trust/star.ts viewDigest) */
349
+ snapshotDigest: string | null;
350
+ /** salt → the view sent under it, its digest, and its chunks' digests (5660) */
351
+ inflight: Record<string, {
352
+ view: V[];
353
+ viewDigest: string;
354
+ digests: string[];
355
+ acked: string[];
356
+ }>;
357
+ }
358
+ /** Receiver side of one chunked sequence (5.2a): A is what an accepted
359
+ * salt leaves behind. */
360
+ export interface SeqIn<A> {
361
+ hwm: Dec;
362
+ lowerBound: Dec;
363
+ assembly: Assembly | null;
364
+ accepted: A | null;
365
+ }
366
+ /** One star reconciliation pair (member, anchor head of its entry) (5610). */
367
+ export interface StarPair {
368
+ member: string;
369
+ head: string;
370
+ }
371
+ export type StarOut = SeqOut<StarPair>;
372
+ /** A completed star as the receiver keeps it (trust/star.ts): its salt,
373
+ * the whole assembled union of blinded values (sorted), and the entry ids
374
+ * of the holder's contacts one of whose held anchors it carries (6160),
375
+ * re-matched whenever the holder comes to hold new anchors. */
376
+ export type StarIn = SeqIn<{
377
+ salt: Dec;
378
+ blinded: string[];
379
+ matches: string[];
380
+ }>;
381
+ /** One group-star domain element (5730): member and memberOp present for
382
+ * sealed entries only, and a change of either diverges (5770). */
383
+ export type GroupStarItem = {
384
+ group: string;
385
+ mode: 'digest';
386
+ } | {
387
+ group: string;
388
+ mode: 'sealed';
389
+ member: string;
390
+ memberOp: string;
391
+ };
392
+ export type GroupStarOut = SeqOut<GroupStarItem>;
393
+ /** A completed group star as the receiver keeps it (trust/group-star.ts):
394
+ * its salt, the whole assembled union of entries {d, c}, and the holder's
395
+ * groups whose d it holds (5520), sorted; a group joined later is matched
396
+ * against the union (groupStarRematch). */
397
+ export type GroupStarIn = SeqIn<{
398
+ salt: Dec;
399
+ entries: Array<{
400
+ d: string;
401
+ c: string;
402
+ }>;
403
+ groups: string[];
404
+ }>;
405
+ /** A chunked document under assembly: chunk index → chunk. */
406
+ export interface Assembly {
407
+ salt: Dec;
408
+ chunks: Record<string, Json>;
409
+ }
410
+ export interface Group {
411
+ /** genesis digest: the group's identity (Access 3.2) */
412
+ id: string;
413
+ /** the group's name, as its genesis names it */
414
+ name: string;
415
+ /** the group DID, its address, never its identity (Membership 2.3) */
416
+ did?: string;
417
+ /** the signed genesis, as founded or as the welcome carried it */
418
+ genesis?: JsonObject;
419
+ /** own member context label in this group: the founding pair label for
420
+ * the founder (Access 3.4.1), group/<digest> for a member (5.1) */
421
+ memberLabel: string;
422
+ /** group rules are group state, never entropy (note §3) */
423
+ rules: {
424
+ vouchThreshold: Dec;
425
+ };
426
+ /** listed in the blinded group star (5.2b per-group switch) */
427
+ listed: boolean;
428
+ /** the own member anchor in G (the anchor of memberLabel) and the oid
429
+ * naming its canonical admission, or the genesis where the holder
430
+ * founded G (5400). Required on a listed group (codec.ts): membership
431
+ * sets them on join; only an unlisted group may lack them. */
432
+ memberAnchor?: string;
433
+ memberOp?: string;
434
+ /** the members this holder knows of, by member anchor: its local view
435
+ * (membership/*); the replicated log is the Access port's */
436
+ roster: Record<string, RosterEntry>;
437
+ /** invitations this holder issued and not yet saw answered, by thread
438
+ * (Membership 3.1: the invite opens its thread) */
439
+ invitations: Record<string, OpenInvitation>;
440
+ /** consent pairs held toward an admission, by the accept document's
441
+ * digest, with the vouches for it (Membership 3.4, Access 4.2) */
442
+ evidence: Record<string, Evidence>;
443
+ /** preludes this holder sent for the group and awaits the answer of, by
444
+ * thread: the contact and the own rkid of the tuple it went on */
445
+ preludes: Record<string, {
446
+ contactId: string;
447
+ rkid: string;
448
+ at: Millis;
449
+ }>;
450
+ /** the own accept's document digest, where the holder joined by one:
451
+ * the vouches for it bind it (Access 5.3) */
452
+ acceptDigest?: string;
453
+ }
454
+ /** A member as this holder knows it (Membership 2.6: the enclosed card). */
455
+ export interface RosterEntry {
456
+ /** member anchor */
457
+ anchor: string;
458
+ /** the oid naming its admission (the accept's digest in this library's
459
+ * welcome form), or the genesis digest for the founder */
460
+ op: string;
461
+ /** its card's key agreement: what a document to it is sealed to */
462
+ keyAgreement: string;
463
+ /** its card's display name, self-declared (Encounter 6120) */
464
+ name?: string;
465
+ addedAt: Millis;
466
+ /** the contact this holder knows the member as, where it does */
467
+ contactId?: string;
468
+ /** with contactId: the own rkid of the tuple that named the member as
469
+ * that contact (its invitation's prelude), which a split follows (2080) */
470
+ rkid?: string;
471
+ }
472
+ /** An invitation issued (Membership 3.1): the invite document as sent. */
473
+ export interface OpenInvitation {
474
+ /** the invitee's member anchor (credentialSubject.id) */
475
+ invitee: string;
476
+ /** the invitee's member key agreement, from the prelude */
477
+ keyAgreement: string;
478
+ contactId: string;
479
+ /** the own rkid of the tuple the prelude went on, which a split follows (2080) */
480
+ rkid: string;
481
+ threadId: string;
482
+ /** the invitation's identity: its credential digest (RLTP-MT-2180) */
483
+ credDigest: string;
484
+ invite: JsonObject;
485
+ validUntil: Millis;
486
+ }
487
+ /** A consent pair held toward an admission (Membership 3.4). */
488
+ export interface Evidence {
489
+ /** the invite and the accept documents, complete */
490
+ invite: JsonObject;
491
+ accept: JsonObject;
492
+ /** vouch@2 credentials for this accept, at most 16 (3805) */
493
+ vouches: JsonObject[];
494
+ at: Millis;
495
+ }
496
+ /** Groups on the way in (Membership 1.2, 3.1, 3.2). */
497
+ export interface Joining {
498
+ /** preludes answered, by `<genesis digest> <inviter member anchor>`:
499
+ * which contact asked as which inviter, so the invite that follows from
500
+ * that anchor is surfaced as that contact's */
501
+ /** by (group, inviter): the contact and the own rkid of the tuple the
502
+ * prelude arrived on, the binding a later prelude is held against */
503
+ preludes: Record<string, {
504
+ group: string;
505
+ inviter: string;
506
+ contactId: string;
507
+ rkid: string;
508
+ memberLabel: string;
509
+ at: Millis;
510
+ }>;
511
+ /** invitations received, by credential digest */
512
+ invites: Record<string, ReceivedInvite>;
513
+ /** the credential digest of every invitation surfaced, for as long as
514
+ * the holder exists (RLTP-MT-3130), sorted */
515
+ surfaced: string[];
516
+ /** the register of declined invitations: the credential digest of every
517
+ * invitation declined under a block, holder-wide and for as long as the
518
+ * holder exists (Message Tasks 6.4, RLTP-MT-3115), sorted */
519
+ declined: string[];
520
+ }
521
+ /** An invitation received (Membership 3.1), surfaced as a group-invite prompt. */
522
+ export interface ReceivedInvite {
523
+ credDigest: string;
524
+ /** genesis digest */
525
+ group: string;
526
+ name: string;
527
+ /** the contact of the relationship its prelude binding attributed it to
528
+ * (RLTP-MT-3100); absent for an invitation attributed to none */
529
+ contactId?: string;
530
+ /** the own rkid of the tuple its prelude arrived on, which a split
531
+ * follows (2080); absent with contactId */
532
+ rkid?: string;
533
+ memberLabel: string;
534
+ /** the invite document, complete */
535
+ invite: JsonObject;
536
+ promptId: string;
537
+ validUntil: Millis;
538
+ status: 'open' | 'accepted' | 'declined' | 'joined';
539
+ /** the accept's document digest, once sent */
540
+ acceptDigest?: string;
541
+ at: Millis;
542
+ }
543
+ /** The holder's own profile: one revision counter (6450). */
544
+ export interface OwnProfile {
545
+ body: Json | null;
546
+ revision: Dec;
547
+ }
548
+ /** A completed effect with its retained ack (null for a terminal
549
+ * document): the cache entry and the ack commit together at stage 9 and
550
+ * expire together at expiresAt = commit + key-retention (Delivery 4.2, §7). */
551
+ export interface Effect {
552
+ ack: StoredAck | null;
553
+ expiresAt: Millis;
554
+ }
555
+ /**
556
+ * The acknowledgement of a completed effect, sealed once inside the
557
+ * effect's transaction and re-sent byte-identical on every duplicate
558
+ * (Delivery 4.2, 6.2 stage 4). Acks are outbox-less: no trias. Until the
559
+ * app reports the ack's digest (any DeliveryReport status) it is unsent
560
+ * and resume re-offers it on the retry policy like an outbox item
561
+ * (attempt, nextAttemptAt, backoff), which covers a restart between the
562
+ * receive commit and the send. At the horizon (at + horizonMs) the holder
563
+ * stops offering it: `sent` with `sentBy: 'horizon'`; a redelivery of the
564
+ * document still earns it (duplicate-known).
565
+ */
566
+ export interface StoredAck {
567
+ /** the ack document's digest; report() on it marks the ack sent */
568
+ digest: string;
569
+ /** sealed to recipient.keyAgreement, as first emitted */
570
+ envelope: Envelope;
571
+ threadId: string;
572
+ recipient: Recipient;
573
+ /** commit time of the effect, the first emission; the horizon counts from it */
574
+ at: Millis;
575
+ /** emissions on the retry schedule so far (duplicates' re-sends excluded) */
576
+ attempt: number;
577
+ /** next re-offer while unsent */
578
+ nextAttemptAt?: Millis;
579
+ sent: boolean;
580
+ /** why it counts as sent: the app reported it, or the horizon passed */
581
+ sentBy?: 'report' | 'horizon';
582
+ }
583
+ export type OutboxStatus = 'submitted' | 'accepted' | 'delivered' | 'failed';
584
+ /** One step of an item's history. `awaiting-transport` is a pre-transport
585
+ * report, not a trias state (Delivery §6.1). The holder's own give-up
586
+ * (RetryPolicy) is recorded as failed(expired-by-adapter-policy). */
587
+ export type OutboxStep = {
588
+ status: 'submitted';
589
+ at: Millis;
590
+ attempt: number;
591
+ } | {
592
+ status: 'awaiting-transport';
593
+ at: Millis;
594
+ reason: PreTransportReason;
595
+ } | {
596
+ status: 'accepted';
597
+ at: Millis;
598
+ } | {
599
+ status: 'delivered';
600
+ at: Millis;
601
+ late: boolean;
602
+ } | {
603
+ status: 'failed';
604
+ at: Millis;
605
+ reason: Exclude<DeliveryFailure, 'rejected-by-receiver'> | 'task-expired';
606
+ } | {
607
+ status: 'failed';
608
+ at: Millis;
609
+ reason: 'rejected-by-receiver';
610
+ code: ReceiverRefusalCode;
611
+ };
612
+ export interface OutboxItem {
613
+ type: string;
614
+ threadId: string;
615
+ recipient: Recipient;
616
+ /** the envelope as last sent; retries resend it. Its rkid is
617
+ * recipient.keyAgreement, never the own recipient.rkid. */
618
+ envelope: Envelope;
619
+ attempt: number;
620
+ /** history, oldest first (Delivery §6.1) */
621
+ history: OutboxStep[];
622
+ nextAttemptAt?: Millis;
623
+ /** the sender lifetime its type declares (Delivery RLTP-DEL-7020):
624
+ * from then on failed(task-expired), never handed out again (6110, 6115) */
625
+ expiresAt?: Millis;
626
+ }
627
+ /** Re-issue of the anchor mapping after a rotation (6370): due now, or
628
+ * waiting until the relationship presents `awaitHead` (6596). */
629
+ export interface ReissueMappingDuty {
630
+ kind: 'reissue-mapping';
631
+ v: 1;
632
+ id: string;
633
+ dueAt?: Millis;
634
+ contactId: string;
635
+ relId: string;
636
+ awaitHead: string | null;
637
+ }
638
+ /** Send a class's current artifact on a relationship it turned on for (2850). */
639
+ export interface ClassOnDuty {
640
+ kind: 'class-on';
641
+ v: 1;
642
+ id: string;
643
+ dueAt?: Millis;
644
+ contactId: string;
645
+ relId: string;
646
+ cls: TrustClass;
647
+ }
648
+ /** Deliver profile revision `rev` on a relationship (6455). */
649
+ export interface ProfileDuty {
650
+ kind: 'profile';
651
+ v: 1;
652
+ id: string;
653
+ dueAt?: Millis;
654
+ contactId: string;
655
+ relId: string;
656
+ rev: Dec;
657
+ }
658
+ /** Continuity resend on a tuple (6830–6850). */
659
+ export interface ContinuityDuty {
660
+ kind: 'continuity';
661
+ v: 1;
662
+ id: string;
663
+ dueAt?: Millis;
664
+ relId: string;
665
+ tuple: string;
666
+ step: 'probe' | 'mapping';
667
+ /** sends so far under this standing duty (the issuance counts) */
668
+ attempt?: number;
669
+ /** when the last of them was sent: the next is due no earlier than
670
+ * lastAt + backoff(attempt), a failure included */
671
+ lastAt?: Millis;
672
+ }
673
+ /** The persisted continuation of a merge (2230): the verification has
674
+ * committed; these entries merge in one later atomic step. */
675
+ export interface MergeDuty {
676
+ kind: 'merge';
677
+ v: 1;
678
+ id: string;
679
+ dueAt?: Millis;
680
+ entryIds: string[];
681
+ relId: string;
682
+ /** what the merge was admitted against (6540, 6550, 6605): each entry's
683
+ * anchor head, and per entry the other entries' heads it then held as
684
+ * superseded. The duty runs only while this still holds */
685
+ witness: {
686
+ heads: Record<string, string>;
687
+ superseded: Record<string, string[]>;
688
+ };
689
+ }
690
+ /** The mediator's one ack of an act, at t_received + ack-delay (Trust 8640). */
691
+ export interface IntroAckDuty {
692
+ kind: 'intro-ack';
693
+ v: 1;
694
+ id: string;
695
+ dueAt?: Millis;
696
+ act: string;
697
+ }
698
+ /** Step 2 of a running rotation (identity-state.ts): its log append, on
699
+ * resume, until the log holds the entry; after a failure due again after
700
+ * the retry backoff (attempt, lastAt). */
701
+ export interface RotationDuty {
702
+ kind: 'rotation';
703
+ v: 1;
704
+ id: string;
705
+ dueAt?: Millis;
706
+ rotationId: string;
707
+ attempt?: number;
708
+ lastAt?: Millis;
709
+ }
710
+ export type KnownDuty = ReissueMappingDuty | ClassOnDuty | ProfileDuty | ContinuityDuty | MergeDuty | RotationDuty | IntroAckDuty;
711
+ /** A duty of a kind (or version) this library does not know: kept as is. */
712
+ export interface UnknownDuty {
713
+ kind: string;
714
+ v: number;
715
+ id: string;
716
+ [field: string]: Json;
717
+ }
718
+ /** Narrow with isKnownDuty (codec.ts) before switching on `kind`. */
719
+ export type Duty = KnownDuty | UnknownDuty;
720
+ /**
721
+ * A running rotation (identity-state.ts); steps in order: register, then
722
+ * log, then duties. Step 1 commits the register's label and the whole
723
+ * append closure with step 'log', so a restart repeats or recognizes
724
+ * exactly that append (Log.append idempotence); the completion commits the
725
+ * head, the lineage and the re-issue duties and removes the record.
726
+ * 'register' and 'duties' name no state a commit leaves behind today.
727
+ */
728
+ export interface Rotation {
729
+ /** the generation it moves to, as a decimal string */
730
+ id: string;
731
+ from: Dec;
732
+ to: Dec;
733
+ step: 'register' | 'log' | 'duties';
734
+ startedAt: Millis;
735
+ /** the anchor.rotate body, incl. the signed anchor-rotation@2 */
736
+ entry: Json;
737
+ /** the log head the entry is appended over */
738
+ overHead: LogHead;
739
+ /** relationship id → anchor head the re-issue waits for, null = due at
740
+ * once; decided at the label commit (6596) */
741
+ awaitHead: Record<string, string | null>;
742
+ }
743
+ export type PromptKind = 'encounter-confirm' | 'group-invite' | 'introduction';
744
+ /** The human's answer to a prompt (prompts.ts). */
745
+ export type PromptChoice = 'accept' | 'decline';
746
+ export interface Prompt {
747
+ id: string;
748
+ kind: PromptKind;
749
+ contactId?: string;
750
+ groupId?: string;
751
+ openedAt: Millis;
752
+ expiresAt?: Millis;
753
+ }
754
+ /** One journaled human act (note §4.2). */
755
+ export interface ActRecord {
756
+ actId: string;
757
+ /** digest(JCS(name, input)) */
758
+ inputHash: string;
759
+ /** commitSeq of the act's commit */
760
+ commitSeq: Dec;
761
+ outboundDigests: string[];
762
+ events: HolderEvent[];
763
+ /** commit time, for retention like effects */
764
+ at: Millis;
765
+ }
766
+ /** Open challenges, enactment records and introduction acts (note §2.1). */
767
+ export interface EncounterState {
768
+ /** own challenge values still held open (Encounter 5.3), by value */
769
+ challenges: Record<string, OwnChallenge>;
770
+ /** enactment records (5.5), by the own challenge value: the consumed-
771
+ * challenge history, kept for the life of the relation (5360) */
772
+ records: Record<string, EnactmentRecord>;
773
+ /** introduction acts (Trust §8), by `<role>:<act id>`: per role (8320) */
774
+ introductions: Record<string, IntroAct>;
775
+ /** introductions offered to this holder by a mediator, by prompt id */
776
+ offers: Record<string, IntroOffer>;
777
+ /** the mediator's target designators (8610): designator → contact id */
778
+ designators: Record<string, string>;
779
+ /** registry declarations held (Delivery §4.4), by `<issuer> <role>` */
780
+ declarations: Record<string, HeldDeclaration>;
781
+ }
782
+ /** The roles of an introduction act (Trust §8). */
783
+ export type IntroRole = 'requester' | 'mediator' | 'target';
784
+ /** One role's view of one introduction act (8.1): its own lifecycle,
785
+ * its pins and what 8200 retains, until the absolute lifetime (8310). */
786
+ export interface IntroAct {
787
+ /** `<role>:<act>` */
788
+ key: string;
789
+ act: string;
790
+ role: IntroRole;
791
+ /** requester: sent, acked, completed, failed; mediator: received,
792
+ * forwarded, completed; target: received, consented, refused (8330–8380) */
793
+ status: 'sent' | 'acked' | 'completed' | 'failed' | 'received' | 'forwarded' | 'consented' | 'refused';
794
+ /** the request's issuedAt: the act's lifetime datum (8090) */
795
+ issuedAt: Millis;
796
+ /** the request artifact and its card; the reply and its card (8200) */
797
+ request: JsonObject;
798
+ requestCard: JsonObject;
799
+ reply: JsonObject | null;
800
+ replyCard: JsonObject | null;
801
+ /** the pinned tuples, by own pair label (8270): the requester's and the
802
+ * target's toward the mediator, the mediator's toward each side */
803
+ pins: {
804
+ requester?: string;
805
+ target?: string;
806
+ mediator?: string;
807
+ };
808
+ /** the threads: the request's (requester ↔ mediator) and the forward's (mediator ↔ target) */
809
+ threads: {
810
+ request: string;
811
+ forward?: string;
812
+ };
813
+ /** requester: its send (t_sent); mediator: entering received; target: the forward's arrival */
814
+ at: Millis;
815
+ /** the ack-delay the role computes with (8.4, Delivery §4.4) */
816
+ ackDelayMs: number;
817
+ /** the own fresh pair label of the act (requester, target) */
818
+ ownLabel: string | null;
819
+ /** mediator: the one ack value produced (8640) */
820
+ ack: JsonObject | null;
821
+ /** mediator: the reply forwarded and the vouchers sent (8360) */
822
+ replyForwarded: boolean;
823
+ vouchersSent: boolean;
824
+ /** requester, target: a voucher held pending its reply (8770) */
825
+ pendingVoucher: JsonObject | null;
826
+ /** requester, target: the accepted voucher, retained until the absolute
827
+ * lifetime for the duplicate rule (8200, 8260) */
828
+ voucher: JsonObject | null;
829
+ vouched: boolean;
830
+ /** target: the prompt asking for consent */
831
+ promptId: string | null;
832
+ /** requester: the target's name as the offer carried it */
833
+ peerName?: string;
834
+ }
835
+ /** An introduction offered by a mediator (this library's offer form). */
836
+ export interface IntroOffer {
837
+ /** the prompt's id */
838
+ id: string;
839
+ mediatorContactId: string;
840
+ /** the own pair label toward the mediator, pinned at send (8270) */
841
+ pin: string;
842
+ /** the mediator's opaque designator of the target (8610) */
843
+ target: string;
844
+ /** a label the mediator's human typed in the introduce act */
845
+ label?: string;
846
+ at: Millis;
847
+ }
848
+ /** A registry declaration held for an (issuer, role) (Delivery §4.4). */
849
+ export interface HeldDeclaration {
850
+ issuer: string;
851
+ role: string;
852
+ revision: Dec;
853
+ constants: Record<string, string>;
854
+ at: Millis;
855
+ }
856
+ /** An own challenge value issued on a displayed card (5.3). */
857
+ export interface OwnChallenge {
858
+ value: string;
859
+ /** issuance time t_ch */
860
+ tCh: Millis;
861
+ /** the fresh pair label the card is shown under (4.4) */
862
+ label: string;
863
+ /** the displayed card: the optical payload */
864
+ card: JsonObject;
865
+ }
866
+ /** A step credential with its credential digest (5.6 step 8). */
867
+ export interface HeldCredential {
868
+ digest: string;
869
+ credential: JsonObject;
870
+ }
871
+ /** The enactment record (5.5), keyed by the own challenge value. Its
872
+ * tuple is the relationship `relId` under the own pair label `label`. */
873
+ export interface EnactmentRecord {
874
+ ceremony: string;
875
+ /** the own challenge value (the record key) and its issuance time */
876
+ own: string;
877
+ tCh: Millis;
878
+ /** the counterparty's challenge value */
879
+ peer: string;
880
+ /** the counterparty anchor and its card as received */
881
+ counterpart: string;
882
+ card: JsonObject;
883
+ /** the enactment binding (5.4) */
884
+ bind: string;
885
+ /** local time of the enactment */
886
+ at: Millis;
887
+ label: string;
888
+ relId: string;
889
+ /** who scanned (sent the bundle) and who displayed */
890
+ role: 'scanner' | 'displayer';
891
+ /** the own step credential issued, and the counterparty's accepted,
892
+ * per direction (5.6 step 8) */
893
+ out: HeldCredential | null;
894
+ in: HeldCredential | null;
895
+ /** the thread of the bundle that opened the exchange and that bundle's
896
+ * digest (Delivery 4.1); null on the displayer until a bundle landed */
897
+ thread: string | null;
898
+ bundleDigest: string | null;
899
+ /** later threads used under this record: a re-issued bundle's (its
900
+ * digest) or a standalone delivery's, threadId → document digest */
901
+ threads: Record<string, string>;
902
+ /** the scanner's sent card: the optical leg's payload (5.8) */
903
+ sentCard: JsonObject | null;
904
+ /** the displayer issued its counter credential on the optical leg
905
+ * before the bundle landed: its document waits for the thread (5780) */
906
+ counterPending: boolean;
907
+ }
908
+ /** An outbox item's trias position (Delivery §6.1): its last step that is
909
+ * not pre-transport, `submitted` before any. */
910
+ export declare function triasOf(item: Readonly<OutboxItem>): OutboxStatus;
911
+ /** A fresh holder's state. */
912
+ export declare function emptyState(codec: number): HolderState;
913
+ export {};
914
+ //# sourceMappingURL=state.d.ts.map