@openvtc/trust-tasks 0.16.5 → 0.16.7

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 (60) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/_shared/components.d.ts +79 -4
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/device/list/0.1/payload.d.ts +8 -8
  5. package/dist/device/list/0.1/payload.d.ts.map +1 -1
  6. package/dist/device/list/0.1/payload.js +12 -4
  7. package/dist/device/list/0.1/payload.js.map +1 -1
  8. package/dist/device/list/0.2/payload.d.ts +8 -8
  9. package/dist/device/list/0.2/payload.d.ts.map +1 -1
  10. package/dist/device/list/0.2/payload.js +12 -4
  11. package/dist/device/list/0.2/payload.js.map +1 -1
  12. package/dist/device/register/0.1/payload.d.ts +8 -8
  13. package/dist/device/register/0.1/payload.d.ts.map +1 -1
  14. package/dist/device/register/0.1/payload.js +12 -4
  15. package/dist/device/register/0.1/payload.js.map +1 -1
  16. package/dist/device/register/0.2/payload.d.ts +8 -8
  17. package/dist/device/register/0.2/payload.d.ts.map +1 -1
  18. package/dist/device/register/0.2/payload.js +12 -4
  19. package/dist/device/register/0.2/payload.js.map +1 -1
  20. package/dist/index.d.ts +6 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +6 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/rooms/_shared/0.1/room.d.ts +16 -0
  25. package/dist/rooms/_shared/0.1/room.d.ts.map +1 -0
  26. package/dist/rooms/_shared/0.1/room.js +6 -0
  27. package/dist/rooms/_shared/0.1/room.js.map +1 -0
  28. package/dist/rooms/create/0.1/payload.d.ts +305 -0
  29. package/dist/rooms/create/0.1/payload.d.ts.map +1 -0
  30. package/dist/rooms/create/0.1/payload.js +176 -0
  31. package/dist/rooms/create/0.1/payload.js.map +1 -0
  32. package/dist/rooms/epoch/mint/0.1/payload.d.ts +385 -0
  33. package/dist/rooms/epoch/mint/0.1/payload.d.ts.map +1 -0
  34. package/dist/rooms/epoch/mint/0.1/payload.js +214 -0
  35. package/dist/rooms/epoch/mint/0.1/payload.js.map +1 -0
  36. package/dist/rooms/records/get/0.1/payload.d.ts +505 -0
  37. package/dist/rooms/records/get/0.1/payload.d.ts.map +1 -0
  38. package/dist/rooms/records/get/0.1/payload.js +279 -0
  39. package/dist/rooms/records/get/0.1/payload.js.map +1 -0
  40. package/dist/rooms/records/list/0.1/payload.d.ts +618 -0
  41. package/dist/rooms/records/list/0.1/payload.d.ts.map +1 -0
  42. package/dist/rooms/records/list/0.1/payload.js +338 -0
  43. package/dist/rooms/records/list/0.1/payload.js.map +1 -0
  44. package/dist/rooms/records/put/0.1/payload.d.ts +591 -0
  45. package/dist/rooms/records/put/0.1/payload.d.ts.map +1 -0
  46. package/dist/rooms/records/put/0.1/payload.js +314 -0
  47. package/dist/rooms/records/put/0.1/payload.js.map +1 -0
  48. package/package.json +1 -1
  49. package/src/_shared/components.ts +95 -4
  50. package/src/device/list/0.1/payload.ts +12 -4
  51. package/src/device/list/0.2/payload.ts +12 -4
  52. package/src/device/register/0.1/payload.ts +12 -4
  53. package/src/device/register/0.2/payload.ts +12 -4
  54. package/src/index.ts +6 -0
  55. package/src/rooms/_shared/0.1/room.ts +17 -0
  56. package/src/rooms/create/0.1/payload.ts +224 -0
  57. package/src/rooms/epoch/mint/0.1/payload.ts +262 -0
  58. package/src/rooms/records/get/0.1/payload.ts +333 -0
  59. package/src/rooms/records/list/0.1/payload.ts +397 -0
  60. package/src/rooms/records/put/0.1/payload.ts +388 -0
