@real-life/trust-protocol 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +187 -78
  3. package/dist/ack.d.ts +84 -0
  4. package/dist/ack.d.ts.map +1 -0
  5. package/dist/ack.js +114 -0
  6. package/dist/ack.js.map +1 -0
  7. package/dist/adapters/vti-mediator.d.ts +154 -0
  8. package/dist/adapters/vti-mediator.d.ts.map +1 -0
  9. package/dist/adapters/vti-mediator.js +621 -0
  10. package/dist/adapters/vti-mediator.js.map +1 -0
  11. package/dist/anchor.d.ts +226 -0
  12. package/dist/anchor.d.ts.map +1 -0
  13. package/dist/anchor.js +347 -0
  14. package/dist/anchor.js.map +1 -0
  15. package/dist/{holder.d.ts → carrier-holder.d.ts} +1 -1
  16. package/dist/carrier-holder.d.ts.map +1 -0
  17. package/dist/{holder.js → carrier-holder.js} +5 -4
  18. package/dist/carrier-holder.js.map +1 -0
  19. package/dist/carrier-identity.js +4 -4
  20. package/dist/carrier-identity.js.map +1 -1
  21. package/dist/carrier.d.ts.map +1 -1
  22. package/dist/carrier.js +4 -3
  23. package/dist/carrier.js.map +1 -1
  24. package/dist/ceremony.d.ts +3 -2
  25. package/dist/ceremony.d.ts.map +1 -1
  26. package/dist/ceremony.js +16 -26
  27. package/dist/ceremony.js.map +1 -1
  28. package/dist/codec.d.ts +46 -0
  29. package/dist/codec.d.ts.map +1 -0
  30. package/dist/codec.js +410 -0
  31. package/dist/codec.js.map +1 -0
  32. package/dist/continuity.d.ts +67 -0
  33. package/dist/continuity.d.ts.map +1 -0
  34. package/dist/continuity.js +110 -0
  35. package/dist/continuity.js.map +1 -0
  36. package/dist/core.d.ts +4 -0
  37. package/dist/core.d.ts.map +1 -1
  38. package/dist/core.js.map +1 -1
  39. package/dist/crypto.d.ts +23 -7
  40. package/dist/crypto.d.ts.map +1 -1
  41. package/dist/crypto.js +54 -20
  42. package/dist/crypto.js.map +1 -1
  43. package/dist/delivery.d.ts +31 -3
  44. package/dist/delivery.d.ts.map +1 -1
  45. package/dist/delivery.js +75 -28
  46. package/dist/delivery.js.map +1 -1
  47. package/dist/encounter/ceremony.d.ts +37 -0
  48. package/dist/encounter/ceremony.d.ts.map +1 -0
  49. package/dist/encounter/ceremony.js +662 -0
  50. package/dist/encounter/ceremony.js.map +1 -0
  51. package/dist/encounter.d.ts +91 -1
  52. package/dist/encounter.d.ts.map +1 -1
  53. package/dist/encounter.js +191 -12
  54. package/dist/encounter.js.map +1 -1
  55. package/dist/engine.d.ts +291 -0
  56. package/dist/engine.d.ts.map +1 -0
  57. package/dist/engine.js +1395 -0
  58. package/dist/engine.js.map +1 -0
  59. package/dist/entropy.d.ts +28 -0
  60. package/dist/entropy.d.ts.map +1 -0
  61. package/dist/entropy.js +96 -0
  62. package/dist/entropy.js.map +1 -0
  63. package/dist/events.d.ts +177 -0
  64. package/dist/events.d.ts.map +1 -0
  65. package/dist/events.js +2 -0
  66. package/dist/events.js.map +1 -0
  67. package/dist/fixtures.d.ts +30 -0
  68. package/dist/fixtures.d.ts.map +1 -0
  69. package/dist/fixtures.js +155 -0
  70. package/dist/fixtures.js.map +1 -0
  71. package/dist/forge.d.ts +47 -0
  72. package/dist/forge.d.ts.map +1 -0
  73. package/dist/forge.js +20 -0
  74. package/dist/forge.js.map +1 -0
  75. package/dist/group-star.d.ts +251 -0
  76. package/dist/group-star.d.ts.map +1 -0
  77. package/dist/group-star.js +348 -0
  78. package/dist/group-star.js.map +1 -0
  79. package/dist/holder-api.d.ts +137 -0
  80. package/dist/holder-api.d.ts.map +1 -0
  81. package/dist/holder-api.js +132 -0
  82. package/dist/holder-api.js.map +1 -0
  83. package/dist/holder-state-v1.d.ts +801 -0
  84. package/dist/holder-state-v1.d.ts.map +1 -0
  85. package/dist/holder-state-v1.js +2 -0
  86. package/dist/holder-state-v1.js.map +1 -0
  87. package/dist/identity-state.d.ts +43 -0
  88. package/dist/identity-state.d.ts.map +1 -0
  89. package/dist/identity-state.js +345 -0
  90. package/dist/identity-state.js.map +1 -0
  91. package/dist/identity.d.ts +24 -2
  92. package/dist/identity.d.ts.map +1 -1
  93. package/dist/identity.js +70 -11
  94. package/dist/identity.js.map +1 -1
  95. package/dist/index.d.ts +26 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +77 -29
  98. package/dist/index.js.map +1 -1
  99. package/dist/internal.d.ts +36 -0
  100. package/dist/internal.d.ts.map +1 -0
  101. package/dist/internal.js +22 -0
  102. package/dist/internal.js.map +1 -0
  103. package/dist/introduction/holder.d.ts +18 -0
  104. package/dist/introduction/holder.d.ts.map +1 -0
  105. package/dist/introduction/holder.js +757 -0
  106. package/dist/introduction/holder.js.map +1 -0
  107. package/dist/introduction.d.ts +101 -0
  108. package/dist/introduction.d.ts.map +1 -0
  109. package/dist/introduction.js +132 -0
  110. package/dist/introduction.js.map +1 -0
  111. package/dist/invariants.d.ts +43 -0
  112. package/dist/invariants.d.ts.map +1 -0
  113. package/dist/invariants.js +883 -0
  114. package/dist/invariants.js.map +1 -0
  115. package/dist/keys-seed.d.ts +7 -0
  116. package/dist/keys-seed.d.ts.map +1 -0
  117. package/dist/keys-seed.js +133 -0
  118. package/dist/keys-seed.js.map +1 -0
  119. package/dist/log-memory.d.ts +12 -0
  120. package/dist/log-memory.d.ts.map +1 -0
  121. package/dist/log-memory.js +101 -0
  122. package/dist/log-memory.js.map +1 -0
  123. package/dist/membership/holder.d.ts +35 -0
  124. package/dist/membership/holder.d.ts.map +1 -0
  125. package/dist/membership/holder.js +852 -0
  126. package/dist/membership/holder.js.map +1 -0
  127. package/dist/membership.d.ts +92 -0
  128. package/dist/membership.d.ts.map +1 -0
  129. package/dist/membership.js +157 -0
  130. package/dist/membership.js.map +1 -0
  131. package/dist/ports.d.ts +237 -0
  132. package/dist/ports.d.ts.map +1 -0
  133. package/dist/ports.js +2 -0
  134. package/dist/ports.js.map +1 -0
  135. package/dist/profile.d.ts +56 -0
  136. package/dist/profile.d.ts.map +1 -0
  137. package/dist/profile.js +193 -0
  138. package/dist/profile.js.map +1 -0
  139. package/dist/prompts.d.ts +14 -0
  140. package/dist/prompts.d.ts.map +1 -0
  141. package/dist/prompts.js +69 -0
  142. package/dist/prompts.js.map +1 -0
  143. package/dist/receive.d.ts +133 -0
  144. package/dist/receive.d.ts.map +1 -0
  145. package/dist/receive.js +298 -0
  146. package/dist/receive.js.map +1 -0
  147. package/dist/results.d.ts +158 -0
  148. package/dist/results.d.ts.map +1 -0
  149. package/dist/results.js +21 -0
  150. package/dist/results.js.map +1 -0
  151. package/dist/schemas.d.ts.map +1 -1
  152. package/dist/schemas.js +42 -38
  153. package/dist/schemas.js.map +1 -1
  154. package/dist/sha256.d.ts +3 -0
  155. package/dist/sha256.d.ts.map +1 -0
  156. package/dist/sha256.js +69 -0
  157. package/dist/sha256.js.map +1 -0
  158. package/dist/star.d.ts +31 -0
  159. package/dist/star.d.ts.map +1 -0
  160. package/dist/star.js +56 -0
  161. package/dist/star.js.map +1 -0
  162. package/dist/state-builder.d.ts +42 -0
  163. package/dist/state-builder.d.ts.map +1 -0
  164. package/dist/state-builder.js +100 -0
  165. package/dist/state-builder.js.map +1 -0
  166. package/dist/state.d.ts +853 -0
  167. package/dist/state.d.ts.map +1 -0
  168. package/dist/state.js +36 -0
  169. package/dist/state.js.map +1 -0
  170. package/dist/store-contract.d.ts +11 -0
  171. package/dist/store-contract.d.ts.map +1 -0
  172. package/dist/store-contract.js +189 -0
  173. package/dist/store-contract.js.map +1 -0
  174. package/dist/store-memory.d.ts +8 -0
  175. package/dist/store-memory.d.ts.map +1 -0
  176. package/dist/store-memory.js +17 -0
  177. package/dist/store-memory.js.map +1 -0
  178. package/dist/testing.d.ts +22 -0
  179. package/dist/testing.d.ts.map +1 -0
  180. package/dist/testing.js +21 -0
  181. package/dist/testing.js.map +1 -0
  182. package/dist/trust/continuity.d.ts +71 -0
  183. package/dist/trust/continuity.d.ts.map +1 -0
  184. package/dist/trust/continuity.js +1216 -0
  185. package/dist/trust/continuity.js.map +1 -0
  186. package/dist/trust/duties.d.ts +67 -0
  187. package/dist/trust/duties.d.ts.map +1 -0
  188. package/dist/trust/duties.js +179 -0
  189. package/dist/trust/duties.js.map +1 -0
  190. package/dist/trust/entries.d.ts +139 -0
  191. package/dist/trust/entries.d.ts.map +1 -0
  192. package/dist/trust/entries.js +694 -0
  193. package/dist/trust/entries.js.map +1 -0
  194. package/dist/trust/group-star.d.ts +43 -0
  195. package/dist/trust/group-star.d.ts.map +1 -0
  196. package/dist/trust/group-star.js +188 -0
  197. package/dist/trust/group-star.js.map +1 -0
  198. package/dist/trust/mapping.d.ts +56 -0
  199. package/dist/trust/mapping.d.ts.map +1 -0
  200. package/dist/trust/mapping.js +584 -0
  201. package/dist/trust/mapping.js.map +1 -0
  202. package/dist/trust/profile.d.ts +25 -0
  203. package/dist/trust/profile.d.ts.map +1 -0
  204. package/dist/trust/profile.js +249 -0
  205. package/dist/trust/profile.js.map +1 -0
  206. package/dist/trust/star.d.ts +208 -0
  207. package/dist/trust/star.d.ts.map +1 -0
  208. package/dist/trust/star.js +588 -0
  209. package/dist/trust/star.js.map +1 -0
  210. package/dist/trust/state.d.ts +83 -0
  211. package/dist/trust/state.d.ts.map +1 -0
  212. package/dist/trust/state.js +154 -0
  213. package/dist/trust/state.js.map +1 -0
  214. package/dist/util-freeze.d.ts +3 -0
  215. package/dist/util-freeze.d.ts.map +1 -0
  216. package/dist/util-freeze.js +11 -0
  217. package/dist/util-freeze.js.map +1 -0
  218. package/dist/views.d.ts +147 -0
  219. package/dist/views.d.ts.map +1 -0
  220. package/dist/views.js +268 -0
  221. package/dist/views.js.map +1 -0
  222. package/dist/visibility.d.ts +5 -5
  223. package/dist/visibility.d.ts.map +1 -1
  224. package/dist/visibility.js +22 -28
  225. package/dist/visibility.js.map +1 -1
  226. package/dist/wire.d.ts +178 -84
  227. package/dist/wire.d.ts.map +1 -1
  228. package/dist/wire.js.map +1 -1
  229. package/package.json +56 -10
  230. package/schemas/holder-state-v1.schema.json +3880 -0
  231. package/dist/holder.d.ts.map +0 -1
  232. package/dist/holder.js.map +0 -1
  233. package/dist/probe/acks.d.ts +0 -27
  234. package/dist/probe/acks.d.ts.map +0 -1
  235. package/dist/probe/acks.js +0 -152
  236. package/dist/probe/acks.js.map +0 -1
  237. package/dist/probe/continuity.d.ts +0 -20
  238. package/dist/probe/continuity.d.ts.map +0 -1
  239. package/dist/probe/continuity.js +0 -805
  240. package/dist/probe/continuity.js.map +0 -1
  241. package/dist/probe/deps.d.ts +0 -61
  242. package/dist/probe/deps.d.ts.map +0 -1
  243. package/dist/probe/deps.js +0 -54
  244. package/dist/probe/deps.js.map +0 -1
  245. package/dist/probe/encounter.d.ts +0 -26
  246. package/dist/probe/encounter.d.ts.map +0 -1
  247. package/dist/probe/encounter.js +0 -938
  248. package/dist/probe/encounter.js.map +0 -1
  249. package/dist/probe/introduce.d.ts +0 -62
  250. package/dist/probe/introduce.d.ts.map +0 -1
  251. package/dist/probe/introduce.js +0 -306
  252. package/dist/probe/introduce.js.map +0 -1
  253. package/dist/probe/membership.d.ts +0 -96
  254. package/dist/probe/membership.d.ts.map +0 -1
  255. package/dist/probe/membership.js +0 -467
  256. package/dist/probe/membership.js.map +0 -1
  257. package/dist/probe/trust.d.ts +0 -156
  258. package/dist/probe/trust.d.ts.map +0 -1
  259. package/dist/probe/trust.js +0 -1233
  260. package/dist/probe/trust.js.map +0 -1
  261. package/dist/probe.d.ts +0 -7
  262. package/dist/probe.d.ts.map +0 -1
  263. package/dist/probe.js +0 -42
  264. package/dist/probe.js.map +0 -1
