@openvtc/trust-tasks 0.17.6 → 0.17.8

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 (58) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/dist/_shared/components.d.ts +4 -0
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/index.d.ts +8 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +8 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/rooms/_shared/0.1/room.d.ts +1 -1
  9. package/dist/rooms/_shared/0.1/room.d.ts.map +1 -1
  10. package/dist/rooms/create/0.1/payload.d.ts +42 -2
  11. package/dist/rooms/create/0.1/payload.d.ts.map +1 -1
  12. package/dist/rooms/create/0.1/payload.js +24 -0
  13. package/dist/rooms/create/0.1/payload.js.map +1 -1
  14. package/dist/rooms/keys/backfill/0.1/payload.d.ts +336 -0
  15. package/dist/rooms/keys/backfill/0.1/payload.d.ts.map +1 -0
  16. package/dist/rooms/keys/backfill/0.1/payload.js +177 -0
  17. package/dist/rooms/keys/backfill/0.1/payload.js.map +1 -0
  18. package/dist/rooms/keys/chain/0.1/payload.d.ts +382 -0
  19. package/dist/rooms/keys/chain/0.1/payload.d.ts.map +1 -0
  20. package/dist/rooms/keys/chain/0.1/payload.js +213 -0
  21. package/dist/rooms/keys/chain/0.1/payload.js.map +1 -0
  22. package/dist/rooms/keys/list/0.1/payload.d.ts +314 -0
  23. package/dist/rooms/keys/list/0.1/payload.d.ts.map +1 -0
  24. package/dist/rooms/keys/list/0.1/payload.js +175 -0
  25. package/dist/rooms/keys/list/0.1/payload.js.map +1 -0
  26. package/dist/rooms/keys/seal/0.1/payload.d.ts +352 -0
  27. package/dist/rooms/keys/seal/0.1/payload.d.ts.map +1 -0
  28. package/dist/rooms/keys/seal/0.1/payload.js +199 -0
  29. package/dist/rooms/keys/seal/0.1/payload.js.map +1 -0
  30. package/dist/rooms/owner/invite/0.1/payload.d.ts +291 -0
  31. package/dist/rooms/owner/invite/0.1/payload.d.ts.map +1 -0
  32. package/dist/rooms/owner/invite/0.1/payload.js +158 -0
  33. package/dist/rooms/owner/invite/0.1/payload.js.map +1 -0
  34. package/dist/rooms/owner/issue-authority/0.1/payload.d.ts +315 -0
  35. package/dist/rooms/owner/issue-authority/0.1/payload.d.ts.map +1 -0
  36. package/dist/rooms/owner/issue-authority/0.1/payload.js +173 -0
  37. package/dist/rooms/owner/issue-authority/0.1/payload.js.map +1 -0
  38. package/dist/rooms/owner/issue-membership/0.1/payload.d.ts +291 -0
  39. package/dist/rooms/owner/issue-membership/0.1/payload.d.ts.map +1 -0
  40. package/dist/rooms/owner/issue-membership/0.1/payload.js +158 -0
  41. package/dist/rooms/owner/issue-membership/0.1/payload.js.map +1 -0
  42. package/dist/rooms/owner/register/0.1/payload.d.ts +382 -0
  43. package/dist/rooms/owner/register/0.1/payload.d.ts.map +1 -0
  44. package/dist/rooms/owner/register/0.1/payload.js +215 -0
  45. package/dist/rooms/owner/register/0.1/payload.js.map +1 -0
  46. package/package.json +1 -1
  47. package/src/_shared/components.ts +4 -0
  48. package/src/index.ts +8 -0
  49. package/src/rooms/_shared/0.1/room.ts +1 -1
  50. package/src/rooms/create/0.1/payload.ts +30 -2
  51. package/src/rooms/keys/backfill/0.1/payload.ts +236 -0
  52. package/src/rooms/keys/chain/0.1/payload.ts +262 -0
  53. package/src/rooms/keys/list/0.1/payload.ts +222 -0
  54. package/src/rooms/keys/seal/0.1/payload.ts +246 -0
  55. package/src/rooms/owner/invite/0.1/payload.ts +212 -0
  56. package/src/rooms/owner/issue-authority/0.1/payload.ts +233 -0
  57. package/src/rooms/owner/issue-membership/0.1/payload.ts +212 -0
  58. package/src/rooms/owner/register/0.1/payload.ts +278 -0
