@openvtc/trust-tasks 0.26.2 → 0.26.4
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.
- package/CHANGELOG.md +48 -0
- package/dist/_shared/components.d.ts +47 -0
- package/dist/_shared/components.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/rooms/_shared/0.1/blobs.d.ts +1 -1
- package/dist/rooms/_shared/0.1/blobs.d.ts.map +1 -1
- package/dist/rooms/blobs/get/0.2/payload.d.ts +1005 -0
- package/dist/rooms/blobs/get/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/blobs/get/0.2/payload.js +559 -0
- package/dist/rooms/blobs/get/0.2/payload.js.map +1 -0
- package/dist/rooms/blobs/upload/abort/0.2/payload.d.ts +263 -0
- package/dist/rooms/blobs/upload/abort/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/blobs/upload/abort/0.2/payload.js +151 -0
- package/dist/rooms/blobs/upload/abort/0.2/payload.js.map +1 -0
- package/dist/rooms/blobs/upload/begin/0.2/payload.d.ts +1191 -0
- package/dist/rooms/blobs/upload/begin/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/blobs/upload/begin/0.2/payload.js +659 -0
- package/dist/rooms/blobs/upload/begin/0.2/payload.js.map +1 -0
- package/dist/rooms/blobs/upload/chunk/0.2/payload.d.ts +459 -0
- package/dist/rooms/blobs/upload/chunk/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/blobs/upload/chunk/0.2/payload.js +256 -0
- package/dist/rooms/blobs/upload/chunk/0.2/payload.js.map +1 -0
- package/dist/rooms/blobs/upload/commit/0.2/payload.d.ts +326 -0
- package/dist/rooms/blobs/upload/commit/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/blobs/upload/commit/0.2/payload.js +185 -0
- package/dist/rooms/blobs/upload/commit/0.2/payload.js.map +1 -0
- package/dist/rooms/keys/act/0.1/payload.d.ts +546 -0
- package/dist/rooms/keys/act/0.1/payload.d.ts.map +1 -0
- package/dist/rooms/keys/act/0.1/payload.js +305 -0
- package/dist/rooms/keys/act/0.1/payload.js.map +1 -0
- package/dist/rooms/keys/seal/0.2/payload.d.ts +368 -0
- package/dist/rooms/keys/seal/0.2/payload.d.ts.map +1 -0
- package/dist/rooms/keys/seal/0.2/payload.js +205 -0
- package/dist/rooms/keys/seal/0.2/payload.js.map +1 -0
- package/package.json +1 -1
- package/src/_shared/components.ts +47 -0
- package/src/index.ts +7 -0
- package/src/rooms/_shared/0.1/blobs.ts +1 -1
- package/src/rooms/blobs/get/0.2/payload.ts +625 -0
- package/src/rooms/blobs/upload/abort/0.2/payload.ts +187 -0
- package/src/rooms/blobs/upload/begin/0.2/payload.ts +731 -0
- package/src/rooms/blobs/upload/chunk/0.2/payload.ts +304 -0
- package/src/rooms/blobs/upload/commit/0.2/payload.ts +224 -0
- package/src/rooms/keys/act/0.1/payload.ts +380 -0
- package/src/rooms/keys/seal/0.2/payload.ts +256 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/rooms/keys/act/0.1/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Ext } from "../../../../_shared/components.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A member's own client asks the member's key holder to complete one host-bound room request as the member: the member's own authority narrowed to the one action the request's type needs, the member as issuer, and the member's signature. The outer document members are owned by the framework — SPEC §6.3.
|
|
11
|
+
*/
|
|
12
|
+
export interface RoomsKeysActPayload {
|
|
13
|
+
document: UnsignedRoomRequest;
|
|
14
|
+
/**
|
|
15
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1.
|
|
16
|
+
*/
|
|
17
|
+
ext?: Ext;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The room request to complete, as the client will send it, minus its presentation and its proof.
|
|
21
|
+
*/
|
|
22
|
+
export interface UnsignedRoomRequest {
|
|
23
|
+
/**
|
|
24
|
+
* The request's identifier, set by the client. The host keys duplicate-execution protection on it.
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/**
|
|
28
|
+
* The room request's Type URI. Only the types in this task's table are completed; any other is `typeNotActable`.
|
|
29
|
+
*/
|
|
30
|
+
type: string;
|
|
31
|
+
/**
|
|
32
|
+
* The member to act as. Optional where the caller may act as exactly one member of the room; REQUIRED where it may act as more. Never the client's own identifier.
|
|
33
|
+
*/
|
|
34
|
+
issuer?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The room's host, which the completed document is for. Covered by the member's proof.
|
|
37
|
+
*/
|
|
38
|
+
recipient: string;
|
|
39
|
+
issuedAt: string;
|
|
40
|
+
expiresAt?: string;
|
|
41
|
+
threadId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, and refuses a payload that already carries one.
|
|
44
|
+
*/
|
|
45
|
+
payload: {};
|
|
46
|
+
ext?: Ext;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.1#response. The request, completed as the member, for the caller to send to its recipient unaltered.
|
|
50
|
+
*/
|
|
51
|
+
export interface RoomsKeysActResponsePayload {
|
|
52
|
+
/**
|
|
53
|
+
* The member the recipient signed as: the completed document's `issuer`.
|
|
54
|
+
*/
|
|
55
|
+
principal: string;
|
|
56
|
+
/**
|
|
57
|
+
* The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.
|
|
58
|
+
*/
|
|
59
|
+
document: {};
|
|
60
|
+
/**
|
|
61
|
+
* When the inserted presentation's leaf lapses. Absent when the type takes no presentation.
|
|
62
|
+
*/
|
|
63
|
+
expiresAt?: string;
|
|
64
|
+
ext?: Ext;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Shared definitions this specification references, re-exported under the names it used to declare them with. */
|
|
68
|
+
export type { Ext };
|
|
69
|
+
|
|
70
|
+
/** Trust Task type URI. */
|
|
71
|
+
export const TYPE_URI = "https://trusttasks.org/spec/rooms/keys/act/0.1" as const;
|
|
72
|
+
|
|
73
|
+
/** Stable alias for this specification's request payload shape. */
|
|
74
|
+
export type Payload = RoomsKeysActPayload;
|
|
75
|
+
|
|
76
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
77
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/keys/act/0.1#response" as const;
|
|
78
|
+
|
|
79
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
80
|
+
export type Response = RoomsKeysActResponsePayload;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* This specification's payload schema, as a value.
|
|
84
|
+
*
|
|
85
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
86
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
87
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
88
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
89
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
90
|
+
*/
|
|
91
|
+
export const PAYLOAD_SCHEMA = {
|
|
92
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
93
|
+
"$id": "https://trusttasks.org/spec/rooms/keys/act/0.1",
|
|
94
|
+
"title": "Rooms Keys Act — payload",
|
|
95
|
+
"description": "A member's own client asks the member's key holder to complete one host-bound room request as the member: the member's own authority narrowed to the one action the request's type needs, the member as issuer, and the member's signature. The outer document members are owned by the framework — SPEC §6.3.",
|
|
96
|
+
"type": "object",
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"required": [
|
|
99
|
+
"document"
|
|
100
|
+
],
|
|
101
|
+
"properties": {
|
|
102
|
+
"document": {
|
|
103
|
+
"$ref": "#/$defs/UnsignedRoomRequest",
|
|
104
|
+
"description": "The room request to complete, as the client will send it, minus its presentation and its proof."
|
|
105
|
+
},
|
|
106
|
+
"ext": {
|
|
107
|
+
"$ref": "#/$defs/Ext",
|
|
108
|
+
"description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"$defs": {
|
|
112
|
+
"UnsignedRoomRequest": {
|
|
113
|
+
"$anchor": "unsigned-room-request",
|
|
114
|
+
"title": "Unsigned room request",
|
|
115
|
+
"description": "A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.",
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"required": [
|
|
119
|
+
"id",
|
|
120
|
+
"type",
|
|
121
|
+
"recipient",
|
|
122
|
+
"issuedAt",
|
|
123
|
+
"payload"
|
|
124
|
+
],
|
|
125
|
+
"properties": {
|
|
126
|
+
"id": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"minLength": 1,
|
|
129
|
+
"maxLength": 512,
|
|
130
|
+
"description": "The request's identifier, set by the client. The host keys duplicate-execution protection on it."
|
|
131
|
+
},
|
|
132
|
+
"type": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"pattern": "^https://trusttasks\\.org/spec/rooms/",
|
|
135
|
+
"maxLength": 2048,
|
|
136
|
+
"description": "The room request's Type URI. Only the types in this task's table are completed; any other is `typeNotActable`."
|
|
137
|
+
},
|
|
138
|
+
"issuer": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"pattern": "^did:",
|
|
141
|
+
"maxLength": 2048,
|
|
142
|
+
"description": "The member to act as. Optional where the caller may act as exactly one member of the room; REQUIRED where it may act as more. Never the client's own identifier."
|
|
143
|
+
},
|
|
144
|
+
"recipient": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"pattern": "^did:",
|
|
147
|
+
"maxLength": 2048,
|
|
148
|
+
"description": "The room's host, which the completed document is for. Covered by the member's proof."
|
|
149
|
+
},
|
|
150
|
+
"issuedAt": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"format": "date-time"
|
|
153
|
+
},
|
|
154
|
+
"expiresAt": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"format": "date-time"
|
|
157
|
+
},
|
|
158
|
+
"threadId": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 1,
|
|
161
|
+
"maxLength": 512
|
|
162
|
+
},
|
|
163
|
+
"payload": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"description": "The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, and refuses a payload that already carries one."
|
|
166
|
+
},
|
|
167
|
+
"ext": {
|
|
168
|
+
"$ref": "#/$defs/Ext"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"not": {
|
|
172
|
+
"required": [
|
|
173
|
+
"proof"
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"Response": {
|
|
178
|
+
"$anchor": "response",
|
|
179
|
+
"title": "Rooms Keys Act — response payload",
|
|
180
|
+
"description": "Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.1#response. The request, completed as the member, for the caller to send to its recipient unaltered.",
|
|
181
|
+
"type": "object",
|
|
182
|
+
"additionalProperties": false,
|
|
183
|
+
"required": [
|
|
184
|
+
"principal",
|
|
185
|
+
"document"
|
|
186
|
+
],
|
|
187
|
+
"properties": {
|
|
188
|
+
"principal": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"pattern": "^did:",
|
|
191
|
+
"maxLength": 2048,
|
|
192
|
+
"description": "The member the recipient signed as: the completed document's `issuer`."
|
|
193
|
+
},
|
|
194
|
+
"document": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"required": [
|
|
197
|
+
"id",
|
|
198
|
+
"type",
|
|
199
|
+
"issuer",
|
|
200
|
+
"recipient",
|
|
201
|
+
"issuedAt",
|
|
202
|
+
"payload",
|
|
203
|
+
"proof"
|
|
204
|
+
],
|
|
205
|
+
"description": "The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged."
|
|
206
|
+
},
|
|
207
|
+
"expiresAt": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"format": "date-time",
|
|
210
|
+
"description": "When the inserted presentation's leaf lapses. Absent when the type takes no presentation."
|
|
211
|
+
},
|
|
212
|
+
"ext": {
|
|
213
|
+
"$ref": "#/$defs/Ext"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"Ext": {
|
|
218
|
+
"title": "Ext",
|
|
219
|
+
"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.",
|
|
220
|
+
"type": "object",
|
|
221
|
+
"minProperties": 1,
|
|
222
|
+
"additionalProperties": true,
|
|
223
|
+
"propertyNames": {
|
|
224
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} as const;
|
|
229
|
+
|
|
230
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
231
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
232
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
233
|
+
"$ref": "#/$defs/Response",
|
|
234
|
+
"$defs": {
|
|
235
|
+
"UnsignedRoomRequest": {
|
|
236
|
+
"$anchor": "unsigned-room-request",
|
|
237
|
+
"title": "Unsigned room request",
|
|
238
|
+
"description": "A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.",
|
|
239
|
+
"type": "object",
|
|
240
|
+
"additionalProperties": false,
|
|
241
|
+
"required": [
|
|
242
|
+
"id",
|
|
243
|
+
"type",
|
|
244
|
+
"recipient",
|
|
245
|
+
"issuedAt",
|
|
246
|
+
"payload"
|
|
247
|
+
],
|
|
248
|
+
"properties": {
|
|
249
|
+
"id": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"minLength": 1,
|
|
252
|
+
"maxLength": 512,
|
|
253
|
+
"description": "The request's identifier, set by the client. The host keys duplicate-execution protection on it."
|
|
254
|
+
},
|
|
255
|
+
"type": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"pattern": "^https://trusttasks\\.org/spec/rooms/",
|
|
258
|
+
"maxLength": 2048,
|
|
259
|
+
"description": "The room request's Type URI. Only the types in this task's table are completed; any other is `typeNotActable`."
|
|
260
|
+
},
|
|
261
|
+
"issuer": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"pattern": "^did:",
|
|
264
|
+
"maxLength": 2048,
|
|
265
|
+
"description": "The member to act as. Optional where the caller may act as exactly one member of the room; REQUIRED where it may act as more. Never the client's own identifier."
|
|
266
|
+
},
|
|
267
|
+
"recipient": {
|
|
268
|
+
"type": "string",
|
|
269
|
+
"pattern": "^did:",
|
|
270
|
+
"maxLength": 2048,
|
|
271
|
+
"description": "The room's host, which the completed document is for. Covered by the member's proof."
|
|
272
|
+
},
|
|
273
|
+
"issuedAt": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"format": "date-time"
|
|
276
|
+
},
|
|
277
|
+
"expiresAt": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"format": "date-time"
|
|
280
|
+
},
|
|
281
|
+
"threadId": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"minLength": 1,
|
|
284
|
+
"maxLength": 512
|
|
285
|
+
},
|
|
286
|
+
"payload": {
|
|
287
|
+
"type": "object",
|
|
288
|
+
"description": "The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, and refuses a payload that already carries one."
|
|
289
|
+
},
|
|
290
|
+
"ext": {
|
|
291
|
+
"$ref": "#/$defs/Ext"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"not": {
|
|
295
|
+
"required": [
|
|
296
|
+
"proof"
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"Response": {
|
|
301
|
+
"$anchor": "response",
|
|
302
|
+
"title": "Rooms Keys Act — response payload",
|
|
303
|
+
"description": "Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.1#response. The request, completed as the member, for the caller to send to its recipient unaltered.",
|
|
304
|
+
"type": "object",
|
|
305
|
+
"additionalProperties": false,
|
|
306
|
+
"required": [
|
|
307
|
+
"principal",
|
|
308
|
+
"document"
|
|
309
|
+
],
|
|
310
|
+
"properties": {
|
|
311
|
+
"principal": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"pattern": "^did:",
|
|
314
|
+
"maxLength": 2048,
|
|
315
|
+
"description": "The member the recipient signed as: the completed document's `issuer`."
|
|
316
|
+
},
|
|
317
|
+
"document": {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"required": [
|
|
320
|
+
"id",
|
|
321
|
+
"type",
|
|
322
|
+
"issuer",
|
|
323
|
+
"recipient",
|
|
324
|
+
"issuedAt",
|
|
325
|
+
"payload",
|
|
326
|
+
"proof"
|
|
327
|
+
],
|
|
328
|
+
"description": "The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged."
|
|
329
|
+
},
|
|
330
|
+
"expiresAt": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"format": "date-time",
|
|
333
|
+
"description": "When the inserted presentation's leaf lapses. Absent when the type takes no presentation."
|
|
334
|
+
},
|
|
335
|
+
"ext": {
|
|
336
|
+
"$ref": "#/$defs/Ext"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"Ext": {
|
|
341
|
+
"title": "Ext",
|
|
342
|
+
"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.",
|
|
343
|
+
"type": "object",
|
|
344
|
+
"minProperties": 1,
|
|
345
|
+
"additionalProperties": true,
|
|
346
|
+
"propertyNames": {
|
|
347
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
} as const;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
355
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
356
|
+
* per-specification and cannot be derived from the document alone, and
|
|
357
|
+
* item 2 needs the schema this carries.
|
|
358
|
+
*/
|
|
359
|
+
export const SPEC = {
|
|
360
|
+
typeUri: TYPE_URI,
|
|
361
|
+
isBearer: false,
|
|
362
|
+
isProofRequired: true,
|
|
363
|
+
isRecipientRequired: true,
|
|
364
|
+
isIssuedAtRequired: true,
|
|
365
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
366
|
+
} as const;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
370
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
371
|
+
* parties (§7.3 item 5).
|
|
372
|
+
*/
|
|
373
|
+
export const RESPONSE_SPEC = {
|
|
374
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
375
|
+
isBearer: false,
|
|
376
|
+
isProofRequired: true,
|
|
377
|
+
isRecipientRequired: true,
|
|
378
|
+
isIssuedAtRequired: true,
|
|
379
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
380
|
+
} as const;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/rooms/keys/seal/0.2/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Ext, SealedRecord } from "../../../../_shared/components.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface RoomsKeysSealPayload {
|
|
10
|
+
/**
|
|
11
|
+
* The room to seal for. The recipient MUST hold group state for it.
|
|
12
|
+
*/
|
|
13
|
+
roomId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The record key this will be stored under. Bound into the associated data, so a record sealed for one key does not open under another. On a sealed tier keys MUST be opaque — a descriptive key defeats the encryption beside it, and structured naming belongs inside the sealed body.
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
/**
|
|
19
|
+
* The version the writer INTENDS the record to take, bound into the associated data before the host assigns it. A caller that lets the host assign a different one will find the record does not open, which is the correct failure: accepting whatever came back would mean the binding commits to nothing. The shape that works is a create-only write (`expectedVersion: 0`) or a read of the current version before a rewrite.
|
|
20
|
+
*/
|
|
21
|
+
version: number;
|
|
22
|
+
/**
|
|
23
|
+
* The record body to seal, base64url: a SealedRecordBody. Without `signAsPrincipal`, already signed by its author. With it, the same object without `proof`, which the recipient signs as its `author` before sealing. Sealed whole rather than field by field: splitting it would let a host learn the shape of the material from ciphertext lengths.
|
|
24
|
+
*/
|
|
25
|
+
plaintext: string;
|
|
26
|
+
/**
|
|
27
|
+
* True asks the recipient to sign the body as its `author` — a member of this room the caller acts as — before sealing it. Only the principal's own client may set it; an agent under an attenuated chain signs its own body and never sets it. Absent means false: the recipient seals exactly the bytes it was given.
|
|
28
|
+
*/
|
|
29
|
+
signAsPrincipal?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1. MUST NOT carry record content.
|
|
32
|
+
*/
|
|
33
|
+
ext?: Ext;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Success response to rooms/keys/seal. Type https://trusttasks.org/spec/rooms/keys/seal/0.2#response. The sealed record, ready to hand to a host with rooms/records/put.
|
|
37
|
+
*/
|
|
38
|
+
export interface RoomsKeysSealResponsePayload {
|
|
39
|
+
sealed: SealedRecord;
|
|
40
|
+
ext?: Ext;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Shared definitions this specification references, re-exported under the names it used to declare them with. */
|
|
44
|
+
export type { Ext, SealedRecord };
|
|
45
|
+
|
|
46
|
+
/** Trust Task type URI. */
|
|
47
|
+
export const TYPE_URI = "https://trusttasks.org/spec/rooms/keys/seal/0.2" as const;
|
|
48
|
+
|
|
49
|
+
/** Stable alias for this specification's request payload shape. */
|
|
50
|
+
export type Payload = RoomsKeysSealPayload;
|
|
51
|
+
|
|
52
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
53
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/keys/seal/0.2#response" as const;
|
|
54
|
+
|
|
55
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
56
|
+
export type Response = RoomsKeysSealResponsePayload;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* This specification's payload schema, as a value.
|
|
60
|
+
*
|
|
61
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
62
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
63
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
64
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
65
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
66
|
+
*/
|
|
67
|
+
export const PAYLOAD_SCHEMA = {
|
|
68
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
69
|
+
"$id": "https://trusttasks.org/spec/rooms/keys/seal/0.2",
|
|
70
|
+
"title": "Rooms Keys Seal — payload",
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": [
|
|
74
|
+
"roomId",
|
|
75
|
+
"key",
|
|
76
|
+
"version",
|
|
77
|
+
"plaintext"
|
|
78
|
+
],
|
|
79
|
+
"properties": {
|
|
80
|
+
"roomId": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "The room to seal for. The recipient MUST hold group state for it."
|
|
83
|
+
},
|
|
84
|
+
"key": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"maxLength": 512,
|
|
87
|
+
"description": "The record key this will be stored under. Bound into the associated data, so a record sealed for one key does not open under another. On a sealed tier keys MUST be opaque — a descriptive key defeats the encryption beside it, and structured naming belongs inside the sealed body."
|
|
88
|
+
},
|
|
89
|
+
"version": {
|
|
90
|
+
"type": "integer",
|
|
91
|
+
"minimum": 0,
|
|
92
|
+
"description": "The version the writer INTENDS the record to take, bound into the associated data before the host assigns it. A caller that lets the host assign a different one will find the record does not open, which is the correct failure: accepting whatever came back would mean the binding commits to nothing. The shape that works is a create-only write (`expectedVersion: 0`) or a read of the current version before a rewrite."
|
|
93
|
+
},
|
|
94
|
+
"plaintext": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "The record body to seal, base64url: a SealedRecordBody. Without `signAsPrincipal`, already signed by its author. With it, the same object without `proof`, which the recipient signs as its `author` before sealing. Sealed whole rather than field by field: splitting it would let a host learn the shape of the material from ciphertext lengths.",
|
|
97
|
+
"pattern": "^[A-Za-z0-9_-]+$",
|
|
98
|
+
"minLength": 1
|
|
99
|
+
},
|
|
100
|
+
"signAsPrincipal": {
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"description": "True asks the recipient to sign the body as its `author` — a member of this room the caller acts as — before sealing it. Only the principal's own client may set it; an agent under an attenuated chain signs its own body and never sets it. Absent means false: the recipient seals exactly the bytes it was given."
|
|
103
|
+
},
|
|
104
|
+
"ext": {
|
|
105
|
+
"$ref": "#/$defs/Ext",
|
|
106
|
+
"description": "Ecosystem-defined extension members per SPEC.md §4.5.1. MUST NOT carry record content."
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"$defs": {
|
|
110
|
+
"Response": {
|
|
111
|
+
"$anchor": "response",
|
|
112
|
+
"title": "Rooms Keys Seal — response payload",
|
|
113
|
+
"description": "Success response to rooms/keys/seal. Type https://trusttasks.org/spec/rooms/keys/seal/0.2#response. The sealed record, ready to hand to a host with rooms/records/put.",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": false,
|
|
116
|
+
"required": [
|
|
117
|
+
"sealed"
|
|
118
|
+
],
|
|
119
|
+
"properties": {
|
|
120
|
+
"sealed": {
|
|
121
|
+
"$ref": "#/$defs/SealedRecord"
|
|
122
|
+
},
|
|
123
|
+
"ext": {
|
|
124
|
+
"$ref": "#/$defs/Ext"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"Ext": {
|
|
129
|
+
"title": "Ext",
|
|
130
|
+
"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.",
|
|
131
|
+
"type": "object",
|
|
132
|
+
"minProperties": 1,
|
|
133
|
+
"additionalProperties": true,
|
|
134
|
+
"propertyNames": {
|
|
135
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"SealedRecord": {
|
|
139
|
+
"title": "SealedRecord",
|
|
140
|
+
"type": "object",
|
|
141
|
+
"additionalProperties": false,
|
|
142
|
+
"required": [
|
|
143
|
+
"ciphertext",
|
|
144
|
+
"nonce",
|
|
145
|
+
"epoch"
|
|
146
|
+
],
|
|
147
|
+
"description": "A record as a host stores it on an `attributed` or `private` room. Title, description, body, author and tags are sealed together in one blob rather than separately: splitting them would let a host learn the shape of the material from ciphertext lengths, for no benefit, since a reader decrypts the whole record either way.",
|
|
148
|
+
"properties": {
|
|
149
|
+
"ciphertext": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "The sealed record, base64url. Bound by AEAD associated data to `roomId`, `key`, `version` and `epoch`, so a host that relocates it to another key, version, epoch or room produces a mismatch and the open fails. The record cannot be moved undetected even though the host holds every byte of it."
|
|
152
|
+
},
|
|
153
|
+
"nonce": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"description": "AEAD nonce, base64url."
|
|
156
|
+
},
|
|
157
|
+
"epoch": {
|
|
158
|
+
"type": "integer",
|
|
159
|
+
"minimum": 1,
|
|
160
|
+
"description": "The key epoch this record was sealed under. Cleartext because the host must serve the right ciphertext, and bound into the associated data so that relabelling it fails authentication rather than causing a reader to try the wrong key."
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} as const;
|
|
166
|
+
|
|
167
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
168
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
169
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
170
|
+
"$ref": "#/$defs/Response",
|
|
171
|
+
"$defs": {
|
|
172
|
+
"Response": {
|
|
173
|
+
"$anchor": "response",
|
|
174
|
+
"title": "Rooms Keys Seal — response payload",
|
|
175
|
+
"description": "Success response to rooms/keys/seal. Type https://trusttasks.org/spec/rooms/keys/seal/0.2#response. The sealed record, ready to hand to a host with rooms/records/put.",
|
|
176
|
+
"type": "object",
|
|
177
|
+
"additionalProperties": false,
|
|
178
|
+
"required": [
|
|
179
|
+
"sealed"
|
|
180
|
+
],
|
|
181
|
+
"properties": {
|
|
182
|
+
"sealed": {
|
|
183
|
+
"$ref": "#/$defs/SealedRecord"
|
|
184
|
+
},
|
|
185
|
+
"ext": {
|
|
186
|
+
"$ref": "#/$defs/Ext"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"Ext": {
|
|
191
|
+
"title": "Ext",
|
|
192
|
+
"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.",
|
|
193
|
+
"type": "object",
|
|
194
|
+
"minProperties": 1,
|
|
195
|
+
"additionalProperties": true,
|
|
196
|
+
"propertyNames": {
|
|
197
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"SealedRecord": {
|
|
201
|
+
"title": "SealedRecord",
|
|
202
|
+
"type": "object",
|
|
203
|
+
"additionalProperties": false,
|
|
204
|
+
"required": [
|
|
205
|
+
"ciphertext",
|
|
206
|
+
"nonce",
|
|
207
|
+
"epoch"
|
|
208
|
+
],
|
|
209
|
+
"description": "A record as a host stores it on an `attributed` or `private` room. Title, description, body, author and tags are sealed together in one blob rather than separately: splitting them would let a host learn the shape of the material from ciphertext lengths, for no benefit, since a reader decrypts the whole record either way.",
|
|
210
|
+
"properties": {
|
|
211
|
+
"ciphertext": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "The sealed record, base64url. Bound by AEAD associated data to `roomId`, `key`, `version` and `epoch`, so a host that relocates it to another key, version, epoch or room produces a mismatch and the open fails. The record cannot be moved undetected even though the host holds every byte of it."
|
|
214
|
+
},
|
|
215
|
+
"nonce": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"description": "AEAD nonce, base64url."
|
|
218
|
+
},
|
|
219
|
+
"epoch": {
|
|
220
|
+
"type": "integer",
|
|
221
|
+
"minimum": 1,
|
|
222
|
+
"description": "The key epoch this record was sealed under. Cleartext because the host must serve the right ciphertext, and bound into the associated data so that relabelling it fails authentication rather than causing a reader to try the wrong key."
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} as const;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
231
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
232
|
+
* per-specification and cannot be derived from the document alone, and
|
|
233
|
+
* item 2 needs the schema this carries.
|
|
234
|
+
*/
|
|
235
|
+
export const SPEC = {
|
|
236
|
+
typeUri: TYPE_URI,
|
|
237
|
+
isBearer: false,
|
|
238
|
+
isProofRequired: true,
|
|
239
|
+
isRecipientRequired: true,
|
|
240
|
+
isIssuedAtRequired: true,
|
|
241
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
242
|
+
} as const;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
246
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
247
|
+
* parties (§7.3 item 5).
|
|
248
|
+
*/
|
|
249
|
+
export const RESPONSE_SPEC = {
|
|
250
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
251
|
+
isBearer: false,
|
|
252
|
+
isProofRequired: true,
|
|
253
|
+
isRecipientRequired: true,
|
|
254
|
+
isIssuedAtRequired: true,
|
|
255
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
256
|
+
} as const;
|