@openvtc/trust-tasks 0.17.7 → 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.
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/rooms/owner/register/0.1/payload.schema.json
4
+ */
5
+ /** Trust Task type URI. */
6
+ export const TYPE_URI = "https://trusttasks.org/spec/rooms/owner/register/0.1";
7
+ /** Trust Task response type URI (request type URI + "#response"). */
8
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/owner/register/0.1#response";
9
+ /**
10
+ * This specification's payload schema, as a value.
11
+ *
12
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
13
+ * rather than only as a `.json` file because TypeScript types are erased
14
+ * at runtime: without a schema a consumer has nothing to validate, and
15
+ * every REQUIRED payload member is optional in practice. Cross-file
16
+ * `$ref`s are already inlined, so it needs no resolver.
17
+ */
18
+ export const PAYLOAD_SCHEMA = {
19
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
20
+ "$id": "https://trusttasks.org/spec/rooms/owner/register/0.1",
21
+ "title": "Rooms Owner Register — payload",
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": [
25
+ "roomId",
26
+ "host",
27
+ "visibility"
28
+ ],
29
+ "properties": {
30
+ "roomId": {
31
+ "type": "string",
32
+ "description": "The room being registered. Its identity exists already — this asks a host to store it, not to name it."
33
+ },
34
+ "host": {
35
+ "type": "string",
36
+ "description": "The host to register with, as a DID. Named by the caller because a room has no host until this call succeeds, and because a room may be registered with more than one (a mirror serves reads while its primary takes writes)."
37
+ },
38
+ "visibility": {
39
+ "$ref": "#/$defs/Visibility",
40
+ "description": "The tier to create the room at. Passed through to `rooms/create`, whose description of the choice governs."
41
+ },
42
+ "ownerDid": {
43
+ "type": "string",
44
+ "description": "The accountable party. Absent means the caller — a registration is normally made by the owner it names, and defaulting saves a surface repeating the DID it just authenticated as. Present and different is legitimate: an operator registering on behalf of the party who will answer for the room."
45
+ },
46
+ "retentionPolicy": {
47
+ "$ref": "#/$defs/RetentionPolicy",
48
+ "description": "Whether the room keeps its history readable across a membership change. Immutable once set, so a caller that omits it is taking the host's default for the life of the room."
49
+ },
50
+ "retentionDays": {
51
+ "type": "integer",
52
+ "minimum": 1,
53
+ "description": "How long the host is asked to hold the room after it lapses."
54
+ },
55
+ "ext": {
56
+ "$ref": "#/$defs/Ext",
57
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
58
+ }
59
+ },
60
+ "$defs": {
61
+ "Response": {
62
+ "$anchor": "response",
63
+ "title": "Rooms Owner Register — response payload",
64
+ "description": "Success response to rooms/owner/register. Type https://trusttasks.org/spec/rooms/owner/register/0.1#response.",
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "required": [
68
+ "roomId",
69
+ "host",
70
+ "epoch"
71
+ ],
72
+ "properties": {
73
+ "roomId": {
74
+ "type": "string"
75
+ },
76
+ "host": {
77
+ "type": "string",
78
+ "description": "The host that accepted it, echoed so a caller recording where its room lives records what the recipient actually reached rather than what it asked for."
79
+ },
80
+ "epoch": {
81
+ "type": "integer",
82
+ "minimum": 1,
83
+ "description": "The epoch the room now stands at, as the host reports it. `1` for a room registered for the first time."
84
+ },
85
+ "ext": {
86
+ "$ref": "#/$defs/Ext"
87
+ }
88
+ }
89
+ },
90
+ "Ext": {
91
+ "title": "Ext",
92
+ "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.",
93
+ "type": "object",
94
+ "minProperties": 1,
95
+ "additionalProperties": true,
96
+ "propertyNames": {
97
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
98
+ }
99
+ },
100
+ "RetentionPolicy": {
101
+ "title": "RetentionPolicy",
102
+ "type": "string",
103
+ "enum": [
104
+ "chained",
105
+ "fromJoin"
106
+ ],
107
+ "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.",
108
+ "$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."
109
+ },
110
+ "Visibility": {
111
+ "title": "Visibility",
112
+ "type": "string",
113
+ "enum": [
114
+ "open",
115
+ "attributed",
116
+ "private"
117
+ ],
118
+ "description": "How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything."
119
+ }
120
+ }
121
+ };
122
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
123
+ export const RESPONSE_PAYLOAD_SCHEMA = {
124
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
125
+ "$ref": "#/$defs/Response",
126
+ "$defs": {
127
+ "Response": {
128
+ "$anchor": "response",
129
+ "title": "Rooms Owner Register — response payload",
130
+ "description": "Success response to rooms/owner/register. Type https://trusttasks.org/spec/rooms/owner/register/0.1#response.",
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "required": [
134
+ "roomId",
135
+ "host",
136
+ "epoch"
137
+ ],
138
+ "properties": {
139
+ "roomId": {
140
+ "type": "string"
141
+ },
142
+ "host": {
143
+ "type": "string",
144
+ "description": "The host that accepted it, echoed so a caller recording where its room lives records what the recipient actually reached rather than what it asked for."
145
+ },
146
+ "epoch": {
147
+ "type": "integer",
148
+ "minimum": 1,
149
+ "description": "The epoch the room now stands at, as the host reports it. `1` for a room registered for the first time."
150
+ },
151
+ "ext": {
152
+ "$ref": "#/$defs/Ext"
153
+ }
154
+ }
155
+ },
156
+ "Ext": {
157
+ "title": "Ext",
158
+ "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.",
159
+ "type": "object",
160
+ "minProperties": 1,
161
+ "additionalProperties": true,
162
+ "propertyNames": {
163
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
164
+ }
165
+ },
166
+ "RetentionPolicy": {
167
+ "title": "RetentionPolicy",
168
+ "type": "string",
169
+ "enum": [
170
+ "chained",
171
+ "fromJoin"
172
+ ],
173
+ "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.",
174
+ "$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."
175
+ },
176
+ "Visibility": {
177
+ "title": "Visibility",
178
+ "type": "string",
179
+ "enum": [
180
+ "open",
181
+ "attributed",
182
+ "private"
183
+ ],
184
+ "description": "How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything."
185
+ }
186
+ }
187
+ };
188
+ /**
189
+ * SPEC.md §7.2 policy for the request variant, from this specification's
190
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
191
+ * per-specification and cannot be derived from the document alone, and
192
+ * item 2 needs the schema this carries.
193
+ */
194
+ export const SPEC = {
195
+ typeUri: TYPE_URI,
196
+ isBearer: false,
197
+ isProofRequired: true,
198
+ isRecipientRequired: true,
199
+ isIssuedAtRequired: true,
200
+ payloadSchema: PAYLOAD_SCHEMA,
201
+ };
202
+ /**
203
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
204
+ * tracks the *issuer* party's requirement because a response swaps the
205
+ * parties (§7.3 item 5).
206
+ */
207
+ export const RESPONSE_SPEC = {
208
+ typeUri: RESPONSE_TYPE_URI,
209
+ isBearer: false,
210
+ isProofRequired: true,
211
+ isRecipientRequired: true,
212
+ isIssuedAtRequired: true,
213
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
214
+ };
215
+ //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../../../src/rooms/owner/register/0.1/payload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsDH,2BAA2B;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,sDAA+D,CAAC;AAKxF,qEAAqE;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAG,+DAAwE,CAAC;AAK1G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,8CAA8C;IACzD,KAAK,EAAE,sDAAsD;I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ACL,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,uKAAuK;YACtL,MAAM,EAAE,QAAQ;YAChB,eAAe,EAAE,CAAC;YAClB,sBAAsB,EAAE,IAAI;YAC5B,eAAe,EAAE;gBACf,SAAS,EAAE,mCAAmC;aAC/C;SACF;QACD,iBAAiB,EAAE;YACjB,OAAO,EAAE,iBAAiB;YAC1B,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,SAAS;gBACT,UAAU;aACX;YACD,aAAa,EAAE,6iCAA6iC;YAC5jC,UAAU,EAAE,4YAA4Y;SACzZ;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,YAAY;YACrB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,MAAM;gBACN,YAAY;gBACZ,SAAS;aACV;YACD,aAAa,EAAE,8gBAA8gB;SAC9hB;KACF;CACO,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE,cAAc;CACrB,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE,uBAAuB;CAC9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openvtc/trust-tasks",
3
- "version": "0.17.7",
3
+ "version": "0.17.8",
4
4
  "description": "Generated TypeScript bindings for the Trust Tasks framework registry.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -233,6 +233,7 @@ 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";
236
237
  export * as RoomsKeysChain_v0_1 from "./rooms/keys/chain/0.1/payload.js";
237
238
  export * as RoomsKeysCommit_v0_1 from "./rooms/keys/commit/0.1/payload.js";
238
239
  export * as RoomsKeysKeyPackage_v0_1 from "./rooms/keys/key-package/0.1/payload.js";
@@ -245,6 +246,7 @@ export * as RoomsOwnerClaim_v0_1 from "./rooms/owner/claim/0.1/payload.js";
245
246
  export * as RoomsOwnerInvite_v0_1 from "./rooms/owner/invite/0.1/payload.js";
246
247
  export * as RoomsOwnerIssueAuthority_v0_1 from "./rooms/owner/issue-authority/0.1/payload.js";
247
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";
248
250
  export * as RoomsOwnerTransfer_v0_1 from "./rooms/owner/transfer/0.1/payload.js";
249
251
  export * as RoomsRecordsCurate_v0_1 from "./rooms/records/curate/0.1/payload.js";
250
252
  export * as RoomsRecordsGet_v0_1 from "./rooms/records/get/0.1/payload.js";
@@ -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;