package/src/index.ts CHANGED
@@ -233,12 +233,20 @@ export * as RoomShared_v0_1 from "./rooms/_shared/0.1/room.js";
233
233
  export * as RoomsCreate_v0_1 from "./rooms/create/0.1/payload.js";
234
234
  export * as RoomsEpochChain_v0_1 from "./rooms/epoch/chain/0.1/payload.js";
235
235
  export * as RoomsEpochMint_v0_1 from "./rooms/epoch/mint/0.1/payload.js";
236
+ export * as RoomsKeysBackfill_v0_1 from "./rooms/keys/backfill/0.1/payload.js";
237
+ export * as RoomsKeysChain_v0_1 from "./rooms/keys/chain/0.1/payload.js";
236
238
  export * as RoomsKeysCommit_v0_1 from "./rooms/keys/commit/0.1/payload.js";
237
239
  export * as RoomsKeysKeyPackage_v0_1 from "./rooms/keys/key-package/0.1/payload.js";
240
+ export * as RoomsKeysList_v0_1 from "./rooms/keys/list/0.1/payload.js";
238
241
  export * as RoomsKeysOpen_v0_1 from "./rooms/keys/open/0.1/payload.js";
239
242
  export * as RoomsKeysPresent_v0_1 from "./rooms/keys/present/0.1/payload.js";
243
+ export * as RoomsKeysSeal_v0_1 from "./rooms/keys/seal/0.1/payload.js";
240
244
  export * as RoomsKeysWelcome_v0_1 from "./rooms/keys/welcome/0.1/payload.js";
241
245
  export * as RoomsOwnerClaim_v0_1 from "./rooms/owner/claim/0.1/payload.js";
246
+ export * as RoomsOwnerInvite_v0_1 from "./rooms/owner/invite/0.1/payload.js";
247
+ export * as RoomsOwnerIssueAuthority_v0_1 from "./rooms/owner/issue-authority/0.1/payload.js";
248
+ export * as RoomsOwnerIssueMembership_v0_1 from "./rooms/owner/issue-membership/0.1/payload.js";
249
+ export * as RoomsOwnerRegister_v0_1 from "./rooms/owner/register/0.1/payload.js";
242
250
  export * as RoomsOwnerTransfer_v0_1 from "./rooms/owner/transfer/0.1/payload.js";
243
251
  export * as RoomsRecordsCurate_v0_1 from "./rooms/records/curate/0.1/payload.js";
244
252
  export * as RoomsRecordsGet_v0_1 from "./rooms/records/get/0.1/payload.js";
