@openvtc/trust-tasks 0.17.7 → 0.17.9

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 (38) hide show
  1. package/CHANGELOG.md +110 -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 +5 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +5 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/persona/_shared/0.1/persona-record.d.ts +1 -1
  9. package/dist/persona/_shared/0.1/persona-record.d.ts.map +1 -1
  10. package/dist/persona/facet/delete/1.0/payload.d.ts +310 -0
  11. package/dist/persona/facet/delete/1.0/payload.d.ts.map +1 -0
  12. package/dist/persona/facet/delete/1.0/payload.js +169 -0
  13. package/dist/persona/facet/delete/1.0/payload.js.map +1 -0
  14. package/dist/persona/facet/list/1.0/payload.d.ts +599 -0
  15. package/dist/persona/facet/list/1.0/payload.d.ts.map +1 -0
  16. package/dist/persona/facet/list/1.0/payload.js +332 -0
  17. package/dist/persona/facet/list/1.0/payload.js.map +1 -0
  18. package/dist/persona/facet/put/1.0/payload.d.ts +490 -0
  19. package/dist/persona/facet/put/1.0/payload.d.ts.map +1 -0
  20. package/dist/persona/facet/put/1.0/payload.js +272 -0
  21. package/dist/persona/facet/put/1.0/payload.js.map +1 -0
  22. package/dist/rooms/keys/backfill/0.1/payload.d.ts +336 -0
  23. package/dist/rooms/keys/backfill/0.1/payload.d.ts.map +1 -0
  24. package/dist/rooms/keys/backfill/0.1/payload.js +177 -0
  25. package/dist/rooms/keys/backfill/0.1/payload.js.map +1 -0
  26. package/dist/rooms/owner/register/0.1/payload.d.ts +382 -0
  27. package/dist/rooms/owner/register/0.1/payload.d.ts.map +1 -0
  28. package/dist/rooms/owner/register/0.1/payload.js +215 -0
  29. package/dist/rooms/owner/register/0.1/payload.js.map +1 -0
  30. package/package.json +1 -1
  31. package/src/_shared/components.ts +4 -0
  32. package/src/index.ts +5 -0
  33. package/src/persona/_shared/0.1/persona-record.ts +1 -1
  34. package/src/persona/facet/delete/1.0/payload.ts +212 -0
  35. package/src/persona/facet/list/1.0/payload.ts +402 -0
  36. package/src/persona/facet/put/1.0/payload.ts +339 -0
  37. package/src/rooms/keys/backfill/0.1/payload.ts +236 -0
  38. package/src/rooms/owner/register/0.1/payload.ts +278 -0
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/persona/facet/put/1.0/payload.schema.json
4
+ */
5
+
6
+ import type { ExpectedVersion_PersonaV0_1 as ExpectedVersion, Ext, FacetColour, Ulid, Version_PersonaV0_1 as Version } from "../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * Create or replace one facet: a named part of the holder's life, and the faces and attributes that belong to it. Omit `facetId` to create; supply it to replace. `expectedVersion` makes the write conditional.
11
+ */
12
+ export interface PersonaFacetPutPayload {
13
+ /**
14
+ * Omit to create — the maintainer assigns one and returns it. Supply to replace an existing facet, or to make a create idempotent under retry; a supplied id that already exists is a replacement, and a producer that meant to create MUST pair it with `expectedVersion: 0`.
15
+ */
16
+ facetId?: Ulid;
17
+ /**
18
+ * The holder's name for this part of their life — "Work", "Home", "Play". Never disclosed to a verifier; it is how the holder finds it again. A maintainer MUST NOT interpret it: it is not a scope, a policy input, or a name a counterparty ever sees.
19
+ */
20
+ name: string;
21
+ colour: FacetColour;
22
+ /**
23
+ * One or two emoji, as a decorative mark beside the name. Bounded at 8 bytes because it is a mark and not a field: anything longer is text, and text belongs in `name` where a consumer will lay it out. A maintainer stores it opaquely and MUST NOT parse it; a consumer that cannot render emoji omits it and shows the name, which is why it is OPTIONAL and carries no meaning of its own.
24
+ */
25
+ icon?: string;
26
+ /**
27
+ * Profiles belonging to this facet. A profile belongs to at most one facet — see `persona/facet/put:faceAlreadyPlaced` — because the facet is where a consumer reads a profile's colour from, and two answers is no answer. Omission on a replace means an empty list, not 'leave as they were': this is a replace, and a member whose absence meant 'keep' would make it impossible to empty one.
28
+ *
29
+ * @maxItems 256
30
+ */
31
+ faceIds?: Ulid[];
32
+ /**
33
+ * Attributes belonging to this facet. Unlike a profile, an attribute MAY belong to several — a mobile number is genuinely both work and home — so no exclusivity is enforced and none should be inferred. Same replace semantics as `faceIds`.
34
+ *
35
+ * @maxItems 1024
36
+ */
37
+ attributeIds?: Ulid[];
38
+ /**
39
+ * Optional precondition. Omit for last-writer-wins. Supply the version a prior read returned to make the write conditional; supply 0 to create only.
40
+ */
41
+ expectedVersion?: ExpectedVersion;
42
+ ext?: Ext;
43
+ }
44
+ /**
45
+ * Success response to persona/facet/put. Type https://trusttasks.org/spec/persona/facet/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying persona/facet/put:versionConflict.
46
+ */
47
+ export interface PersonaFacetPutResponsePayload {
48
+ facetId: Ulid;
49
+ version: Version;
50
+ /**
51
+ * True when this write created the facet, false when it replaced one. A producer that omitted `facetId` can still be told which happened, because a retried create with a supplied id is a replacement.
52
+ */
53
+ created: boolean;
54
+ createdAt?: string;
55
+ updatedAt: string;
56
+ ext?: Ext;
57
+ }
58
+
59
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
60
+ export type { ExpectedVersion, Ext, FacetColour, Ulid, Version };
61
+
62
+ /** Trust Task type URI. */
63
+ export const TYPE_URI = "https://trusttasks.org/spec/persona/facet/put/1.0" as const;
64
+
65
+ /** Stable alias for this specification's request payload shape. */
66
+ export type Payload = PersonaFacetPutPayload;
67
+
68
+ /** Trust Task response type URI (request type URI + "#response"). */
69
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/persona/facet/put/1.0#response" as const;
70
+
71
+ /** Stable alias for this specification's success-response payload shape. */
72
+ export type Response = PersonaFacetPutResponsePayload;
73
+
74
+ /**
75
+ * This specification's payload schema, as a value.
76
+ *
77
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
78
+ * rather than only as a `.json` file because TypeScript types are erased
79
+ * at runtime: without a schema a consumer has nothing to validate, and
80
+ * every REQUIRED payload member is optional in practice. Cross-file
81
+ * `$ref`s are already inlined, so it needs no resolver.
82
+ */
83
+ export const PAYLOAD_SCHEMA = {
84
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
85
+ "$id": "https://trusttasks.org/spec/persona/facet/put/1.0",
86
+ "title": "Persona — Facet Put — payload",
87
+ "description": "Create or replace one facet: a named part of the holder's life, and the faces and attributes that belong to it. Omit `facetId` to create; supply it to replace. `expectedVersion` makes the write conditional.",
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": [
91
+ "name",
92
+ "colour"
93
+ ],
94
+ "properties": {
95
+ "facetId": {
96
+ "$ref": "#/$defs/Ulid",
97
+ "description": "Omit to create — the maintainer assigns one and returns it. Supply to replace an existing facet, or to make a create idempotent under retry; a supplied id that already exists is a replacement, and a producer that meant to create MUST pair it with `expectedVersion: 0`."
98
+ },
99
+ "name": {
100
+ "type": "string",
101
+ "minLength": 1,
102
+ "maxLength": 64,
103
+ "description": "The holder's name for this part of their life — \"Work\", \"Home\", \"Play\". Never disclosed to a verifier; it is how the holder finds it again. A maintainer MUST NOT interpret it: it is not a scope, a policy input, or a name a counterparty ever sees."
104
+ },
105
+ "colour": {
106
+ "$ref": "#/$defs/FacetColour"
107
+ },
108
+ "icon": {
109
+ "type": "string",
110
+ "minLength": 1,
111
+ "maxLength": 8,
112
+ "description": "One or two emoji, as a decorative mark beside the name. Bounded at 8 bytes because it is a mark and not a field: anything longer is text, and text belongs in `name` where a consumer will lay it out. A maintainer stores it opaquely and MUST NOT parse it; a consumer that cannot render emoji omits it and shows the name, which is why it is OPTIONAL and carries no meaning of its own."
113
+ },
114
+ "faceIds": {
115
+ "type": "array",
116
+ "maxItems": 256,
117
+ "uniqueItems": true,
118
+ "default": [],
119
+ "items": {
120
+ "$ref": "#/$defs/Ulid"
121
+ },
122
+ "description": "Profiles belonging to this facet. A profile belongs to at most one facet — see `persona/facet/put:faceAlreadyPlaced` — because the facet is where a consumer reads a profile's colour from, and two answers is no answer. Omission on a replace means an empty list, not 'leave as they were': this is a replace, and a member whose absence meant 'keep' would make it impossible to empty one."
123
+ },
124
+ "attributeIds": {
125
+ "type": "array",
126
+ "maxItems": 1024,
127
+ "uniqueItems": true,
128
+ "default": [],
129
+ "items": {
130
+ "$ref": "#/$defs/Ulid"
131
+ },
132
+ "description": "Attributes belonging to this facet. Unlike a profile, an attribute MAY belong to several — a mobile number is genuinely both work and home — so no exclusivity is enforced and none should be inferred. Same replace semantics as `faceIds`."
133
+ },
134
+ "expectedVersion": {
135
+ "$ref": "#/$defs/ExpectedVersion",
136
+ "description": "Optional precondition. Omit for last-writer-wins. Supply the version a prior read returned to make the write conditional; supply 0 to create only."
137
+ },
138
+ "ext": {
139
+ "$ref": "#/$defs/Ext"
140
+ }
141
+ },
142
+ "$defs": {
143
+ "Response": {
144
+ "$anchor": "response",
145
+ "title": "Persona Facet Put — response payload",
146
+ "description": "Success response to persona/facet/put. Type https://trusttasks.org/spec/persona/facet/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying persona/facet/put:versionConflict.",
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "required": [
150
+ "facetId",
151
+ "version",
152
+ "created",
153
+ "updatedAt"
154
+ ],
155
+ "properties": {
156
+ "facetId": {
157
+ "$ref": "#/$defs/Ulid"
158
+ },
159
+ "version": {
160
+ "$ref": "#/$defs/Version"
161
+ },
162
+ "created": {
163
+ "type": "boolean",
164
+ "description": "True when this write created the facet, false when it replaced one. A producer that omitted `facetId` can still be told which happened, because a retried create with a supplied id is a replacement."
165
+ },
166
+ "createdAt": {
167
+ "type": "string",
168
+ "format": "date-time"
169
+ },
170
+ "updatedAt": {
171
+ "type": "string",
172
+ "format": "date-time"
173
+ },
174
+ "ext": {
175
+ "$ref": "#/$defs/Ext"
176
+ }
177
+ }
178
+ },
179
+ "Ext": {
180
+ "title": "Ext",
181
+ "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.",
182
+ "type": "object",
183
+ "minProperties": 1,
184
+ "additionalProperties": true,
185
+ "propertyNames": {
186
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
187
+ }
188
+ },
189
+ "Version": {
190
+ "title": "Version",
191
+ "description": "A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.",
192
+ "type": "integer",
193
+ "minimum": 1
194
+ },
195
+ "Ulid": {
196
+ "title": "Ulid",
197
+ "description": "A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.",
198
+ "type": "string",
199
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
200
+ },
201
+ "ExpectedVersion": {
202
+ "title": "ExpectedVersion",
203
+ "description": "Optimistic-concurrency precondition. A positive value requires the record's current `version` to equal it exactly; zero means create-only and applies only when no live record exists at the address.",
204
+ "type": "integer",
205
+ "minimum": 0
206
+ },
207
+ "FacetColour": {
208
+ "title": "FacetColour",
209
+ "description": "A colour **name**, resolved by each consumer against its own palette — never a hex value or any other literal. Two reasons, and both are about the consumer rather than the holder. A literal cannot be legible in a terminal, in a light theme and in a dark one at once, so a stored `#8B0000` is a colour that is wrong somewhere and the holder has no way to know where. And a consumer that reserves colours to mean something — an error, a warning, an irreversible act — must be able to keep a holder's decorative choice out of that channel; it cannot do that with an arbitrary value, and it can do it trivially with a closed set it maps itself. The eight members are chosen to be distinguishable from one another and deliberately carry no status connotation: none is named for success, warning or danger.",
210
+ "type": "string",
211
+ "enum": [
212
+ "slate",
213
+ "indigo",
214
+ "teal",
215
+ "moss",
216
+ "sand",
217
+ "clay",
218
+ "rose",
219
+ "plum"
220
+ ]
221
+ }
222
+ }
223
+ } as const;
224
+
225
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
226
+ export const RESPONSE_PAYLOAD_SCHEMA = {
227
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
228
+ "$ref": "#/$defs/Response",
229
+ "$defs": {
230
+ "Response": {
231
+ "$anchor": "response",
232
+ "title": "Persona Facet Put — response payload",
233
+ "description": "Success response to persona/facet/put. Type https://trusttasks.org/spec/persona/facet/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying persona/facet/put:versionConflict.",
234
+ "type": "object",
235
+ "additionalProperties": false,
236
+ "required": [
237
+ "facetId",
238
+ "version",
239
+ "created",
240
+ "updatedAt"
241
+ ],
242
+ "properties": {
243
+ "facetId": {
244
+ "$ref": "#/$defs/Ulid"
245
+ },
246
+ "version": {
247
+ "$ref": "#/$defs/Version"
248
+ },
249
+ "created": {
250
+ "type": "boolean",
251
+ "description": "True when this write created the facet, false when it replaced one. A producer that omitted `facetId` can still be told which happened, because a retried create with a supplied id is a replacement."
252
+ },
253
+ "createdAt": {
254
+ "type": "string",
255
+ "format": "date-time"
256
+ },
257
+ "updatedAt": {
258
+ "type": "string",
259
+ "format": "date-time"
260
+ },
261
+ "ext": {
262
+ "$ref": "#/$defs/Ext"
263
+ }
264
+ }
265
+ },
266
+ "Ext": {
267
+ "title": "Ext",
268
+ "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.",
269
+ "type": "object",
270
+ "minProperties": 1,
271
+ "additionalProperties": true,
272
+ "propertyNames": {
273
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
274
+ }
275
+ },
276
+ "Version": {
277
+ "title": "Version",
278
+ "description": "A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.",
279
+ "type": "integer",
280
+ "minimum": 1
281
+ },
282
+ "Ulid": {
283
+ "title": "Ulid",
284
+ "description": "A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.",
285
+ "type": "string",
286
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
287
+ },
288
+ "ExpectedVersion": {
289
+ "title": "ExpectedVersion",
290
+ "description": "Optimistic-concurrency precondition. A positive value requires the record's current `version` to equal it exactly; zero means create-only and applies only when no live record exists at the address.",
291
+ "type": "integer",
292
+ "minimum": 0
293
+ },
294
+ "FacetColour": {
295
+ "title": "FacetColour",
296
+ "description": "A colour **name**, resolved by each consumer against its own palette — never a hex value or any other literal. Two reasons, and both are about the consumer rather than the holder. A literal cannot be legible in a terminal, in a light theme and in a dark one at once, so a stored `#8B0000` is a colour that is wrong somewhere and the holder has no way to know where. And a consumer that reserves colours to mean something — an error, a warning, an irreversible act — must be able to keep a holder's decorative choice out of that channel; it cannot do that with an arbitrary value, and it can do it trivially with a closed set it maps itself. The eight members are chosen to be distinguishable from one another and deliberately carry no status connotation: none is named for success, warning or danger.",
297
+ "type": "string",
298
+ "enum": [
299
+ "slate",
300
+ "indigo",
301
+ "teal",
302
+ "moss",
303
+ "sand",
304
+ "clay",
305
+ "rose",
306
+ "plum"
307
+ ]
308
+ }
309
+ }
310
+ } as const;
311
+
312
+ /**
313
+ * SPEC.md §7.2 policy for the request variant, from this specification's
314
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
315
+ * per-specification and cannot be derived from the document alone, and
316
+ * item 2 needs the schema this carries.
317
+ */
318
+ export const SPEC = {
319
+ typeUri: TYPE_URI,
320
+ isBearer: false,
321
+ isProofRequired: true,
322
+ isRecipientRequired: true,
323
+ isIssuedAtRequired: true,
324
+ payloadSchema: PAYLOAD_SCHEMA,
325
+ } as const;
326
+
327
+ /**
328
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
329
+ * tracks the *issuer* party's requirement because a response swaps the
330
+ * parties (§7.3 item 5).
331
+ */
332
+ export const RESPONSE_SPEC = {
333
+ typeUri: RESPONSE_TYPE_URI,
334
+ isBearer: false,
335
+ isProofRequired: true,
336
+ isRecipientRequired: true,
337
+ isIssuedAtRequired: true,
338
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
339
+ } as const;
@@ -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;