@@ -0,0 +1,388 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/rooms/records/put/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { AuthorityPresentation, Ext, SealedRecord } from "../../../../_shared/components.js";
7
+
8
+
9
+ export interface RoomsRecordsPutPayload {
10
+ /**
11
+ * The room's identifier. A host verifies the presentation against credentials issued by this identifier, never against a member list of its own — which is what lets a room move hosts without reissuing a credential.
12
+ */
13
+ roomId: string;
14
+ /**
15
+ * The record's key within the room. MUST be opaque on an `attributed` or `private` room; see RecordMetadata.key.
16
+ */
17
+ key: string;
18
+ /**
19
+ * Must confer the `write` action at this room's scope.
20
+ */
21
+ presentation: AuthorityPresentation;
22
+ /**
23
+ * Optional precondition. Omit to overwrite unconditionally; `0` means create-only and fails if the key exists. On mismatch the host returns `rooms/records/put:versionConflict` CARRYING THE CURRENT VERSION AND RECORD — a bare rejection would force a re-read, and between rejection and re-read the record can change again, so the pattern has no fixed point under contention.
24
+ */
25
+ expectedVersion?: number;
26
+ /**
27
+ * REQUIRED on an `attributed` or `private` room. Mutually exclusive with `cleartext`.
28
+ */
29
+ sealed?: SealedRecord;
30
+ /**
31
+ * REQUIRED on an `open` room, where the host reads records and can therefore search them. Mutually exclusive with `sealed`.
32
+ */
33
+ cleartext?: {
34
+ title?: string;
35
+ description?: string;
36
+ body: string;
37
+ /**
38
+ * @maxItems 32
39
+ */
40
+ tags?: string[];
41
+ };
42
+ /**
43
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
44
+ */
45
+ ext?: Ext;
46
+ }
47
+ /**
48
+ * Success response to rooms/records/put. Type https://trusttasks.org/spec/rooms/records/put/0.1#response.
49
+ */
50
+ export interface RoomsRecordsPutResponsePayload {
51
+ /**
52
+ * The stored record's key.
53
+ */
54
+ key: string;
55
+ /**
56
+ * The version assigned, monotonic per room.
57
+ */
58
+ version: number;
59
+ /**
60
+ * The epoch the record was stored under.
61
+ */
62
+ epoch?: number;
63
+ ext?: Ext;
64
+ }
65
+
66
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
67
+ export type { AuthorityPresentation, Ext, SealedRecord };
68
+
69
+ /** Trust Task type URI. */
70
+ export const TYPE_URI = "https://trusttasks.org/spec/rooms/records/put/0.1" as const;
71
+
72
+ /** Stable alias for this specification's request payload shape. */
73
+ export type Payload = RoomsRecordsPutPayload;
74
+
75
+ /** Trust Task response type URI (request type URI + "#response"). */
76
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/records/put/0.1#response" as const;
77
+
78
+ /** Stable alias for this specification's success-response payload shape. */
79
+ export type Response = RoomsRecordsPutResponsePayload;
80
+
81
+ /**
82
+ * This specification's payload schema, as a value.
83
+ *
84
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
85
+ * rather than only as a `.json` file because TypeScript types are erased
86
+ * at runtime: without a schema a consumer has nothing to validate, and
87
+ * every REQUIRED payload member is optional in practice. Cross-file
88
+ * `$ref`s are already inlined, so it needs no resolver.
89
+ */
90
+ export const PAYLOAD_SCHEMA = {
91
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
92
+ "$id": "https://trusttasks.org/spec/rooms/records/put/0.1",
93
+ "title": "Rooms Records Put — payload",
94
+ "type": "object",
95
+ "additionalProperties": false,
96
+ "required": [
97
+ "roomId",
98
+ "key",
99
+ "presentation"
100
+ ],
101
+ "properties": {
102
+ "roomId": {
103
+ "type": "string",
104
+ "description": "The room's identifier. A host verifies the presentation against credentials issued by this identifier, never against a member list of its own — which is what lets a room move hosts without reissuing a credential."
105
+ },
106
+ "key": {
107
+ "type": "string",
108
+ "maxLength": 512,
109
+ "description": "The record's key within the room. MUST be opaque on an `attributed` or `private` room; see RecordMetadata.key."
110
+ },
111
+ "presentation": {
112
+ "$ref": "#/$defs/AuthorityPresentation",
113
+ "description": "Must confer the `write` action at this room's scope."
114
+ },
115
+ "expectedVersion": {
116
+ "type": "integer",
117
+ "minimum": 0,
118
+ "description": "Optional precondition. Omit to overwrite unconditionally; `0` means create-only and fails if the key exists. On mismatch the host returns `rooms/records/put:versionConflict` CARRYING THE CURRENT VERSION AND RECORD — a bare rejection would force a re-read, and between rejection and re-read the record can change again, so the pattern has no fixed point under contention."
119
+ },
120
+ "sealed": {
121
+ "$ref": "#/$defs/SealedRecord",
122
+ "description": "REQUIRED on an `attributed` or `private` room. Mutually exclusive with `cleartext`."
123
+ },
124
+ "cleartext": {
125
+ "type": "object",
126
+ "additionalProperties": false,
127
+ "required": [
128
+ "body"
129
+ ],
130
+ "description": "REQUIRED on an `open` room, where the host reads records and can therefore search them. Mutually exclusive with `sealed`.",
131
+ "properties": {
132
+ "title": {
133
+ "type": "string",
134
+ "maxLength": 512
135
+ },
136
+ "description": {
137
+ "type": "string",
138
+ "maxLength": 2048
139
+ },
140
+ "body": {
141
+ "type": "string",
142
+ "maxLength": 1048576
143
+ },
144
+ "tags": {
145
+ "type": "array",
146
+ "items": {
147
+ "type": "string",
148
+ "maxLength": 64
149
+ },
150
+ "maxItems": 32
151
+ }
152
+ }
153
+ },
154
+ "ext": {
155
+ "$ref": "#/$defs/Ext",
156
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
157
+ }
158
+ },
159
+ "$defs": {
160
+ "Response": {
161
+ "$anchor": "response",
162
+ "title": "Rooms Records Put — response payload",
163
+ "description": "Success response to rooms/records/put. Type https://trusttasks.org/spec/rooms/records/put/0.1#response.",
164
+ "type": "object",
165
+ "additionalProperties": false,
166
+ "required": [
167
+ "key",
168
+ "version"
169
+ ],
170
+ "properties": {
171
+ "key": {
172
+ "type": "string",
173
+ "description": "The stored record's key."
174
+ },
175
+ "version": {
176
+ "type": "integer",
177
+ "minimum": 1,
178
+ "description": "The version assigned, monotonic per room."
179
+ },
180
+ "epoch": {
181
+ "type": "integer",
182
+ "minimum": 1,
183
+ "description": "The epoch the record was stored under."
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
+ "AuthorityPresentation": {
227
+ "title": "AuthorityPresentation",
228
+ "type": "object",
229
+ "additionalProperties": false,
230
+ "required": [
231
+ "membership",
232
+ "authority"
233
+ ],
234
+ "description": "What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier.",
235
+ "properties": {
236
+ "membership": {
237
+ "type": "string",
238
+ "description": "The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile."
239
+ },
240
+ "authority": {
241
+ "type": "array",
242
+ "minItems": 1,
243
+ "maxItems": 8,
244
+ "items": {
245
+ "type": "string"
246
+ },
247
+ "description": "The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent."
248
+ },
249
+ "subjectBinding": {
250
+ "type": "string",
251
+ "description": "REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this."
252
+ }
253
+ }
254
+ }
255
+ }
256
+ } as const;
257
+
258
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
259
+ export const RESPONSE_PAYLOAD_SCHEMA = {
260
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
261
+ "$ref": "#/$defs/Response",
262
+ "$defs": {
263
+ "Response": {
264
+ "$anchor": "response",
265
+ "title": "Rooms Records Put — response payload",
266
+ "description": "Success response to rooms/records/put. Type https://trusttasks.org/spec/rooms/records/put/0.1#response.",
267
+ "type": "object",
268
+ "additionalProperties": false,
269
+ "required": [
270
+ "key",
271
+ "version"
272
+ ],
273
+ "properties": {
274
+ "key": {
275
+ "type": "string",
276
+ "description": "The stored record's key."
277
+ },
278
+ "version": {
279
+ "type": "integer",
280
+ "minimum": 1,
281
+ "description": "The version assigned, monotonic per room."
282
+ },
283
+ "epoch": {
284
+ "type": "integer",
285
+ "minimum": 1,
286
+ "description": "The epoch the record was stored under."
287
+ },
288
+ "ext": {
289
+ "$ref": "#/$defs/Ext"
290
+ }
291
+ }
292
+ },
293
+ "Ext": {
294
+ "title": "Ext",
295
+ "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.",
296
+ "type": "object",
297
+ "minProperties": 1,
298
+ "additionalProperties": true,
299
+ "propertyNames": {
300
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
301
+ }
302
+ },
303
+ "SealedRecord": {
304
+ "title": "SealedRecord",
305
+ "type": "object",
306
+ "additionalProperties": false,
307
+ "required": [
308
+ "ciphertext",
309
+ "nonce",
310
+ "epoch"
311
+ ],
312
+ "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.",
313
+ "properties": {
314
+ "ciphertext": {
315
+ "type": "string",
316
+ "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."
317
+ },
318
+ "nonce": {
319
+ "type": "string",
320
+ "description": "AEAD nonce, base64url."
321
+ },
322
+ "epoch": {
323
+ "type": "integer",
324
+ "minimum": 1,
325
+ "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."
326
+ }
327
+ }
328
+ },
329
+ "AuthorityPresentation": {
330
+ "title": "AuthorityPresentation",
331
+ "type": "object",
332
+ "additionalProperties": false,
333
+ "required": [
334
+ "membership",
335
+ "authority"
336
+ ],
337
+ "description": "What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier.",
338
+ "properties": {
339
+ "membership": {
340
+ "type": "string",
341
+ "description": "The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile."
342
+ },
343
+ "authority": {
344
+ "type": "array",
345
+ "minItems": 1,
346
+ "maxItems": 8,
347
+ "items": {
348
+ "type": "string"
349
+ },
350
+ "description": "The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent."
351
+ },
352
+ "subjectBinding": {
353
+ "type": "string",
354
+ "description": "REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this."
355
+ }
356
+ }
357
+ }
358
+ }
359
+ } as const;
360
+
361
+ /**
362
+ * SPEC.md §7.2 policy for the request variant, from this specification's
363
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
364
+ * per-specification and cannot be derived from the document alone, and
365
+ * item 2 needs the schema this carries.
366
+ */
367
+ export const SPEC = {
368
+ typeUri: TYPE_URI,
369
+ isBearer: false,
370
+ isProofRequired: true,
371
+ isRecipientRequired: true,
372
+ isIssuedAtRequired: true,
373
+ payloadSchema: PAYLOAD_SCHEMA,
374
+ } as const;
375
+
376
+ /**
377
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
378
+ * tracks the *issuer* party's requirement because a response swaps the
379
+ * parties (§7.3 item 5).
380
+ */
381
+ export const RESPONSE_SPEC = {
382
+ typeUri: RESPONSE_TYPE_URI,
383
+ isBearer: false,
384
+ isProofRequired: true,
385
+ isRecipientRequired: true,
386
+ isIssuedAtRequired: true,
387
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
388
+ } as const;