@@ -14,4 +14,4 @@ export interface RoomsSharedTypes {
14
14
  * The definitions this shared schema publishes, hoisted to one declaration each.
15
15
  * See "../../../_shared/components.js".
16
16
  */
17
- export type { AuthorityPresentation, EpochLink, RecordMetadata, SealedRecord, Visibility } from "../../../_shared/components.js";
17
+ export type { AuthorityPresentation, EpochLink, RecordMetadata, RetentionPolicy, SealedRecord, Visibility } from "../../../_shared/components.js";
@@ -3,7 +3,7 @@
3
3
  * Source: specs/rooms/create/0.1/payload.schema.json
4
4
  */
5
5
 
6
- import type { Ext, Visibility } from "../../../_shared/components.js";
6
+ import type { Ext, RetentionPolicy, Visibility } from "../../../_shared/components.js";
7
7
 
8
8
 
9
9
  export interface RoomsCreatePayload {
@@ -16,6 +16,10 @@ export interface RoomsCreatePayload {
16
16
  * The room's accountable party: the controller of the room's identifier, the issuer of every credential in it, and the party a host addresses about quota, abuse, or lifecycle. Visible at every visibility, including `private` — a room has someone answerable for it.
17
17
  */
18
18
  ownerDid: string;
19
+ /**
20
+ * Whether this room keeps its history readable across a membership change. Absent means `chained`, which is the choice a room wants unless it has a reason not to: joining a room should mean being able to read it. A host MUST reject an epoch link for a room whose policy is `fromJoin` rather than storing one it declared it would not have.
21
+ */
22
+ retentionPolicy?: RetentionPolicy;
19
23
  /**
20
24
  * How long the host will hold the room after its epoch lapses without renewal, before storage may be reclaimed. Stated at creation rather than discovered: reclamation that surprises a member is a failure of the design, not of the member.
21
25
  */
@@ -38,7 +42,7 @@ export interface RoomsCreateResponsePayload {
38
42
  }
39
43
 
40
44
  /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
41
- export type { Ext, Visibility };
45
+ export type { Ext, RetentionPolicy, Visibility };
42
46
 
43
47
  /** Trust Task type URI. */
44
48
  export const TYPE_URI = "https://trusttasks.org/spec/rooms/create/0.1" as const;
@@ -84,6 +88,10 @@ export const PAYLOAD_SCHEMA = {
84
88
  "type": "string",
85
89
  "description": "The room's accountable party: the controller of the room's identifier, the issuer of every credential in it, and the party a host addresses about quota, abuse, or lifecycle. Visible at every visibility, including `private` — a room has someone answerable for it."
86
90
  },
91
+ "retentionPolicy": {
92
+ "$ref": "#/$defs/RetentionPolicy",
93
+ "description": "Whether this room keeps its history readable across a membership change. Absent means `chained`, which is the choice a room wants unless it has a reason not to: joining a room should mean being able to read it. A host MUST reject an epoch link for a room whose policy is `fromJoin` rather than storing one it declared it would not have."
94
+ },
87
95
  "retentionDays": {
88
96
  "type": "integer",
89
97
  "minimum": 1,
@@ -129,6 +137,16 @@ export const PAYLOAD_SCHEMA = {
129
137
  "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
130
138
  }
131
139
  },
140
+ "RetentionPolicy": {
141
+ "title": "RetentionPolicy",
142
+ "type": "string",
143
+ "enum": [
144
+ "chained",
145
+ "fromJoin"
146
+ ],
147
+ "description": "Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.",
148
+ "$comment": "Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it."
149
+ },
132
150
  "Visibility": {
133
151
  "title": "Visibility",
134
152
  "type": "string",
@@ -181,6 +199,16 @@ export const RESPONSE_PAYLOAD_SCHEMA = {
181
199
  "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
182
200
  }
183
201
  },
202
+ "RetentionPolicy": {
203
+ "title": "RetentionPolicy",
204
+ "type": "string",
205
+ "enum": [
206
+ "chained",
207
+ "fromJoin"
208
+ ],
209
+ "description": "Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.",
210
+ "$comment": "Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it."
211
+ },
184
212
  "Visibility": {
185
213
  "title": "Visibility",
186
214
  "type": "string",
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/rooms/keys/backfill/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { Ext } from "../../../../_shared/components.js";
7
+
8
+
9
+ export interface RoomsKeysBackfillPayload {
10
+ /**
11
+ * The room to backfill. The recipient MUST already hold group state for it, and MUST NOT create any on the strength of this request: rungs are inert without an epoch key, so fetching them for a room one is not in would retain key material for nothing.
12
+ */
13
+ roomId: string;
14
+ /**
15
+ * The host to fetch from, as a DID. Named by the caller because nothing maps a room to its host: a room is portable — re-point it and it has moved — so a remembered host is a value that goes stale, and the recipient holds key custody rather than a hosting record. A caller who names the wrong host learns so as a refusal from a party that does not serve this room, which is loud and immediate.
16
+ */
17
+ host: string;
18
+ /**
19
+ * Fetch only rungs at or below this epoch. Absent means from the room's current epoch down. A recipient that already reads to some epoch SHOULD pass it, so a host serves the part that is missing rather than the whole chain.
20
+ */
21
+ fromEpoch?: number;
22
+ /**
23
+ * Maximum rungs to request in one pass, highest `epoch` first. A host MAY return fewer. A caller walking a long history calls again with `fromEpoch` set below what it has.
24
+ */
25
+ limit?: number;
26
+ /**
27
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
28
+ */
29
+ ext?: Ext;
30
+ }
31
+ /**
32
+ * Success response to rooms/keys/backfill. Type https://trusttasks.org/spec/rooms/keys/backfill/0.1#response.
33
+ */
34
+ export interface RoomsKeysBackfillResponsePayload {
35
+ roomId: string;
36
+ /**
37
+ * The earliest epoch the recipient can now derive a key for, having walked what it holds. **This is the answer worth having**, and it is not derivable from `fetched`: a rung extends reach only if every rung above it is present, so a chain served with a gap in it moves this number not at all. `1` means the room's whole retained history is readable.
38
+ */
39
+ earliestReadableEpoch: number;
40
+ /**
41
+ * How many rungs the host served. Reported separately from `stored` and from the reach so a caller can tell the three ways this ends: nothing served (the host has no more), served and stored but the reach did not move (a gap), or served and the reach moved.
42
+ */
43
+ fetched?: number;
44
+ /**
45
+ * How many of them the recipient did not already hold. Zero alongside a positive `fetched` means the chain was already delivered, which is what a retry looks like.
46
+ */
47
+ stored?: number;
48
+ ext?: Ext;
49
+ }
50
+
51
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
52
+ export type { Ext };
53
+
54
+ /** Trust Task type URI. */
55
+ export const TYPE_URI = "https://trusttasks.org/spec/rooms/keys/backfill/0.1" as const;
56
+
57
+ /** Stable alias for this specification's request payload shape. */
58
+ export type Payload = RoomsKeysBackfillPayload;
59
+
60
+ /** Trust Task response type URI (request type URI + "#response"). */
61
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/keys/backfill/0.1#response" as const;
62
+
63
+ /** Stable alias for this specification's success-response payload shape. */
64
+ export type Response = RoomsKeysBackfillResponsePayload;
65
+
66
+ /**
67
+ * This specification's payload schema, as a value.
68
+ *
69
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
70
+ * rather than only as a `.json` file because TypeScript types are erased
71
+ * at runtime: without a schema a consumer has nothing to validate, and
72
+ * every REQUIRED payload member is optional in practice. Cross-file
73
+ * `$ref`s are already inlined, so it needs no resolver.
74
+ */
75
+ export const PAYLOAD_SCHEMA = {
76
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
77
+ "$id": "https://trusttasks.org/spec/rooms/keys/backfill/0.1",
78
+ "title": "Rooms Keys Backfill — payload",
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": [
82
+ "roomId",
83
+ "host"
84
+ ],
85
+ "properties": {
86
+ "roomId": {
87
+ "type": "string",
88
+ "description": "The room to backfill. The recipient MUST already hold group state for it, and MUST NOT create any on the strength of this request: rungs are inert without an epoch key, so fetching them for a room one is not in would retain key material for nothing."
89
+ },
90
+ "host": {
91
+ "type": "string",
92
+ "description": "The host to fetch from, as a DID. Named by the caller because nothing maps a room to its host: a room is portable — re-point it and it has moved — so a remembered host is a value that goes stale, and the recipient holds key custody rather than a hosting record. A caller who names the wrong host learns so as a refusal from a party that does not serve this room, which is loud and immediate."
93
+ },
94
+ "fromEpoch": {
95
+ "type": "integer",
96
+ "minimum": 1,
97
+ "description": "Fetch only rungs at or below this epoch. Absent means from the room's current epoch down. A recipient that already reads to some epoch SHOULD pass it, so a host serves the part that is missing rather than the whole chain."
98
+ },
99
+ "limit": {
100
+ "type": "integer",
101
+ "minimum": 1,
102
+ "description": "Maximum rungs to request in one pass, highest `epoch` first. A host MAY return fewer. A caller walking a long history calls again with `fromEpoch` set below what it has."
103
+ },
104
+ "ext": {
105
+ "$ref": "#/$defs/Ext",
106
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
107
+ }
108
+ },
109
+ "$defs": {
110
+ "Response": {
111
+ "$anchor": "response",
112
+ "title": "Rooms Keys Backfill — response payload",
113
+ "description": "Success response to rooms/keys/backfill. Type https://trusttasks.org/spec/rooms/keys/backfill/0.1#response.",
114
+ "type": "object",
115
+ "additionalProperties": false,
116
+ "required": [
117
+ "roomId",
118
+ "earliestReadableEpoch"
119
+ ],
120
+ "properties": {
121
+ "roomId": {
122
+ "type": "string"
123
+ },
124
+ "earliestReadableEpoch": {
125
+ "type": "integer",
126
+ "minimum": 1,
127
+ "description": "The earliest epoch the recipient can now derive a key for, having walked what it holds. **This is the answer worth having**, and it is not derivable from `fetched`: a rung extends reach only if every rung above it is present, so a chain served with a gap in it moves this number not at all. `1` means the room's whole retained history is readable."
128
+ },
129
+ "fetched": {
130
+ "type": "integer",
131
+ "minimum": 0,
132
+ "description": "How many rungs the host served. Reported separately from `stored` and from the reach so a caller can tell the three ways this ends: nothing served (the host has no more), served and stored but the reach did not move (a gap), or served and the reach moved."
133
+ },
134
+ "stored": {
135
+ "type": "integer",
136
+ "minimum": 0,
137
+ "description": "How many of them the recipient did not already hold. Zero alongside a positive `fetched` means the chain was already delivered, which is what a retry looks like."
138
+ },
139
+ "ext": {
140
+ "$ref": "#/$defs/Ext"
141
+ }
142
+ }
143
+ },
144
+ "Ext": {
145
+ "title": "Ext",
146
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
147
+ "type": "object",
148
+ "minProperties": 1,
149
+ "additionalProperties": true,
150
+ "propertyNames": {
151
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
152
+ }
153
+ }
154
+ }
155
+ } as const;
156
+
157
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
158
+ export const RESPONSE_PAYLOAD_SCHEMA = {
159
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
160
+ "$ref": "#/$defs/Response",
161
+ "$defs": {
162
+ "Response": {
163
+ "$anchor": "response",
164
+ "title": "Rooms Keys Backfill — response payload",
165
+ "description": "Success response to rooms/keys/backfill. Type https://trusttasks.org/spec/rooms/keys/backfill/0.1#response.",
166
+ "type": "object",
167
+ "additionalProperties": false,
168
+ "required": [
169
+ "roomId",
170
+ "earliestReadableEpoch"
171
+ ],
172
+ "properties": {
173
+ "roomId": {
174
+ "type": "string"
175
+ },
176
+ "earliestReadableEpoch": {
177
+ "type": "integer",
178
+ "minimum": 1,
179
+ "description": "The earliest epoch the recipient can now derive a key for, having walked what it holds. **This is the answer worth having**, and it is not derivable from `fetched`: a rung extends reach only if every rung above it is present, so a chain served with a gap in it moves this number not at all. `1` means the room's whole retained history is readable."
180
+ },
181
+ "fetched": {
182
+ "type": "integer",
183
+ "minimum": 0,
184
+ "description": "How many rungs the host served. Reported separately from `stored` and from the reach so a caller can tell the three ways this ends: nothing served (the host has no more), served and stored but the reach did not move (a gap), or served and the reach moved."
185
+ },
186
+ "stored": {
187
+ "type": "integer",
188
+ "minimum": 0,
189
+ "description": "How many of them the recipient did not already hold. Zero alongside a positive `fetched` means the chain was already delivered, which is what a retry looks like."
190
+ },
191
+ "ext": {
192
+ "$ref": "#/$defs/Ext"
193
+ }
194
+ }
195
+ },
196
+ "Ext": {
197
+ "title": "Ext",
198
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
199
+ "type": "object",
200
+ "minProperties": 1,
201
+ "additionalProperties": true,
202
+ "propertyNames": {
203
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
204
+ }
205
+ }
206
+ }
207
+ } as const;
208
+
209
+ /**
210
+ * SPEC.md §7.2 policy for the request variant, from this specification's
211
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
212
+ * per-specification and cannot be derived from the document alone, and
213
+ * item 2 needs the schema this carries.
214
+ */
215
+ export const SPEC = {
216
+ typeUri: TYPE_URI,
217
+ isBearer: false,
218
+ isProofRequired: true,
219
+ isRecipientRequired: true,
220
+ isIssuedAtRequired: true,
221
+ payloadSchema: PAYLOAD_SCHEMA,
222
+ } as const;
223
+
224
+ /**
225
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
226
+ * tracks the *issuer* party's requirement because a response swaps the
227
+ * parties (§7.3 item 5).
228
+ */
229
+ export const RESPONSE_SPEC = {
230
+ typeUri: RESPONSE_TYPE_URI,
231
+ isBearer: false,
232
+ isProofRequired: true,
233
+ isRecipientRequired: true,
234
+ isIssuedAtRequired: true,
235
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
236
+ } as const;
@@ -0,0 +1,262 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/rooms/keys/chain/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { EpochLink, Ext } from "../../../../_shared/components.js";
7
+
8
+
9
+ export interface RoomsKeysChainPayload {
10
+ /**
11
+ * The room whose chain these rungs belong to. The recipient MUST hold group state for it, and MUST NOT create any on the strength of this request: rungs are inert without an epoch key, so accepting them for a room one is not in would retain key material for nothing.
12
+ */
13
+ roomId: string;
14
+ /**
15
+ * The rungs, in any order. A recipient stores them and reports how far back it can now reach — see the response's `earliestReadableEpoch`.
16
+ *
17
+ * @minItems 1
18
+ */
19
+ links: [EpochLink, ...EpochLink[]];
20
+ /**
21
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
22
+ */
23
+ ext?: Ext;
24
+ }
25
+ /**
26
+ * Success response to rooms/keys/chain. Type https://trusttasks.org/spec/rooms/keys/chain/0.1#response.
27
+ */
28
+ export interface RoomsKeysChainResponsePayload {
29
+ roomId: string;
30
+ /**
31
+ * The earliest epoch the recipient can now derive a key for, having walked the chain it holds. **This is the answer worth having**, and it is not a restatement of what was sent: a rung only extends reach if every rung above it is present too, so a caller that supplied a set with a gap in it learns that here rather than at the first record that will not open. `1` means the room's whole history is reachable.
32
+ */
33
+ earliestReadableEpoch: number;
34
+ /**
35
+ * How many rungs the recipient did not already hold. Zero is a success, not a no-op: it means the caller's chain was already delivered, which is what a retry looks like.
36
+ */
37
+ stored?: number;
38
+ ext?: Ext;
39
+ }
40
+
41
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
42
+ export type { EpochLink, Ext };
43
+
44
+ /** Trust Task type URI. */
45
+ export const TYPE_URI = "https://trusttasks.org/spec/rooms/keys/chain/0.1" as const;
46
+
47
+ /** Stable alias for this specification's request payload shape. */
48
+ export type Payload = RoomsKeysChainPayload;
49
+
50
+ /** Trust Task response type URI (request type URI + "#response"). */
51
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/keys/chain/0.1#response" as const;
52
+
53
+ /** Stable alias for this specification's success-response payload shape. */
54
+ export type Response = RoomsKeysChainResponsePayload;
55
+
56
+ /**
57
+ * This specification's payload schema, as a value.
58
+ *
59
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
60
+ * rather than only as a `.json` file because TypeScript types are erased
61
+ * at runtime: without a schema a consumer has nothing to validate, and
62
+ * every REQUIRED payload member is optional in practice. Cross-file
63
+ * `$ref`s are already inlined, so it needs no resolver.
64
+ */
65
+ export const PAYLOAD_SCHEMA = {
66
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
67
+ "$id": "https://trusttasks.org/spec/rooms/keys/chain/0.1",
68
+ "title": "Rooms Keys Chain — payload",
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": [
72
+ "roomId",
73
+ "links"
74
+ ],
75
+ "properties": {
76
+ "roomId": {
77
+ "type": "string",
78
+ "description": "The room whose chain these rungs belong to. The recipient MUST hold group state for it, and MUST NOT create any on the strength of this request: rungs are inert without an epoch key, so accepting them for a room one is not in would retain key material for nothing."
79
+ },
80
+ "links": {
81
+ "type": "array",
82
+ "minItems": 1,
83
+ "description": "The rungs, in any order. A recipient stores them and reports how far back it can now reach — see the response's `earliestReadableEpoch`.",
84
+ "items": {
85
+ "$ref": "#/$defs/EpochLink"
86
+ }
87
+ },
88
+ "ext": {
89
+ "$ref": "#/$defs/Ext",
90
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
91
+ }
92
+ },
93
+ "$defs": {
94
+ "Response": {
95
+ "$anchor": "response",
96
+ "title": "Rooms Keys Chain — response payload",
97
+ "description": "Success response to rooms/keys/chain. Type https://trusttasks.org/spec/rooms/keys/chain/0.1#response.",
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": [
101
+ "roomId",
102
+ "earliestReadableEpoch"
103
+ ],
104
+ "properties": {
105
+ "roomId": {
106
+ "type": "string"
107
+ },
108
+ "earliestReadableEpoch": {
109
+ "type": "integer",
110
+ "minimum": 1,
111
+ "description": "The earliest epoch the recipient can now derive a key for, having walked the chain it holds. **This is the answer worth having**, and it is not a restatement of what was sent: a rung only extends reach if every rung above it is present too, so a caller that supplied a set with a gap in it learns that here rather than at the first record that will not open. `1` means the room's whole history is reachable."
112
+ },
113
+ "stored": {
114
+ "type": "integer",
115
+ "minimum": 0,
116
+ "description": "How many rungs the recipient did not already hold. Zero is a success, not a no-op: it means the caller's chain was already delivered, which is what a retry looks like."
117
+ },
118
+ "ext": {
119
+ "$ref": "#/$defs/Ext"
120
+ }
121
+ }
122
+ },
123
+ "Ext": {
124
+ "title": "Ext",
125
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
126
+ "type": "object",
127
+ "minProperties": 1,
128
+ "additionalProperties": true,
129
+ "propertyNames": {
130
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
131
+ }
132
+ },
133
+ "EpochLink": {
134
+ "title": "EpochLink",
135
+ "type": "object",
136
+ "additionalProperties": false,
137
+ "required": [
138
+ "epoch",
139
+ "wrapped",
140
+ "nonce"
141
+ ],
142
+ "description": "One rung of a room's epoch key chain: the storage key of epoch `epoch - 1`, sealed under the storage key of `epoch`. A group key schedule offers no way to derive an earlier epoch's key from a later one — that property is what makes removing a member mean something — so without a chain the first membership change makes every record already in the room unopenable by everyone, including whoever wrote it. The chain is the one-way street run deliberately the other way: a member holding the current key walks it backwards to any retained epoch, and a member holding an earlier key still derives nothing later. Removal stays forward-only; reading stays possible. What a chain costs is stated where it is chosen, in the room's retention policy.",
143
+ "properties": {
144
+ "epoch": {
145
+ "type": "integer",
146
+ "minimum": 2,
147
+ "description": "The epoch whose storage key opens this link; it wraps the storage key of `epoch - 1`. Never 1: a room's first epoch has no predecessor, so a link claiming one wraps something that is not an earlier epoch's key."
148
+ },
149
+ "wrapped": {
150
+ "type": "string",
151
+ "description": "The wrapped predecessor key, base64url. Bound by AEAD associated data to `roomId` and to this link's own position in the chain, so a link lifted to another rung, or served under another room, fails to open rather than yielding a key that is wrong. The binding is load-bearing rather than decorative: every rung is a fixed-length key sealed under a fixed-length key, so nothing about the ciphertext itself says where it belongs."
152
+ },
153
+ "nonce": {
154
+ "type": "string",
155
+ "description": "AEAD nonce, base64url."
156
+ }
157
+ }
158
+ }
159
+ }
160
+ } as const;
161
+
162
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
163
+ export const RESPONSE_PAYLOAD_SCHEMA = {
164
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
165
+ "$ref": "#/$defs/Response",
166
+ "$defs": {
167
+ "Response": {
168
+ "$anchor": "response",
169
+ "title": "Rooms Keys Chain — response payload",
170
+ "description": "Success response to rooms/keys/chain. Type https://trusttasks.org/spec/rooms/keys/chain/0.1#response.",
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "roomId",
175
+ "earliestReadableEpoch"
176
+ ],
177
+ "properties": {
178
+ "roomId": {
179
+ "type": "string"
180
+ },
181
+ "earliestReadableEpoch": {
182
+ "type": "integer",
183
+ "minimum": 1,
184
+ "description": "The earliest epoch the recipient can now derive a key for, having walked the chain it holds. **This is the answer worth having**, and it is not a restatement of what was sent: a rung only extends reach if every rung above it is present too, so a caller that supplied a set with a gap in it learns that here rather than at the first record that will not open. `1` means the room's whole history is reachable."
185
+ },
186
+ "stored": {
187
+ "type": "integer",
188
+ "minimum": 0,
189
+ "description": "How many rungs the recipient did not already hold. Zero is a success, not a no-op: it means the caller's chain was already delivered, which is what a retry looks like."
190
+ },
191
+ "ext": {
192
+ "$ref": "#/$defs/Ext"
193
+ }
194
+ }
195
+ },
196
+ "Ext": {
197
+ "title": "Ext",
198
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
199
+ "type": "object",
200
+ "minProperties": 1,
201
+ "additionalProperties": true,
202
+ "propertyNames": {
203
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
204
+ }
205
+ },
206
+ "EpochLink": {
207
+ "title": "EpochLink",
208
+ "type": "object",
209
+ "additionalProperties": false,
210
+ "required": [
211
+ "epoch",
212
+ "wrapped",
213
+ "nonce"
214
+ ],
215
+ "description": "One rung of a room's epoch key chain: the storage key of epoch `epoch - 1`, sealed under the storage key of `epoch`. A group key schedule offers no way to derive an earlier epoch's key from a later one — that property is what makes removing a member mean something — so without a chain the first membership change makes every record already in the room unopenable by everyone, including whoever wrote it. The chain is the one-way street run deliberately the other way: a member holding the current key walks it backwards to any retained epoch, and a member holding an earlier key still derives nothing later. Removal stays forward-only; reading stays possible. What a chain costs is stated where it is chosen, in the room's retention policy.",
216
+ "properties": {
217
+ "epoch": {
218
+ "type": "integer",
219
+ "minimum": 2,
220
+ "description": "The epoch whose storage key opens this link; it wraps the storage key of `epoch - 1`. Never 1: a room's first epoch has no predecessor, so a link claiming one wraps something that is not an earlier epoch's key."
221
+ },
222
+ "wrapped": {
223
+ "type": "string",
224
+ "description": "The wrapped predecessor key, base64url. Bound by AEAD associated data to `roomId` and to this link's own position in the chain, so a link lifted to another rung, or served under another room, fails to open rather than yielding a key that is wrong. The binding is load-bearing rather than decorative: every rung is a fixed-length key sealed under a fixed-length key, so nothing about the ciphertext itself says where it belongs."
225
+ },
226
+ "nonce": {
227
+ "type": "string",
228
+ "description": "AEAD nonce, base64url."
229
+ }
230
+ }
231
+ }
232
+ }
233
+ } as const;
234
+
235
+ /**
236
+ * SPEC.md §7.2 policy for the request variant, from this specification's
237
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
238
+ * per-specification and cannot be derived from the document alone, and
239
+ * item 2 needs the schema this carries.
240
+ */
241
+ export const SPEC = {
242
+ typeUri: TYPE_URI,
243
+ isBearer: false,
244
+ isProofRequired: true,
245
+ isRecipientRequired: true,
246
+ isIssuedAtRequired: true,
247
+ payloadSchema: PAYLOAD_SCHEMA,
248
+ } as const;
249
+
250
+ /**
251
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
252
+ * tracks the *issuer* party's requirement because a response swaps the
253
+ * parties (§7.3 item 5).
254
+ */
255
+ export const RESPONSE_SPEC = {
256
+ typeUri: RESPONSE_TYPE_URI,
257
+ isBearer: false,
258
+ isProofRequired: true,
259
+ isRecipientRequired: true,
260
+ isIssuedAtRequired: true,
261
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
262
+ } as const;