@@ -0,0 +1,237 @@
1
+ import type { Json } from './core.js';
2
+ import type { Envelope } from './delivery.js';
3
+ import type { OpaqueHolderState } from './state.js';
4
+ /** A deep, independent snapshot. `state` is raw stored JSON (or null for
5
+ * an empty store) — the engine decodes it (decodeState), the store
6
+ * never migrates. `version` is an opaque token, null for an empty store. */
7
+ export interface StoreSnapshot {
8
+ state: unknown;
9
+ version: string | null;
10
+ }
11
+ export type CommitResult = {
12
+ ok: true;
13
+ version: string;
14
+ } | {
15
+ ok: false;
16
+ reason: 'conflict';
17
+ };
18
+ /**
19
+ * Durable holder state with compare-and-swap. `commit(version, next)`
20
+ * succeeds only if the store is still at `version` (null: still empty),
21
+ * stores a copy atomically and returns the new version; otherwise it
22
+ * writes nothing. The version token serves CAS and nothing else: a store
23
+ * MUST NEVER reuse a token within its lifetime, reopening included, even
24
+ * when the content returns to an earlier value (no ABA). What the holder
25
+ * journals and announces is its own `commitSeq`, written inside `next`
26
+ * (state.ts), because the token is known only after the commit.
27
+ * Durability: visible to every later reader of the same store instance;
28
+ * persistent adapters additionally across process loss.
29
+ * Stage 2 assumes ONE writer per holder; the adapter guarantees it.
30
+ * A commit whose outcome is unknown surfaces as InfraError
31
+ * 'unknown-commit-outcome' and is resolved by re-reading (act journal).
32
+ */
33
+ export interface Store {
34
+ read(): Promise<StoreSnapshot>;
35
+ commit(version: string | null, next: OpaqueHolderState): Promise<CommitResult>;
36
+ }
37
+ /** The engine's release of an rkid, read from `addresses` (Delivery §5):
38
+ * the label it derives under, a tombstone, or unknown. The provider
39
+ * never revives a retired key from a cache. */
40
+ export type KeyRelease = (rkid: string) => {
41
+ status: 'live';
42
+ label: string;
43
+ } | {
44
+ status: 'retired';
45
+ } | {
46
+ status: 'unknown';
47
+ };
48
+ /** Outcome of a key agreement: the raw X25519 shared secret, or why not.
49
+ * `invalid`: the epk is not 32 bytes or yields the all-zero secret (a
50
+ * low-order point, Delivery §5) — the sender's fault, never the host's. */
51
+ export type Agreement = {
52
+ status: 'available';
53
+ shared: Uint8Array;
54
+ } | {
55
+ status: 'retired';
56
+ } | {
57
+ status: 'unknown';
58
+ } | {
59
+ status: 'invalid';
60
+ };
61
+ /** A carrier-relationship principal (Identity §7a.4) with its signing operation. */
62
+ export interface CarrierKey {
63
+ principal: string;
64
+ sign(bytes: Uint8Array): Promise<Uint8Array>;
65
+ }
66
+ /**
67
+ * Key operations over the holder's secret. Reads no state; modules never
68
+ * see a seed. The library's default is seedKeys(seed); an app may bind a
69
+ * keystore, secure enclave or passkey instead.
70
+ */
71
+ export interface KeyProvider {
72
+ /** the anchor and key-agreement Multikey of a register label */
73
+ anchorOf(label: string): Promise<{
74
+ anchor: string;
75
+ keyAgreement: string;
76
+ }>;
77
+ /** Ed25519 signature under the label's anchor key */
78
+ sign(label: string, bytes: Uint8Array): Promise<Uint8Array>;
79
+ /** X25519 with the private key behind `rkid`, only if `allowed` releases it */
80
+ agree(rkid: string, epk: Uint8Array, allowed: KeyRelease): Promise<Agreement>;
81
+ /** Identity §7a.4: nonce is the relationship's 32-byte carrier nonce */
82
+ carrierPrincipal(nonce: Uint8Array, carrier: string): Promise<CarrierKey>;
83
+ }
84
+ /** Head of the community anchor's log (Identity §5.4): its entry, the
85
+ * generation, the head anchor and the pre-rotation binding commit(gen+1). */
86
+ export type LogHead = {
87
+ genesis: string;
88
+ entryId: string;
89
+ gen: number;
90
+ next: string;
91
+ commit: string;
92
+ } | {
93
+ genesis: string;
94
+ empty: true;
95
+ };
96
+ /** One entry of the lineage: the one that introduced a generation. */
97
+ export interface LogEntryRef {
98
+ entryId: string;
99
+ next: string;
100
+ commit: string;
101
+ }
102
+ /** Idempotent over exactly (entry, overHead): the same closure again
103
+ * answers `exists` (a restart's repeat); the same entry over another head
104
+ * is `head-conflict` (read the head, and at(), again). */
105
+ export type AppendResult = {
106
+ status: 'appended';
107
+ head: LogHead;
108
+ } | {
109
+ status: 'exists';
110
+ head: LogHead;
111
+ } | {
112
+ status: 'head-conflict';
113
+ head: LogHead;
114
+ } | {
115
+ status: 'failure';
116
+ reason: string;
117
+ };
118
+ /** Without a Log, rotation is refused ('log-missing'); an encounter-only
119
+ * holder needs no dummy. */
120
+ export interface Log {
121
+ head(): Promise<LogHead>;
122
+ /** the entry of the lineage the head stands on that introduced
123
+ * generation `gen` (≥ 2), or null where the log holds none: lets a
124
+ * rotation whose append answer was lost recognize its entry after the
125
+ * log moved on, and tell that from a fork */
126
+ at(gen: number): Promise<LogEntryRef | null>;
127
+ /** `overHead` is the entryId the entry extends, null over an empty log */
128
+ append(entry: Json, overHead: string | null): Promise<AppendResult>;
129
+ }
130
+ /** The holder's materialized view of one group (Access), as the group
131
+ * star's reception needs it (Trust 5.2b). `isMember` and `resolve` of
132
+ * one GroupAccess MUST describe one and the same materialized snapshot
133
+ * of the group, stable for as long as the object is used. */
134
+ export interface GroupAccess {
135
+ /** the group's genesis digest */
136
+ group: string;
137
+ /** is this anchor a current member? */
138
+ isMember(anchor: string): boolean;
139
+ /** the canonical admission (or genesis) an oid names: its subject and card key */
140
+ resolve(oid: string): {
141
+ subject: string;
142
+ keyAgreement: string;
143
+ } | null;
144
+ }
145
+ export interface Access {
146
+ /** every group the holder is a current member of */
147
+ memberships(): Promise<GroupAccess[]>;
148
+ membership(group: string): Promise<GroupAccess | null>;
149
+ }
150
+ /** Receiver refusal codes an adapter may convey (VTI mediator profile). */
151
+ export type ReceiverRefusalCode = 'malformedRequest' | 'unsupportedType' | 'proofRequired' | 'proofInvalid' | 'wrongRecipient' | 'identityMismatch';
152
+ /** Sender failure reasons, closed (Delivery §6.1). An adapter's or the
153
+ * holder's own give-up is `expired-by-adapter-policy`. */
154
+ export type DeliveryFailure = 'unroutable' | 'oversize' | 'expired-by-adapter-policy' | 'rejected-by-receiver';
155
+ /** Why a submission still waits before the trias (Delivery §6.1). */
156
+ export type PreTransportReason = 'offline' | 'transport-unreachable' | 'carrier-refused-retriable';
157
+ /** A report about a submission the service has taken: the status trias. */
158
+ export type TriasReport = {
159
+ digest: string;
160
+ status: 'accepted';
161
+ } | {
162
+ digest: string;
163
+ status: 'delivered';
164
+ late: boolean;
165
+ } | {
166
+ digest: string;
167
+ status: 'failed';
168
+ reason: Exclude<DeliveryFailure, 'rejected-by-receiver'>;
169
+ } | {
170
+ digest: string;
171
+ status: 'failed';
172
+ reason: 'rejected-by-receiver';
173
+ code: ReceiverRefusalCode;
174
+ };
175
+ /** A report before the trias: an adapter condition, never a verdict and
176
+ * never a fourth state; it ends when the submission enters the trias. */
177
+ export interface PreTransportReport {
178
+ digest: string;
179
+ status: 'awaiting-transport';
180
+ reason: PreTransportReason;
181
+ }
182
+ /**
183
+ * One adapter report about one submitted document, keyed by its digest
184
+ * (Delivery §6.1). Idempotent per (digest, status); monotone except
185
+ * failed → delivered on a late ack. `accepted` never arises from a
186
+ * local commit. An adapter's `delivered` is its claim about transport:
187
+ * it never stands in for the receive core's verification of the
188
+ * delivery-ack, which alone completes a star salt (5660) or any effect.
189
+ */
190
+ export type DeliveryReport = TriasReport | PreTransportReport;
191
+ /** The adapter's mapping from its submission ids to document digests. */
192
+ export interface SubmissionRef {
193
+ submissionId: string;
194
+ digest: string;
195
+ }
196
+ /** Whom a document goes to. `rkid` is the own key-agreement id of the
197
+ * tuple it travels on (the app's sending relationship, Delivery §5a), or
198
+ * of the own key it is sent from where no tuple carries it (a member
199
+ * anchor, Membership 3.1); `keyAgreement` the counterpart key the
200
+ * envelope is sealed to; `anchor`, set where no tuple carries the
201
+ * document, the anchor it is addressed to (its ack's issuer, 4.2). */
202
+ /** `via`: where `rkid` is no tuple's (a member key, Membership), the own
203
+ * rkid of the relationship tuple the contact was named through — what a
204
+ * split of the contact's entry follows (Trust 2080). */
205
+ export interface Recipient {
206
+ contactId: string;
207
+ rkid: string;
208
+ keyAgreement: string;
209
+ anchor?: string;
210
+ via?: string;
211
+ }
212
+ /** A sealed document for the app to send. `digest` keys report();
213
+ * attempt > 1 is a retry. Pure JSON. */
214
+ export interface Outbound {
215
+ digest: string;
216
+ envelope: Envelope;
217
+ type: string;
218
+ threadId: string;
219
+ recipient: Recipient;
220
+ attempt: number;
221
+ }
222
+ export interface RetryPolicy {
223
+ /** delay before attempt n+1 after attempt n, in ms; finite and
224
+ * non-negative, rounded up to whole ms */
225
+ backoff(attempt: number): number;
226
+ /** the holder's own give-up: this long after the first submission every
227
+ * non-terminal item (submitted, accepted, or held by the adapter as
228
+ * awaiting-transport) becomes failed(expired-by-adapter-policy).
229
+ * Within Delivery's give-up range [P1D, P90D]. It also sets the
230
+ * retention of effects and the act journal, max(P90D, horizonMs) —
231
+ * Delivery §7 key-retention. There is no attempt-count give-up:
232
+ * re-emissions are local and say nothing about transport. */
233
+ horizonMs: number;
234
+ /** CAS attempts of one act before InfraError('commit-conflict'); default 8 */
235
+ commitAttempts?: number;
236
+ }
237
+ //# sourceMappingURL=ports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAInD;;6EAE6E;AAC7E,MAAM,WAAW,aAAa;IAAG,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAEzE,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAA;AAE5F;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,IAAK,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,MAAM,CAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;CAChF;AAID;;gDAEgD;AAChD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAClC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE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AC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAIvE;;;;;uEAKuE;AACvE;;yDAEyD;AACzD,MAAM,WAAW,SAAS;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;AAEnH;yCACyC;AACzC,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB;AAID,MAAM,WAAW,WAAW;IAC1B;+CAC2C;IAC3C,OAAO,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACjC;;;;;;kEAM8D;IAC9D,SAAS,EAAE,MAAM,CAAA;IACjB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB"}
package/dist/ports.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.js","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"","sourcesContent":["// ports — what the library needs from its host (lib Stage 2, note §3).\n//\n// The library defines the ports, the app implements them; each is cut\n// to what its one user needs. There is no send port: results carry\n// Outbound[], input arrives through receive, adapter reports through\n// report, retries through resume. Types only.\nimport type { Json } from './core.js'\nimport type { Envelope } from './delivery.js'\nimport type { OpaqueHolderState } from './state.js'\n\n// ── Store (user: the engine) ───────────────────────────────────────────\n\n/** A deep, independent snapshot. `state` is raw stored JSON (or null for\n * an empty store) — the engine decodes it (decodeState), the store\n * never migrates. `version` is an opaque token, null for an empty store. */\nexport interface StoreSnapshot { state: unknown, version: string | null }\n\nexport type CommitResult = { ok: true, version: string } | { ok: false, reason: 'conflict' }\n\n/**\n * Durable holder state with compare-and-swap. `commit(version, next)`\n * succeeds only if the store is still at `version` (null: still empty),\n * stores a copy atomically and returns the new version; otherwise it\n * writes nothing. The version token serves CAS and nothing else: a store\n * MUST NEVER reuse a token within its lifetime, reopening included, even\n * when the content returns to an earlier value (no ABA). What the holder\n * journals and announces is its own `commitSeq`, written inside `next`\n * (state.ts), because the token is known only after the commit.\n * Durability: visible to every later reader of the same store instance;\n * persistent adapters additionally across process loss.\n * Stage 2 assumes ONE writer per holder; the adapter guarantees it.\n * A commit whose outcome is unknown surfaces as InfraError\n * 'unknown-commit-outcome' and is resolved by re-reading (act journal).\n */\nexport interface Store {\n read (): Promise<StoreSnapshot>\n commit (version: string | null, next: OpaqueHolderState): Promise<CommitResult>\n}\n\n// ── KeyProvider (user: act preparation) ────────────────────────────────\n\n/** The engine's release of an rkid, read from `addresses` (Delivery §5):\n * the label it derives under, a tombstone, or unknown. The provider\n * never revives a retired key from a cache. */\nexport type KeyRelease = (rkid: string) =>\n | { status: 'live', label: string }\n | { status: 'retired' }\n | { status: 'unknown' }\n\n/** Outcome of a key agreement: the raw X25519 shared secret, or why not.\n * `invalid`: the epk is not 32 bytes or yields the all-zero secret (a\n * low-order point, Delivery §5) — the sender's fault, never the host's. */\nexport type Agreement =\n | { status: 'available', shared: Uint8Array }\n | { status: 'retired' }\n | { status: 'unknown' }\n | { status: 'invalid' }\n\n/** A carrier-relationship principal (Identity §7a.4) with its signing operation. */\nexport interface CarrierKey {\n principal: string\n sign (bytes: Uint8Array): Promise<Uint8Array>\n}\n\n/**\n * Key operations over the holder's secret. Reads no state; modules never\n * see a seed. The library's default is seedKeys(seed); an app may bind a\n * keystore, secure enclave or passkey instead.\n */\nexport interface KeyProvider {\n /** the anchor and key-agreement Multikey of a register label */\n anchorOf (label: string): Promise<{ anchor: string, keyAgreement: string }>\n /** Ed25519 signature under the label's anchor key */\n sign (label: string, bytes: Uint8Array): Promise<Uint8Array>\n /** X25519 with the private key behind `rkid`, only if `allowed` releases it */\n agree (rkid: string, epk: Uint8Array, allowed: KeyRelease): Promise<Agreement>\n /** Identity §7a.4: nonce is the relationship's 32-byte carrier nonce */\n carrierPrincipal (nonce: Uint8Array, carrier: string): Promise<CarrierKey>\n}\n\n// ── Log (user: rotation; optional) ─────────────────────────────────────\n\n/** Head of the community anchor's log (Identity §5.4): its entry, the\n * generation, the head anchor and the pre-rotation binding commit(gen+1). */\nexport type LogHead =\n | { genesis: string, entryId: string, gen: number, next: string, commit: string }\n | { genesis: string, empty: true }\n\n/** One entry of the lineage: the one that introduced a generation. */\nexport interface LogEntryRef { entryId: string, next: string, commit: string }\n\n/** Idempotent over exactly (entry, overHead): the same closure again\n * answers `exists` (a restart's repeat); the same entry over another head\n * is `head-conflict` (read the head, and at(), again). */\nexport type AppendResult =\n | { status: 'appended', head: LogHead }\n | { status: 'exists', head: LogHead }\n | { status: 'head-conflict', head: LogHead }\n | { status: 'failure', reason: string }\n\n/** Without a Log, rotation is refused ('log-missing'); an encounter-only\n * holder needs no dummy. */\nexport interface Log {\n head (): Promise<LogHead>\n /** the entry of the lineage the head stands on that introduced\n * generation `gen` (≥ 2), or null where the log holds none: lets a\n * rotation whose append answer was lost recognize its entry after the\n * log moved on, and tell that from a fork */\n at (gen: number): Promise<LogEntryRef | null>\n /** `overHead` is the entryId the entry extends, null over an empty log */\n append (entry: Json, overHead: string | null): Promise<AppendResult>\n}\n\n// ── Access (user: group star, membership) ──────────────────────────────\n\n/** The holder's materialized view of one group (Access), as the group\n * star's reception needs it (Trust 5.2b). `isMember` and `resolve` of\n * one GroupAccess MUST describe one and the same materialized snapshot\n * of the group, stable for as long as the object is used. */\nexport interface GroupAccess {\n /** the group's genesis digest */\n group: string\n /** is this anchor a current member? */\n isMember (anchor: string): boolean\n /** the canonical admission (or genesis) an oid names: its subject and card key */\n resolve (oid: string): { subject: string, keyAgreement: string } | null\n}\n\nexport interface Access {\n /** every group the holder is a current member of */\n memberships (): Promise<GroupAccess[]>\n membership (group: string): Promise<GroupAccess | null>\n}\n\n// ── Delivery reports (user: report) ────────────────────────────────────\n\n/** Receiver refusal codes an adapter may convey (VTI mediator profile). */\nexport type ReceiverRefusalCode =\n | 'malformedRequest' | 'unsupportedType' | 'proofRequired'\n | 'proofInvalid' | 'wrongRecipient' | 'identityMismatch'\n\n/** Sender failure reasons, closed (Delivery §6.1). An adapter's or the\n * holder's own give-up is `expired-by-adapter-policy`. */\nexport type DeliveryFailure = 'unroutable' | 'oversize' | 'expired-by-adapter-policy' | 'rejected-by-receiver'\n\n/** Why a submission still waits before the trias (Delivery §6.1). */\nexport type PreTransportReason = 'offline' | 'transport-unreachable' | 'carrier-refused-retriable'\n\n/** A report about a submission the service has taken: the status trias. */\nexport type TriasReport =\n | { digest: string, status: 'accepted' }\n | { digest: string, status: 'delivered', late: boolean }\n | { digest: string, status: 'failed', reason: Exclude<DeliveryFailure, 'rejected-by-receiver'> }\n | { digest: string, status: 'failed', reason: 'rejected-by-receiver', code: ReceiverRefusalCode }\n\n/** A report before the trias: an adapter condition, never a verdict and\n * never a fourth state; it ends when the submission enters the trias. */\nexport interface PreTransportReport { digest: string, status: 'awaiting-transport', reason: PreTransportReason }\n\n/**\n * One adapter report about one submitted document, keyed by its digest\n * (Delivery §6.1). Idempotent per (digest, status); monotone except\n * failed → delivered on a late ack. `accepted` never arises from a\n * local commit. An adapter's `delivered` is its claim about transport:\n * it never stands in for the receive core's verification of the\n * delivery-ack, which alone completes a star salt (5660) or any effect.\n */\nexport type DeliveryReport = TriasReport | PreTransportReport\n\n/** The adapter's mapping from its submission ids to document digests. */\nexport interface SubmissionRef { submissionId: string, digest: string }\n\n// ── Outbound ───────────────────────────────────────────────────────────\n\n/** Whom a document goes to. `rkid` is the own key-agreement id of the\n * tuple it travels on (the app's sending relationship, Delivery §5a), or\n * of the own key it is sent from where no tuple carries it (a member\n * anchor, Membership 3.1); `keyAgreement` the counterpart key the\n * envelope is sealed to; `anchor`, set where no tuple carries the\n * document, the anchor it is addressed to (its ack's issuer, 4.2). */\n/** `via`: where `rkid` is no tuple's (a member key, Membership), the own\n * rkid of the relationship tuple the contact was named through — what a\n * split of the contact's entry follows (Trust 2080). */\nexport interface Recipient { contactId: string, rkid: string, keyAgreement: string, anchor?: string, via?: string }\n\n/** A sealed document for the app to send. `digest` keys report();\n * attempt > 1 is a retry. Pure JSON. */\nexport interface Outbound {\n digest: string\n envelope: Envelope\n type: string\n threadId: string\n recipient: Recipient\n attempt: number\n}\n\n// ── Retry policy (parameter of createHolder) ───────────────────────────\n\nexport interface RetryPolicy {\n /** delay before attempt n+1 after attempt n, in ms; finite and\n * non-negative, rounded up to whole ms */\n backoff (attempt: number): number\n /** the holder's own give-up: this long after the first submission every\n * non-terminal item (submitted, accepted, or held by the adapter as\n * awaiting-transport) becomes failed(expired-by-adapter-policy).\n * Within Delivery's give-up range [P1D, P90D]. It also sets the\n * retention of effects and the act journal, max(P90D, horizonMs) —\n * Delivery §7 key-retention. There is no attempt-count give-up:\n * re-emissions are local and say nothing about transport. */\n horizonMs: number\n /** CAS attempts of one act before InfraError('commit-conflict'); default 8 */\n commitAttempts?: number\n}\n"]}
@@ -0,0 +1,56 @@
1
+ /** The registered task type that carries profile@1 (6495, Delivery §4.4). */
2
+ export declare const PROFILE_TYPE = "https://real-life.org/trust-tasks/profile/0.1";
3
+ /** The bounds of 6435. */
4
+ export declare const PROFILE_LIMITS: Readonly<{
5
+ name: 64;
6
+ text: 256;
7
+ imageChars: 60000;
8
+ pixels: 1024;
9
+ }>;
10
+ /** The content of a profile as the human sets it (6b.1, without type and revision). */
11
+ export interface ProfileContent {
12
+ name: string;
13
+ image?: string;
14
+ text?: string;
15
+ }
16
+ export interface ProfileBody extends ProfileContent {
17
+ type: 'profile@1';
18
+ revision: string;
19
+ }
20
+ export interface ProfileArtifact {
21
+ body: ProfileBody;
22
+ proof: {
23
+ mac: string;
24
+ };
25
+ }
26
+ /** 6430, 6435 (the schema): a closed body, a closed proof, the bounds. */
27
+ export declare const profileSchemaOk: (a: unknown) => boolean;
28
+ export interface Dimensions {
29
+ width: number;
30
+ height: number;
31
+ }
32
+ /** A plain picture's dimensions, or a VP8X container's canvas and frame. */
33
+ export type ImageDimensions = Dimensions | {
34
+ canvas: Dimensions;
35
+ frame: Dimensions;
36
+ };
37
+ /**
38
+ * The dimensions a data URI's picture declares in its header, read before
39
+ * any decoding (6475): for WebP the frame, or a VP8X container's canvas
40
+ * and frame; for JPEG the first SOFn. null: not an admitted media type, not
41
+ * base64, not a single still picture of the declared type, or unreadable.
42
+ */
43
+ export declare function imageDimensions(uri: string): ImageDimensions | null;
44
+ /** 6435, 6475: every declared dimension within 1024 × 1024, the header readable. */
45
+ export declare const imageWithinBounds: (d: ImageDimensions | null) => boolean;
46
+ /** Why a profile body (or artifact) is refused: its rule, or null if it passes. */
47
+ export declare function profileProblem(artifact: unknown): 'RLTP-TRU-6430' | 'RLTP-TRU-6475' | null;
48
+ /** The info string of k_pr: sender first (the direction, 6440). */
49
+ export declare const profileInfo: (senderPairAnchor: string, recipientPairAnchor: string) => string;
50
+ /** k_pr from the X25519 shared secret of the two pair keys (6440). */
51
+ export declare const profileKey: (shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle?: SubtleCrypto) => Promise<Uint8Array>;
52
+ /** profile@1 under k_pr: the body and its mac over JCS(body) (6430, 6440). */
53
+ export declare function assembleProfile(body: ProfileBody, shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle?: SubtleCrypto): Promise<ProfileArtifact>;
54
+ /** Whether the artifact's mac verifies under k_pr of (sender → recipient). */
55
+ export declare function profileMacOk(a: ProfileArtifact, shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle?: SubtleCrypto): Promise<boolean>;
56
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":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,EAAE,kBAAkB,MAAM,EAAE,qBAAqB,MAAM,EAAE,SAAQ,YAA+B,KAAG,OAAO,CAAC,UAAU,CACpF,CAAA;AAE9E,8EAA8E;AAC9E,wBAAsB,eAAe,CAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAE,YAA+B,GAAG,OAAO,CAAC,eAAe,CAAC,CAGtM;AAED,8EAA8E;AAC9E,wBAAsB,YAAY,CAAE,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAE,YAA+B,GAAG,OAAO,CAAC,OAAO,CAAC,CAG5L"}
@@ -0,0 +1,193 @@
1
+ // profile — profile@1 as wire (Trust Layer 0.31 §6b): the directional key
2
+ // k_pr, the MAC, the closed body with its bounds, and the picture's
3
+ // dimensions read from its encoded header before any decoding. Pure: no
4
+ // state, no transport; the holder's profile duty and task
5
+ // (trust/profile.ts) build and verify through here, and the vector
6
+ // vectors/profile.json reproduces through here byte for byte.
7
+ //
8
+ // · body { type: 'profile@1', revision, name, image?, text? }, proof
9
+ // { mac } (6430); name ≤ 64, text ≤ 256 characters, image a base64
10
+ // data URI of image/jpeg or image/webp of ≤ 60 000 characters (6435) —
11
+ // the schema trust-profile.schema.json
12
+ // · k_pr = HKDF-SHA-256(X25519(pairX_sender, pairX_recipient), salt
13
+ // empty, info "rltp/visibility/mac/profile/" || senderPairAnchor ||
14
+ // "/" || recipientPairAnchor, 32 bytes); mac = macU(k_pr, JCS(body))
15
+ // (6440, 2.1)
16
+ // · the picture (6435, 6475): one still picture of the declared media
17
+ // type whose every declared dimension is within 1024 × 1024, read from
18
+ // the header alone, the container's structure checked as far as the
19
+ // header goes — WebP: every chunk within the RIFF container, the whole
20
+ // container scanned, the VP8 or VP8L frame, and in the extended (VP8X)
21
+ // container both its canvas and its one frame; JPEG: the markers up to
22
+ // the scan, exactly one non-differential frame header, no hierarchical
23
+ // image. An animated profile is not allowed (6435 asks for one still
24
+ // picture): the VP8X animation flag, ANIM and ANMF are rejected.
25
+ // Unreadable is rejected. The library never decodes pixels;
26
+ // re-encoding without metadata (6445) is the app's duty before
27
+ // setProfile, as is ignoring metadata when it displays (6485)
28
+ import { jcs, makeValidator } from './core.js';
29
+ import { hkdf, platformSubtle } from './crypto.js';
30
+ import { macU } from './anchor.js';
31
+ import { SCHEMAS } from './schemas.js';
32
+ /** The registered task type that carries profile@1 (6495, Delivery §4.4). */
33
+ export const PROFILE_TYPE = 'https://real-life.org/trust-tasks/profile/0.1';
34
+ /** The bounds of 6435. */
35
+ export const PROFILE_LIMITS = Object.freeze({ name: 64, text: 256, imageChars: 60_000, pixels: 1024 });
36
+ const SCHEMA = 'trust-profile.schema.json';
37
+ const V = makeValidator(SCHEMAS);
38
+ /** 6430, 6435 (the schema): a closed body, a closed proof, the bounds. */
39
+ export const profileSchemaOk = (a) => V.validate(a, SCHEMAS[SCHEMA], SCHEMAS[SCHEMA]).length === 0;
40
+ const base64 = (s) => {
41
+ if (!/^[A-Za-z0-9+/]*={0,2}$/.test(s) || s.length % 4 !== 0)
42
+ return null;
43
+ try {
44
+ const bin = atob(s);
45
+ const out = new Uint8Array(bin.length);
46
+ for (let i = 0; i < bin.length; i++)
47
+ out[i] = bin.charCodeAt(i);
48
+ return out;
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ };
54
+ const u16le = (b, o) => b[o] | (b[o + 1] << 8);
55
+ const u16be = (b, o) => (b[o] << 8) | b[o + 1];
56
+ const u24le = (b, o) => b[o] | (b[o + 1] << 8) | (b[o + 2] << 16);
57
+ const u32le = (b, o) => (b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24)) >>> 0;
58
+ const ascii = (b, o, n) => String.fromCharCode(...b.subarray(o, o + n));
59
+ /** The frame of a VP8L or VP8 chunk at offset o (its payload at o + 8,
60
+ * ending at `end`): read only within the chunk. */
61
+ function frameAt(b, o, end) {
62
+ const fourcc = ascii(b, o, 4), p = o + 8;
63
+ if (fourcc === 'VP8L' && p + 5 <= end && b[p] === 0x2f) {
64
+ const v = u32le(b, p + 1);
65
+ return { width: (v & 0x3fff) + 1, height: ((v >>> 14) & 0x3fff) + 1 };
66
+ }
67
+ if (fourcc === 'VP8 ' && p + 10 <= end && b[p + 3] === 0x9d && b[p + 4] === 0x01 && b[p + 5] === 0x2a) {
68
+ return { width: u16le(b, p + 6) & 0x3fff, height: u16le(b, p + 8) & 0x3fff };
69
+ }
70
+ return null;
71
+ }
72
+ /**
73
+ * WebP: the RIFF container exactly as long as it says, every chunk within
74
+ * it (its length bounded by the container, padded to even), the whole
75
+ * container scanned. The simple format is one VP8 or VP8L chunk and
76
+ * nothing else; the extended format starts with a VP8X chunk of 10 bytes
77
+ * (canvas) and holds exactly one VP8 or VP8L chunk (frame) — both
78
+ * declarations count. An animation (the VP8X flag, an ANIM or ANMF chunk
79
+ * anywhere) is no single still picture.
80
+ */
81
+ function webp(b) {
82
+ if (b.length < 20 || ascii(b, 0, 4) !== 'RIFF' || ascii(b, 8, 4) !== 'WEBP' || u32le(b, 4) + 8 !== b.length)
83
+ return null;
84
+ const chunks = [];
85
+ for (let o = 12; o < b.length;) {
86
+ if (o + 8 > b.length)
87
+ return null;
88
+ const size = u32le(b, o + 4);
89
+ const end = o + 8 + size;
90
+ if (end > b.length)
91
+ return null;
92
+ chunks.push({ fourcc: ascii(b, o, 4), o, end });
93
+ o = end + (size & 1);
94
+ if (o > b.length)
95
+ return null;
96
+ }
97
+ if (!chunks.length || chunks.some((c) => c.fourcc === 'ANIM' || c.fourcc === 'ANMF'))
98
+ return null;
99
+ const [first, ...rest] = chunks;
100
+ if (first.fourcc === 'VP8 ' || first.fourcc === 'VP8L')
101
+ return rest.length ? null : frameAt(b, first.o, first.end);
102
+ if (first.fourcc !== 'VP8X' || first.end - first.o !== 18 || (b[first.o + 8] & 0x02))
103
+ return null;
104
+ const canvas = { width: u24le(b, first.o + 12) + 1, height: u24le(b, first.o + 15) + 1 };
105
+ const frames = rest.filter((c) => c.fourcc === 'VP8 ' || c.fourcc === 'VP8L');
106
+ if (frames.length !== 1 || rest.some((c) => c.fourcc === 'VP8X'))
107
+ return null;
108
+ const frame = frameAt(b, frames[0].o, frames[0].end);
109
+ return frame === null ? null : { canvas, frame };
110
+ }
111
+ /**
112
+ * JPEG: the markers from SOI up to SOS, every segment length at least 2
113
+ * and within the data. Exactly one frame header: SOF0–3 or SOF9–11; the
114
+ * differential SOF5–7 and SOF13–15, DHP (a hierarchical image), JPG, a
115
+ * second SOF, a SOF of the wrong length, restart, SOI or EOI markers
116
+ * before the scan, and a SOS without a frame are rejected.
117
+ */
118
+ function jpeg(b) {
119
+ if (b.length < 4 || b[0] !== 0xff || b[1] !== 0xd8)
120
+ return null;
121
+ let frame = null;
122
+ for (let i = 2;;) {
123
+ if (i >= b.length || b[i] !== 0xff)
124
+ return null;
125
+ while (i < b.length && b[i] === 0xff)
126
+ i++; // fill bytes
127
+ if (i >= b.length)
128
+ return null;
129
+ const m = b[i++];
130
+ if (m === 0x00 || m === 0x01 || (m >= 0xd0 && m <= 0xd9))
131
+ return null;
132
+ if (i + 2 > b.length)
133
+ return null;
134
+ const len = u16be(b, i);
135
+ if (len < 2 || i + len > b.length)
136
+ return null;
137
+ if (m === 0xde)
138
+ return null; // DHP
139
+ if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xcc) {
140
+ if (!(m <= 0xc3 || (m >= 0xc9 && m <= 0xcb)) || frame !== null || len < 8 || len !== 8 + 3 * b[i + 7])
141
+ return null;
142
+ frame = { width: u16be(b, i + 5), height: u16be(b, i + 3) };
143
+ }
144
+ if (m === 0xda)
145
+ return frame; // SOS
146
+ i += len;
147
+ }
148
+ }
149
+ /**
150
+ * The dimensions a data URI's picture declares in its header, read before
151
+ * any decoding (6475): for WebP the frame, or a VP8X container's canvas
152
+ * and frame; for JPEG the first SOFn. null: not an admitted media type, not
153
+ * base64, not a single still picture of the declared type, or unreadable.
154
+ */
155
+ export function imageDimensions(uri) {
156
+ if (typeof uri !== 'string')
157
+ return null;
158
+ const m = /^data:(image\/(?:jpeg|webp));base64,/.exec(uri);
159
+ if (!m)
160
+ return null;
161
+ const b = base64(uri.slice(m[0].length));
162
+ if (b === null)
163
+ return null;
164
+ return m[1] === 'image/webp' ? webp(b) : jpeg(b);
165
+ }
166
+ const within = (d) => d.width >= 1 && d.height >= 1 && d.width <= PROFILE_LIMITS.pixels && d.height <= PROFILE_LIMITS.pixels;
167
+ /** 6435, 6475: every declared dimension within 1024 × 1024, the header readable. */
168
+ export const imageWithinBounds = (d) => d !== null && ('canvas' in d ? within(d.canvas) && within(d.frame) : within(d));
169
+ /** Why a profile body (or artifact) is refused: its rule, or null if it passes. */
170
+ export function profileProblem(artifact) {
171
+ if (!profileSchemaOk(artifact))
172
+ return 'RLTP-TRU-6430';
173
+ const image = artifact.body.image;
174
+ if (image !== undefined && !imageWithinBounds(imageDimensions(image)))
175
+ return 'RLTP-TRU-6475';
176
+ return null;
177
+ }
178
+ // ── k_pr and the MAC (6440) ────────────────────────────────────────────
179
+ /** The info string of k_pr: sender first (the direction, 6440). */
180
+ export const profileInfo = (senderPairAnchor, recipientPairAnchor) => `rltp/visibility/mac/profile/${senderPairAnchor}/${recipientPairAnchor}`;
181
+ /** k_pr from the X25519 shared secret of the two pair keys (6440). */
182
+ export const profileKey = (shared, senderPairAnchor, recipientPairAnchor, subtle = platformSubtle()) => hkdf(shared, profileInfo(senderPairAnchor, recipientPairAnchor), 32, subtle);
183
+ /** profile@1 under k_pr: the body and its mac over JCS(body) (6430, 6440). */
184
+ export async function assembleProfile(body, shared, senderPairAnchor, recipientPairAnchor, subtle = platformSubtle()) {
185
+ const k = await profileKey(shared, senderPairAnchor, recipientPairAnchor, subtle);
186
+ return { body, proof: { mac: await macU(k, jcs(body), subtle) } };
187
+ }
188
+ /** Whether the artifact's mac verifies under k_pr of (sender → recipient). */
189
+ export async function profileMacOk(a, shared, senderPairAnchor, recipientPairAnchor, subtle = platformSubtle()) {
190
+ const k = await profileKey(shared, senderPairAnchor, recipientPairAnchor, subtle);
191
+ return (await macU(k, jcs(a.body), subtle)) === a.proof.mac;
192
+ }
193
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oEAAoE;AACpE,wEAAwE;AACxE,0DAA0D;AAC1D,mEAAmE;AACnE,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,2EAA2E;AAC3E,2CAA2C;AAC3C,sEAAsE;AACtE,wEAAwE;AACxE,yEAAyE;AACzE,kBAAkB;AAClB,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,qEAAqE;AACrE,gEAAgE;AAChE,mEAAmE;AACnE,kEAAkE;AAClE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,+CAA+C,CAAA;AAE3E,0BAA0B;AAC1B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AAOtG,MAAM,MAAM,GAAG,2BAA2B,CAAA;AAC1C,MAAM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body with its bounds, and the picture's\n// dimensions read from its encoded header before any decoding. Pure: no\n// state, no transport; the holder's profile duty and task\n// (trust/profile.ts) build and verify through here, and the vector\n// vectors/profile.json reproduces through here byte for byte.\n//\n// · body { type: 'profile@1', revision, name, image?, text? }, proof\n// { mac } (6430); name ≤ 64, text ≤ 256 characters, image a base64\n// data URI of image/jpeg or image/webp of ≤ 60 000 characters (6435) —\n// the schema trust-profile.schema.json\n// · k_pr = HKDF-SHA-256(X25519(pairX_sender, pairX_recipient), salt\n// empty, info \"rltp/visibility/mac/profile/\" || senderPairAnchor ||\n// \"/\" || recipientPairAnchor, 32 bytes); mac = macU(k_pr, JCS(body))\n// (6440, 2.1)\n// · the picture (6435, 6475): one still picture of the declared media\n// type whose every declared dimension is within 1024 × 1024, read from\n// the header alone, the container's structure checked as far as the\n// header goes — WebP: every chunk within the RIFF container, the whole\n// container scanned, the VP8 or VP8L frame, and in the extended (VP8X)\n// container both its canvas and its one frame; JPEG: the markers up to\n// the scan, exactly one non-differential frame header, no hierarchical\n// image. An animated profile is not allowed (6435 asks for one still\n// picture): the VP8X animation flag, ANIM and ANMF are rejected.\n// Unreadable is rejected. The library never decodes pixels;\n// re-encoding without metadata (6445) is the app's duty before\n// setProfile, as is ignoring metadata when it displays (6485)\nimport { jcs, makeValidator } from './core.js'\nimport { hkdf, platformSubtle } from './crypto.js'\nimport { macU } from './anchor.js'\nimport { SCHEMAS } from './schemas.js'\n\n/** The registered task type that carries profile@1 (6495, Delivery §4.4). */\nexport const PROFILE_TYPE = 'https://real-life.org/trust-tasks/profile/0.1'\n\n/** The bounds of 6435. */\nexport const PROFILE_LIMITS = Object.freeze({ name: 64, text: 256, imageChars: 60_000, pixels: 1024 })\n\n/** The content of a profile as the human sets it (6b.1, without type and revision). */\nexport interface ProfileContent { name: string, image?: string, text?: string }\nexport interface ProfileBody extends ProfileContent { type: 'profile@1', revision: string }\nexport interface ProfileArtifact { body: ProfileBody, proof: { mac: string } }\n\nconst SCHEMA = 'trust-profile.schema.json'\nconst V = makeValidator(SCHEMAS)\n/** 6430, 6435 (the schema): a closed body, a closed proof, the bounds. */\nexport const profileSchemaOk = (a: unknown): boolean => V.validate(a, SCHEMAS[SCHEMA], SCHEMAS[SCHEMA]).length === 0\n\n// ── the picture's header (6475) ────────────────────────────────────────\n\nexport interface Dimensions { width: number, height: number }\n/** A plain picture's dimensions, or a VP8X container's canvas and frame. */\nexport type ImageDimensions = Dimensions | { canvas: Dimensions, frame: Dimensions }\n\nconst base64 = (s: string): Uint8Array | null => {\n if (!/^[A-Za-z0-9+/]*={0,2}$/.test(s) || s.length % 4 !== 0) return null\n try {\n const bin = atob(s)\n const out = new Uint8Array(bin.length)\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i)\n return out\n } catch { return null }\n}\nconst u16le = (b: Uint8Array, o: number): number => b[o]! | (b[o + 1]! << 8)\nconst u16be = (b: Uint8Array, o: number): number => (b[o]! << 8) | b[o + 1]!\nconst u24le = (b: Uint8Array, o: number): number => b[o]! | (b[o + 1]! << 8) | (b[o + 2]! << 16)\nconst u32le = (b: Uint8Array, o: number): number => (b[o]! | (b[o + 1]! << 8) | (b[o + 2]! << 16) | (b[o + 3]! << 24)) >>> 0\nconst ascii = (b: Uint8Array, o: number, n: number): string => String.fromCharCode(...b.subarray(o, o + n))\n\n/** The frame of a VP8L or VP8 chunk at offset o (its payload at o + 8,\n * ending at `end`): read only within the chunk. */\nfunction frameAt (b: Uint8Array, o: number, end: number): Dimensions | null {\n const fourcc = ascii(b, o, 4), p = o + 8\n if (fourcc === 'VP8L' && p + 5 <= end && b[p] === 0x2f) {\n const v = u32le(b, p + 1)\n return { width: (v & 0x3fff) + 1, height: ((v >>> 14) & 0x3fff) + 1 }\n }\n if (fourcc === 'VP8 ' && p + 10 <= end && b[p + 3] === 0x9d && b[p + 4] === 0x01 && b[p + 5] === 0x2a) {\n return { width: u16le(b, p + 6) & 0x3fff, height: u16le(b, p + 8) & 0x3fff }\n }\n return null\n}\n\n/**\n * WebP: the RIFF container exactly as long as it says, every chunk within\n * it (its length bounded by the container, padded to even), the whole\n * container scanned. The simple format is one VP8 or VP8L chunk and\n * nothing else; the extended format starts with a VP8X chunk of 10 bytes\n * (canvas) and holds exactly one VP8 or VP8L chunk (frame) — both\n * declarations count. An animation (the VP8X flag, an ANIM or ANMF chunk\n * anywhere) is no single still picture.\n */\nfunction webp (b: Uint8Array): ImageDimensions | null {\n if (b.length < 20 || ascii(b, 0, 4) !== 'RIFF' || ascii(b, 8, 4) !== 'WEBP' || u32le(b, 4) + 8 !== b.length) return null\n const chunks: Array<{ fourcc: string, o: number, end: number }> = []\n for (let o = 12; o < b.length;) {\n if (o + 8 > b.length) return null\n const size = u32le(b, o + 4)\n const end = o + 8 + size\n if (end > b.length) return null\n chunks.push({ fourcc: ascii(b, o, 4), o, end })\n o = end + (size & 1)\n if (o > b.length) return null\n }\n if (!chunks.length || chunks.some((c) => c.fourcc === 'ANIM' || c.fourcc === 'ANMF')) return null\n const [first, ...rest] = chunks\n if (first.fourcc === 'VP8 ' || first.fourcc === 'VP8L') return rest.length ? null : frameAt(b, first.o, first.end)\n if (first.fourcc !== 'VP8X' || first.end - first.o !== 18 || (b[first.o + 8]! & 0x02)) return null\n const canvas = { width: u24le(b, first.o + 12) + 1, height: u24le(b, first.o + 15) + 1 }\n const frames = rest.filter((c) => c.fourcc === 'VP8 ' || c.fourcc === 'VP8L')\n if (frames.length !== 1 || rest.some((c) => c.fourcc === 'VP8X')) return null\n const frame = frameAt(b, frames[0].o, frames[0].end)\n return frame === null ? null : { canvas, frame }\n}\n\n/**\n * JPEG: the markers from SOI up to SOS, every segment length at least 2\n * and within the data. Exactly one frame header: SOF0–3 or SOF9–11; the\n * differential SOF5–7 and SOF13–15, DHP (a hierarchical image), JPG, a\n * second SOF, a SOF of the wrong length, restart, SOI or EOI markers\n * before the scan, and a SOS without a frame are rejected.\n */\nfunction jpeg (b: Uint8Array): Dimensions | null {\n if (b.length < 4 || b[0] !== 0xff || b[1] !== 0xd8) return null\n let frame: Dimensions | null = null\n for (let i = 2; ;) {\n if (i >= b.length || b[i] !== 0xff) return null\n while (i < b.length && b[i] === 0xff) i++ // fill bytes\n if (i >= b.length) return null\n const m = b[i++]!\n if (m === 0x00 || m === 0x01 || (m >= 0xd0 && m <= 0xd9)) return null\n if (i + 2 > b.length) return null\n const len = u16be(b, i)\n if (len < 2 || i + len > b.length) return null\n if (m === 0xde) return null // DHP\n if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xcc) {\n if (!(m <= 0xc3 || (m >= 0xc9 && m <= 0xcb)) || frame !== null || len < 8 || len !== 8 + 3 * b[i + 7]!) return null\n frame = { width: u16be(b, i + 5), height: u16be(b, i + 3) }\n }\n if (m === 0xda) return frame // SOS\n i += len\n }\n}\n\n/**\n * The dimensions a data URI's picture declares in its header, read before\n * any decoding (6475): for WebP the frame, or a VP8X container's canvas\n * and frame; for JPEG the first SOFn. null: not an admitted media type, not\n * base64, not a single still picture of the declared type, or unreadable.\n */\nexport function imageDimensions (uri: string): ImageDimensions | null {\n if (typeof uri !== 'string') return null\n const m = /^data:(image\\/(?:jpeg|webp));base64,/.exec(uri)\n if (!m) return null\n const b = base64(uri.slice(m[0].length))\n if (b === null) return null\n return m[1] === 'image/webp' ? webp(b) : jpeg(b)\n}\n\nconst within = (d: Dimensions): boolean => d.width >= 1 && d.height >= 1 && d.width <= PROFILE_LIMITS.pixels && d.height <= PROFILE_LIMITS.pixels\n/** 6435, 6475: every declared dimension within 1024 × 1024, the header readable. */\nexport const imageWithinBounds = (d: ImageDimensions | null): boolean =>\n d !== null && ('canvas' in d ? within(d.canvas) && within(d.frame) : within(d))\n\n/** Why a profile body (or artifact) is refused: its rule, or null if it passes. */\nexport function profileProblem (artifact: unknown): 'RLTP-TRU-6430' | 'RLTP-TRU-6475' | null {\n if (!profileSchemaOk(artifact)) return 'RLTP-TRU-6430'\n const image = (artifact as ProfileArtifact).body.image\n if (image !== undefined && !imageWithinBounds(imageDimensions(image))) return 'RLTP-TRU-6475'\n return null\n}\n\n// ── k_pr and the MAC (6440) ────────────────────────────────────────────\n\n/** The info string of k_pr: sender first (the direction, 6440). */\nexport const profileInfo = (senderPairAnchor: string, recipientPairAnchor: string): string =>\n `rltp/visibility/mac/profile/${senderPairAnchor}/${recipientPairAnchor}`\n\n/** k_pr from the X25519 shared secret of the two pair keys (6440). */\nexport const profileKey = (shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle: SubtleCrypto = platformSubtle()): Promise<Uint8Array> =>\n hkdf(shared, profileInfo(senderPairAnchor, recipientPairAnchor), 32, subtle)\n\n/** profile@1 under k_pr: the body and its mac over JCS(body) (6430, 6440). */\nexport async function assembleProfile (body: ProfileBody, shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle: SubtleCrypto = platformSubtle()): Promise<ProfileArtifact> {\n const k = await profileKey(shared, senderPairAnchor, recipientPairAnchor, subtle)\n return { body, proof: { mac: await macU(k, jcs(body), subtle) } }\n}\n\n/** Whether the artifact's mac verifies under k_pr of (sender → recipient). */\nexport async function profileMacOk (a: ProfileArtifact, shared: Uint8Array, senderPairAnchor: string, recipientPairAnchor: string, subtle: SubtleCrypto = platformSubtle()): Promise<boolean> {\n const k = await profileKey(shared, senderPairAnchor, recipientPairAnchor, subtle)\n return (await macU(k, jcs(a.body), subtle)) === a.proof.mac\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { DecisionHandler, HolderModule } from './engine.js';
2
+ import type { PromptChoice, PromptKind } from './state.js';
3
+ /** The command name of the decision. */
4
+ export declare const DECIDE = "prompt.decide";
5
+ export interface DecideInput {
6
+ promptId: string;
7
+ choice: PromptChoice;
8
+ }
9
+ export type Decisions = ReadonlyMap<PromptKind, DecisionHandler>;
10
+ /** The decision handlers of the modules, one per kind at most. */
11
+ export declare function collectDecisions(modules: readonly HolderModule[]): Decisions;
12
+ /** The prompts module createHolder registers, over the modules' decision handlers. */
13
+ export declare function promptsModule(decisions?: Decisions): HolderModule;
14
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAoC,eAAe,EAAc,YAAY,EAAW,MAAM,aAAa,CAAA;AAEvH,OAAO,KAAK,EAAe,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvE,wCAAwC;AACxC,eAAO,MAAM,MAAM,kBAAkB,CAAA;AAErC,MAAM,WAAW,WAAW;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE;AAIvE,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;AAEhE,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAa7E;AAyCD,sFAAsF;AACtF,wBAAgB,aAAa,CAAE,SAAS,GAAE,SAAqB,GAAG,YAAY,CAE7E"}