@openvtc/trust-tasks 0.26.3 → 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 +38 -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,731 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/rooms/blobs/upload/begin/0.2/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { AuthorityPresentation, BlobManifest, ChunkCount, ChunkIndex, ChunkManifest, ChunkSize, DigestMultibase, ExpectedSizeBytes, ExpiresAt, Ext, PartPlan, TransferId, TransferMode, TransferTarget } from "../../../../../_shared/components.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Open an upload of one file's ciphertext into a data room, committing to its size and to the digest of every chunk before any byte moves, reserving room for it against every limit that applies, and saying how its bytes may move — straight to the room's storage, or through the host under a single-use upload key. The outer document members are owned by the framework — SPEC §6.3.
|
|
11
|
+
*/
|
|
12
|
+
export interface RoomsBlobsUploadBeginPayload {
|
|
13
|
+
/**
|
|
14
|
+
* The room the file is for. The host verifies the presentation against credentials this identifier issued, never against a member list of its own.
|
|
15
|
+
*/
|
|
16
|
+
roomId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Must confer the `write` action at this room's scope. Its leaf's subject must be the party the host authenticated for this request.
|
|
19
|
+
*/
|
|
20
|
+
presentation: AuthorityPresentation;
|
|
21
|
+
/**
|
|
22
|
+
* A did:key the producer generated for this upload alone, for a proxied transfer: it signs the upload's chunk, commit and abort documents, and nothing else, and the host never records it as the owner or the uploader. Ed25519 (`z6Mk…`) MUST be accepted. A producer that omits it accepts only direct transfer.
|
|
23
|
+
*/
|
|
24
|
+
uploadKey?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The ciphertext manifest. Its digest is the BlobRef the blob will have once committed.
|
|
27
|
+
*/
|
|
28
|
+
manifest: BlobManifest;
|
|
29
|
+
/**
|
|
30
|
+
* How the producer will cut the blob for direct transfer. Present means the producer accepts direct transfer; absent means it accepts only proxied.
|
|
31
|
+
*/
|
|
32
|
+
directParts?: PartPlan;
|
|
33
|
+
ext?: Ext;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Success response to rooms/blobs/upload/begin. Type https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2#response.
|
|
37
|
+
*/
|
|
38
|
+
export interface RoomsBlobsUploadBeginResponsePayload {
|
|
39
|
+
uploadId: TransferId;
|
|
40
|
+
/**
|
|
41
|
+
* How this upload's bytes move: `direct` to the room's storage over `targets`, or `proxied` through the host as rooms/blobs/upload/chunk documents signed by `uploadKey`.
|
|
42
|
+
*/
|
|
43
|
+
mode: TransferMode;
|
|
44
|
+
/**
|
|
45
|
+
* The indices the host does not yet hold, in ascending order: chunk indices in proxied mode, part indices in direct mode. Every index on a new upload; only what is left on a resumed one; none when `alreadyCommitted` is true. Empty means the upload can be committed.
|
|
46
|
+
*
|
|
47
|
+
* @maxItems 4096
|
|
48
|
+
*/
|
|
49
|
+
missing: ChunkIndex[];
|
|
50
|
+
expiresAt: ExpiresAt;
|
|
51
|
+
/**
|
|
52
|
+
* Direct mode only: a PUT target for each of some or all of the `missing` parts. A host MAY issue targets for only some of them; the producer begins again, with the identical manifest and plan, for the rest and for any whose target lapsed. Absent in proxied mode.
|
|
53
|
+
*
|
|
54
|
+
* @maxItems 128
|
|
55
|
+
*/
|
|
56
|
+
targets?: TransferTarget[];
|
|
57
|
+
/**
|
|
58
|
+
* True when the manifest's BlobRef is already committed in this room. `missing` is then empty, nothing was reserved, and commit returns the existing blob without charging it again. Absent or false on every other answer.
|
|
59
|
+
*/
|
|
60
|
+
alreadyCommitted?: boolean;
|
|
61
|
+
ext?: Ext;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Shared definitions this specification references, re-exported under the names it used to declare them with. */
|
|
65
|
+
export type { AuthorityPresentation, BlobManifest, ChunkCount, ChunkIndex, ChunkManifest, ChunkSize, DigestMultibase, ExpectedSizeBytes, ExpiresAt, Ext, PartPlan, TransferId, TransferMode, TransferTarget };
|
|
66
|
+
|
|
67
|
+
/** Trust Task type URI. */
|
|
68
|
+
export const TYPE_URI = "https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2" as const;
|
|
69
|
+
|
|
70
|
+
/** Stable alias for this specification's request payload shape. */
|
|
71
|
+
export type Payload = RoomsBlobsUploadBeginPayload;
|
|
72
|
+
|
|
73
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
74
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2#response" as const;
|
|
75
|
+
|
|
76
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
77
|
+
export type Response = RoomsBlobsUploadBeginResponsePayload;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* This specification's payload schema, as a value.
|
|
81
|
+
*
|
|
82
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
83
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
84
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
85
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
86
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
87
|
+
*/
|
|
88
|
+
export const PAYLOAD_SCHEMA = {
|
|
89
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
90
|
+
"$id": "https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2",
|
|
91
|
+
"title": "Rooms Blobs — Upload — Begin — payload",
|
|
92
|
+
"description": "Open an upload of one file's ciphertext into a data room, committing to its size and to the digest of every chunk before any byte moves, reserving room for it against every limit that applies, and saying how its bytes may move — straight to the room's storage, or through the host under a single-use upload key. The outer document members are owned by the framework — SPEC §6.3.",
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"required": [
|
|
96
|
+
"roomId",
|
|
97
|
+
"presentation",
|
|
98
|
+
"manifest"
|
|
99
|
+
],
|
|
100
|
+
"properties": {
|
|
101
|
+
"roomId": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"maxLength": 2048,
|
|
104
|
+
"description": "The room the file is for. The host verifies the presentation against credentials this identifier issued, never against a member list of its own."
|
|
105
|
+
},
|
|
106
|
+
"presentation": {
|
|
107
|
+
"$ref": "#/$defs/AuthorityPresentation",
|
|
108
|
+
"description": "Must confer the `write` action at this room's scope. Its leaf's subject must be the party the host authenticated for this request."
|
|
109
|
+
},
|
|
110
|
+
"uploadKey": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"pattern": "^did:key:z[1-9A-HJ-NP-Za-km-z]+$",
|
|
113
|
+
"maxLength": 256,
|
|
114
|
+
"description": "A did:key the producer generated for this upload alone, for a proxied transfer: it signs the upload's chunk, commit and abort documents, and nothing else, and the host never records it as the owner or the uploader. Ed25519 (`z6Mk…`) MUST be accepted. A producer that omits it accepts only direct transfer."
|
|
115
|
+
},
|
|
116
|
+
"manifest": {
|
|
117
|
+
"$ref": "#/$defs/BlobManifest",
|
|
118
|
+
"description": "The ciphertext manifest. Its digest is the BlobRef the blob will have once committed."
|
|
119
|
+
},
|
|
120
|
+
"directParts": {
|
|
121
|
+
"$ref": "#/$defs/PartPlan",
|
|
122
|
+
"description": "How the producer will cut the blob for direct transfer. Present means the producer accepts direct transfer; absent means it accepts only proxied."
|
|
123
|
+
},
|
|
124
|
+
"ext": {
|
|
125
|
+
"$ref": "#/$defs/Ext"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"$defs": {
|
|
129
|
+
"Response": {
|
|
130
|
+
"$anchor": "response",
|
|
131
|
+
"title": "Rooms Blobs — Upload — Begin — response payload",
|
|
132
|
+
"description": "Success response to rooms/blobs/upload/begin. Type https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2#response.",
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": false,
|
|
135
|
+
"required": [
|
|
136
|
+
"uploadId",
|
|
137
|
+
"mode",
|
|
138
|
+
"missing",
|
|
139
|
+
"expiresAt"
|
|
140
|
+
],
|
|
141
|
+
"properties": {
|
|
142
|
+
"uploadId": {
|
|
143
|
+
"$ref": "#/$defs/TransferId"
|
|
144
|
+
},
|
|
145
|
+
"mode": {
|
|
146
|
+
"$ref": "#/$defs/TransferMode",
|
|
147
|
+
"description": "How this upload's bytes move: `direct` to the room's storage over `targets`, or `proxied` through the host as rooms/blobs/upload/chunk documents signed by `uploadKey`."
|
|
148
|
+
},
|
|
149
|
+
"missing": {
|
|
150
|
+
"type": "array",
|
|
151
|
+
"maxItems": 4096,
|
|
152
|
+
"uniqueItems": true,
|
|
153
|
+
"items": {
|
|
154
|
+
"$ref": "#/$defs/ChunkIndex"
|
|
155
|
+
},
|
|
156
|
+
"description": "The indices the host does not yet hold, in ascending order: chunk indices in proxied mode, part indices in direct mode. Every index on a new upload; only what is left on a resumed one; none when `alreadyCommitted` is true. Empty means the upload can be committed."
|
|
157
|
+
},
|
|
158
|
+
"expiresAt": {
|
|
159
|
+
"$ref": "#/$defs/ExpiresAt"
|
|
160
|
+
},
|
|
161
|
+
"targets": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"maxItems": 128,
|
|
164
|
+
"items": {
|
|
165
|
+
"$ref": "#/$defs/TransferTarget"
|
|
166
|
+
},
|
|
167
|
+
"description": "Direct mode only: a PUT target for each of some or all of the `missing` parts. A host MAY issue targets for only some of them; the producer begins again, with the identical manifest and plan, for the rest and for any whose target lapsed. Absent in proxied mode."
|
|
168
|
+
},
|
|
169
|
+
"alreadyCommitted": {
|
|
170
|
+
"type": "boolean",
|
|
171
|
+
"description": "True when the manifest's BlobRef is already committed in this room. `missing` is then empty, nothing was reserved, and commit returns the existing blob without charging it again. Absent or false on every other answer."
|
|
172
|
+
},
|
|
173
|
+
"ext": {
|
|
174
|
+
"$ref": "#/$defs/Ext"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"Ext": {
|
|
179
|
+
"title": "Ext",
|
|
180
|
+
"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.",
|
|
181
|
+
"type": "object",
|
|
182
|
+
"minProperties": 1,
|
|
183
|
+
"additionalProperties": true,
|
|
184
|
+
"propertyNames": {
|
|
185
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"TransferTarget": {
|
|
189
|
+
"title": "TransferTarget",
|
|
190
|
+
"type": "object",
|
|
191
|
+
"additionalProperties": false,
|
|
192
|
+
"required": [
|
|
193
|
+
"index",
|
|
194
|
+
"method",
|
|
195
|
+
"url",
|
|
196
|
+
"expiresAt"
|
|
197
|
+
],
|
|
198
|
+
"description": "One time-limited URL at the room's storage, issued by the host for one object and one method. A bearer credential for its lifetime: whoever holds it may perform exactly that request. A host MUST bind it to one object, one method and — for a write — the part's exact length and checksum, so that storage itself refuses any other bytes, and MUST give it the shortest practical lifetime, never more than 5 minutes. No party logs it.",
|
|
199
|
+
"properties": {
|
|
200
|
+
"index": {
|
|
201
|
+
"type": "integer",
|
|
202
|
+
"minimum": 0,
|
|
203
|
+
"maximum": 1023,
|
|
204
|
+
"description": "The part this target writes, or 0 for a read of the whole object."
|
|
205
|
+
},
|
|
206
|
+
"method": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"enum": [
|
|
209
|
+
"PUT",
|
|
210
|
+
"GET"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"url": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"format": "uri",
|
|
216
|
+
"pattern": "^https://",
|
|
217
|
+
"maxLength": 8192,
|
|
218
|
+
"description": "Where to send the request. HTTPS only."
|
|
219
|
+
},
|
|
220
|
+
"headers": {
|
|
221
|
+
"type": "object",
|
|
222
|
+
"maxProperties": 16,
|
|
223
|
+
"additionalProperties": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"maxLength": 1024
|
|
226
|
+
},
|
|
227
|
+
"propertyNames": {
|
|
228
|
+
"maxLength": 128
|
|
229
|
+
},
|
|
230
|
+
"description": "Headers the request MUST carry exactly as given — for a write, the part's length and checksum, which the URL's signature covers. A client adds nothing the storage would treat as signed."
|
|
231
|
+
},
|
|
232
|
+
"expiresAt": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"format": "date-time",
|
|
235
|
+
"description": "When the storage stops honouring the URL. A request begun after it is refused by the storage."
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"ExpiresAt": {
|
|
240
|
+
"title": "ExpiresAt",
|
|
241
|
+
"description": "After which the bundle is collected: staged bytes discarded, tokens and chunk requests refused. Short by design. For a chunked transfer a recipient may move it later as chunks are exchanged, never past its own ceiling — each chunk response reports the current value.",
|
|
242
|
+
"type": "string",
|
|
243
|
+
"format": "date-time"
|
|
244
|
+
},
|
|
245
|
+
"ChunkIndex": {
|
|
246
|
+
"title": "ChunkIndex",
|
|
247
|
+
"description": "Zero-based position of a chunk within its bundle. Valid values are 0 to chunkCount − 1; an index outside that range is refused with chunkOutOfRange rather than validated here, because the bound depends on the bundle.",
|
|
248
|
+
"type": "integer",
|
|
249
|
+
"minimum": 0,
|
|
250
|
+
"maximum": 4095
|
|
251
|
+
},
|
|
252
|
+
"TransferMode": {
|
|
253
|
+
"title": "TransferMode",
|
|
254
|
+
"type": "string",
|
|
255
|
+
"enum": [
|
|
256
|
+
"direct",
|
|
257
|
+
"proxied"
|
|
258
|
+
],
|
|
259
|
+
"description": "How a blob's bytes move. `proxied`: through the host, as chunk documents (rooms/blobs/upload/chunk, rooms/blobs/chunk). `direct`: straight between the member and the storage the room is assigned to, over time-limited URLs the host issues for one object and one method each; the host authorizes every object and verifies every upload, and never carries a byte. Which mode applies is the host's answer, from what the producer accepts, what the room's storage can do, and the room's tier."
|
|
260
|
+
},
|
|
261
|
+
"TransferId": {
|
|
262
|
+
"title": "TransferId",
|
|
263
|
+
"type": "string",
|
|
264
|
+
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
265
|
+
"description": "Handle for one upload (begin → chunk → commit or abort) or one download (get → chunk). Host-generated and unguessable, which is what lets a reference to another party's transfer be answered as not-found without confirming that it exists. Bound at creation to the party that opened it: the subject the host authenticated for the opening request. Opaque: a producer quotes what it was given."
|
|
266
|
+
},
|
|
267
|
+
"PartPlan": {
|
|
268
|
+
"title": "PartPlan",
|
|
269
|
+
"type": "object",
|
|
270
|
+
"additionalProperties": false,
|
|
271
|
+
"required": [
|
|
272
|
+
"partSize",
|
|
273
|
+
"partCount",
|
|
274
|
+
"partDigests"
|
|
275
|
+
],
|
|
276
|
+
"description": "How the uploader will cut a blob for direct transfer, committed before any byte moves: one storage object, written in `partCount` parts of `partSize` bytes (the last may be shorter), each with its digest. Independent of the chunk manifest, because storage imposes part sizes a chunk document cannot carry; the chunk manifest still describes the blob and readers still check it.\n\nConsistency rules JSON Schema cannot state: `partCount` MUST equal ceil(size / partSize) for the manifest's `size`, and `partDigests` MUST have exactly `partCount` items. Every digest MUST be sha2-256, because it is what the storage itself checks the part against.",
|
|
277
|
+
"properties": {
|
|
278
|
+
"partSize": {
|
|
279
|
+
"type": "integer",
|
|
280
|
+
"minimum": 1,
|
|
281
|
+
"maximum": 1073741824,
|
|
282
|
+
"description": "Bytes per part. One part of the whole blob's size is a single-object write."
|
|
283
|
+
},
|
|
284
|
+
"partCount": {
|
|
285
|
+
"type": "integer",
|
|
286
|
+
"minimum": 1,
|
|
287
|
+
"maximum": 1024
|
|
288
|
+
},
|
|
289
|
+
"partDigests": {
|
|
290
|
+
"type": "array",
|
|
291
|
+
"minItems": 1,
|
|
292
|
+
"maxItems": 1024,
|
|
293
|
+
"items": {
|
|
294
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
295
|
+
},
|
|
296
|
+
"description": "The sha2-256 digest of each part's ciphertext, in order."
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"DigestMultibase": {
|
|
301
|
+
"title": "DigestMultibase",
|
|
302
|
+
"description": "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.",
|
|
303
|
+
"type": "string",
|
|
304
|
+
"minLength": 16,
|
|
305
|
+
"pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
|
|
306
|
+
"examples": [
|
|
307
|
+
"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
"BlobManifest": {
|
|
311
|
+
"title": "BlobManifest",
|
|
312
|
+
"type": "object",
|
|
313
|
+
"additionalProperties": false,
|
|
314
|
+
"required": [
|
|
315
|
+
"size",
|
|
316
|
+
"chunks",
|
|
317
|
+
"digest"
|
|
318
|
+
],
|
|
319
|
+
"description": "The ciphertext manifest of one blob, committed by the uploader before any byte moves. Its digest is the BlobRef. Every chunk is checked against `chunks.chunkDigests` on arrival and the reassembled blob against `digest`, so a host can neither accept nor serve bytes the uploader did not commit to. The manifest also appears, by its BlobRef, inside the sealed FileManifest the author signs; a reader who opens the record therefore knows which ciphertext its author meant, and a host cannot substitute a different blob under the same record.\n\nConsistency rules JSON Schema cannot state: `chunks.chunkCount` MUST equal ceil(size / chunks.chunkSize), and `chunks.chunkDigests` MUST have exactly `chunkCount` items. A party receiving a manifest violating either MUST refuse it.\n\nEach transfer chunk is exactly one sealed STREAM segment (see FileManifest): every chunk but the last is `chunkSize` bytes, and `chunkSize` is the plaintext segment size plus the 16-byte AEAD tag. The 262144-byte ceiling of ChunkSize therefore puts the largest plaintext segment at 262128 bytes, and the 4096-chunk ceiling of ChunkCount puts the largest blob at 1 GiB of ciphertext.",
|
|
320
|
+
"properties": {
|
|
321
|
+
"size": {
|
|
322
|
+
"$ref": "#/$defs/ExpectedSizeBytes",
|
|
323
|
+
"description": "Ciphertext bytes, padding included. What the host stores, and what every limit and usage figure is stated in."
|
|
324
|
+
},
|
|
325
|
+
"chunks": {
|
|
326
|
+
"$ref": "#/$defs/ChunkManifest"
|
|
327
|
+
},
|
|
328
|
+
"digest": {
|
|
329
|
+
"$ref": "#/$defs/DigestMultibase",
|
|
330
|
+
"description": "Digest of the whole ciphertext, over its bytes. Checked after reassembly, so a correct set of chunks in the wrong order is still caught."
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"ChunkManifest": {
|
|
335
|
+
"title": "ChunkManifest",
|
|
336
|
+
"description": "The terms of a `chunkedTrustTask` transfer, committed before any chunk moves. On export the recipient states them in the descriptor; on import the producer pre-commits them in the request and the recipient echoes them. Either way the manifest arrives in a document whose proof is REQUIRED, so the per-chunk digests are authenticated by the party that computed them and each chunk can be verified — and a single bad chunk re-fetched or refused — on arrival rather than only after reassembly.\n\nConsistency rules JSON Schema cannot state: `chunkCount` MUST equal ceil(expectedSizeBytes / chunkSize) for the bundle the manifest describes, and `chunkDigests` MUST have exactly `chunkCount` items. A party receiving a manifest violating either MUST refuse it.",
|
|
337
|
+
"type": "object",
|
|
338
|
+
"additionalProperties": false,
|
|
339
|
+
"required": [
|
|
340
|
+
"chunkSize",
|
|
341
|
+
"chunkCount",
|
|
342
|
+
"chunkDigests"
|
|
343
|
+
],
|
|
344
|
+
"properties": {
|
|
345
|
+
"chunkSize": {
|
|
346
|
+
"$ref": "#/$defs/ChunkSize"
|
|
347
|
+
},
|
|
348
|
+
"chunkCount": {
|
|
349
|
+
"$ref": "#/$defs/ChunkCount"
|
|
350
|
+
},
|
|
351
|
+
"chunkDigests": {
|
|
352
|
+
"type": "array",
|
|
353
|
+
"minItems": 1,
|
|
354
|
+
"maxItems": 4096,
|
|
355
|
+
"description": "Digest of each chunk's raw bytes (not of its base64url encoding), in index order. Compared as decoded multihash bytes, never as encoded strings. sha2-256 is RECOMMENDED and MUST be implemented by every party; a party that does not implement the hash a digest names MUST treat the manifest as unverifiable rather than skip the check.",
|
|
356
|
+
"items": {
|
|
357
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"ChunkCount": {
|
|
363
|
+
"title": "ChunkCount",
|
|
364
|
+
"description": "Number of chunks in the bundle, equal to ceil(expectedSizeBytes / chunkSize). Bounded at 4096 so that the manifest itself — one digest per chunk — fits in the single document that carries it under the same message-size reasoning as a chunk.",
|
|
365
|
+
"type": "integer",
|
|
366
|
+
"minimum": 1,
|
|
367
|
+
"maximum": 4096
|
|
368
|
+
},
|
|
369
|
+
"ChunkSize": {
|
|
370
|
+
"title": "ChunkSize",
|
|
371
|
+
"description": "Size in bytes of every chunk except the last, which carries the remainder and is between 1 and this value inclusive. The ceiling of 262144 (256 KiB) is normative and is derived in `vta/backup/initiate-export/1.1` under Chunked transfer: it is the largest power of two whose `get-chunk` or `put-chunk` document still fits a 1 MiB mediator message after base64url encoding of `data`, DIDComm authcrypt encoding, and two nested forward wrappers. The floor of 16384 keeps a 1 GiB bundle within `ChunkCount`'s ceiling at sizes a constrained transport can still choose.",
|
|
372
|
+
"type": "integer",
|
|
373
|
+
"minimum": 16384,
|
|
374
|
+
"maximum": 262144
|
|
375
|
+
},
|
|
376
|
+
"ExpectedSizeBytes": {
|
|
377
|
+
"title": "ExpectedSizeBytes",
|
|
378
|
+
"description": "Total byte count of the bundle. A zero-length bundle is not a degenerate success — nothing was serialized — so the floor is 1.",
|
|
379
|
+
"type": "integer",
|
|
380
|
+
"minimum": 1
|
|
381
|
+
},
|
|
382
|
+
"AuthorityPresentation": {
|
|
383
|
+
"title": "AuthorityPresentation",
|
|
384
|
+
"type": "object",
|
|
385
|
+
"additionalProperties": false,
|
|
386
|
+
"required": [
|
|
387
|
+
"membership",
|
|
388
|
+
"authority"
|
|
389
|
+
],
|
|
390
|
+
"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. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.",
|
|
391
|
+
"properties": {
|
|
392
|
+
"membership": {
|
|
393
|
+
"type": "string",
|
|
394
|
+
"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."
|
|
395
|
+
},
|
|
396
|
+
"authority": {
|
|
397
|
+
"type": "array",
|
|
398
|
+
"minItems": 1,
|
|
399
|
+
"maxItems": 8,
|
|
400
|
+
"items": {
|
|
401
|
+
"type": "string"
|
|
402
|
+
},
|
|
403
|
+
"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."
|
|
404
|
+
},
|
|
405
|
+
"subjectBinding": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"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."
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
} as const;
|
|
413
|
+
|
|
414
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
415
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
416
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
417
|
+
"$ref": "#/$defs/Response",
|
|
418
|
+
"$defs": {
|
|
419
|
+
"Response": {
|
|
420
|
+
"$anchor": "response",
|
|
421
|
+
"title": "Rooms Blobs — Upload — Begin — response payload",
|
|
422
|
+
"description": "Success response to rooms/blobs/upload/begin. Type https://trusttasks.org/spec/rooms/blobs/upload/begin/0.2#response.",
|
|
423
|
+
"type": "object",
|
|
424
|
+
"additionalProperties": false,
|
|
425
|
+
"required": [
|
|
426
|
+
"uploadId",
|
|
427
|
+
"mode",
|
|
428
|
+
"missing",
|
|
429
|
+
"expiresAt"
|
|
430
|
+
],
|
|
431
|
+
"properties": {
|
|
432
|
+
"uploadId": {
|
|
433
|
+
"$ref": "#/$defs/TransferId"
|
|
434
|
+
},
|
|
435
|
+
"mode": {
|
|
436
|
+
"$ref": "#/$defs/TransferMode",
|
|
437
|
+
"description": "How this upload's bytes move: `direct` to the room's storage over `targets`, or `proxied` through the host as rooms/blobs/upload/chunk documents signed by `uploadKey`."
|
|
438
|
+
},
|
|
439
|
+
"missing": {
|
|
440
|
+
"type": "array",
|
|
441
|
+
"maxItems": 4096,
|
|
442
|
+
"uniqueItems": true,
|
|
443
|
+
"items": {
|
|
444
|
+
"$ref": "#/$defs/ChunkIndex"
|
|
445
|
+
},
|
|
446
|
+
"description": "The indices the host does not yet hold, in ascending order: chunk indices in proxied mode, part indices in direct mode. Every index on a new upload; only what is left on a resumed one; none when `alreadyCommitted` is true. Empty means the upload can be committed."
|
|
447
|
+
},
|
|
448
|
+
"expiresAt": {
|
|
449
|
+
"$ref": "#/$defs/ExpiresAt"
|
|
450
|
+
},
|
|
451
|
+
"targets": {
|
|
452
|
+
"type": "array",
|
|
453
|
+
"maxItems": 128,
|
|
454
|
+
"items": {
|
|
455
|
+
"$ref": "#/$defs/TransferTarget"
|
|
456
|
+
},
|
|
457
|
+
"description": "Direct mode only: a PUT target for each of some or all of the `missing` parts. A host MAY issue targets for only some of them; the producer begins again, with the identical manifest and plan, for the rest and for any whose target lapsed. Absent in proxied mode."
|
|
458
|
+
},
|
|
459
|
+
"alreadyCommitted": {
|
|
460
|
+
"type": "boolean",
|
|
461
|
+
"description": "True when the manifest's BlobRef is already committed in this room. `missing` is then empty, nothing was reserved, and commit returns the existing blob without charging it again. Absent or false on every other answer."
|
|
462
|
+
},
|
|
463
|
+
"ext": {
|
|
464
|
+
"$ref": "#/$defs/Ext"
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"Ext": {
|
|
469
|
+
"title": "Ext",
|
|
470
|
+
"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.",
|
|
471
|
+
"type": "object",
|
|
472
|
+
"minProperties": 1,
|
|
473
|
+
"additionalProperties": true,
|
|
474
|
+
"propertyNames": {
|
|
475
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"TransferTarget": {
|
|
479
|
+
"title": "TransferTarget",
|
|
480
|
+
"type": "object",
|
|
481
|
+
"additionalProperties": false,
|
|
482
|
+
"required": [
|
|
483
|
+
"index",
|
|
484
|
+
"method",
|
|
485
|
+
"url",
|
|
486
|
+
"expiresAt"
|
|
487
|
+
],
|
|
488
|
+
"description": "One time-limited URL at the room's storage, issued by the host for one object and one method. A bearer credential for its lifetime: whoever holds it may perform exactly that request. A host MUST bind it to one object, one method and — for a write — the part's exact length and checksum, so that storage itself refuses any other bytes, and MUST give it the shortest practical lifetime, never more than 5 minutes. No party logs it.",
|
|
489
|
+
"properties": {
|
|
490
|
+
"index": {
|
|
491
|
+
"type": "integer",
|
|
492
|
+
"minimum": 0,
|
|
493
|
+
"maximum": 1023,
|
|
494
|
+
"description": "The part this target writes, or 0 for a read of the whole object."
|
|
495
|
+
},
|
|
496
|
+
"method": {
|
|
497
|
+
"type": "string",
|
|
498
|
+
"enum": [
|
|
499
|
+
"PUT",
|
|
500
|
+
"GET"
|
|
501
|
+
]
|
|
502
|
+
},
|
|
503
|
+
"url": {
|
|
504
|
+
"type": "string",
|
|
505
|
+
"format": "uri",
|
|
506
|
+
"pattern": "^https://",
|
|
507
|
+
"maxLength": 8192,
|
|
508
|
+
"description": "Where to send the request. HTTPS only."
|
|
509
|
+
},
|
|
510
|
+
"headers": {
|
|
511
|
+
"type": "object",
|
|
512
|
+
"maxProperties": 16,
|
|
513
|
+
"additionalProperties": {
|
|
514
|
+
"type": "string",
|
|
515
|
+
"maxLength": 1024
|
|
516
|
+
},
|
|
517
|
+
"propertyNames": {
|
|
518
|
+
"maxLength": 128
|
|
519
|
+
},
|
|
520
|
+
"description": "Headers the request MUST carry exactly as given — for a write, the part's length and checksum, which the URL's signature covers. A client adds nothing the storage would treat as signed."
|
|
521
|
+
},
|
|
522
|
+
"expiresAt": {
|
|
523
|
+
"type": "string",
|
|
524
|
+
"format": "date-time",
|
|
525
|
+
"description": "When the storage stops honouring the URL. A request begun after it is refused by the storage."
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
"ExpiresAt": {
|
|
530
|
+
"title": "ExpiresAt",
|
|
531
|
+
"description": "After which the bundle is collected: staged bytes discarded, tokens and chunk requests refused. Short by design. For a chunked transfer a recipient may move it later as chunks are exchanged, never past its own ceiling — each chunk response reports the current value.",
|
|
532
|
+
"type": "string",
|
|
533
|
+
"format": "date-time"
|
|
534
|
+
},
|
|
535
|
+
"ChunkIndex": {
|
|
536
|
+
"title": "ChunkIndex",
|
|
537
|
+
"description": "Zero-based position of a chunk within its bundle. Valid values are 0 to chunkCount − 1; an index outside that range is refused with chunkOutOfRange rather than validated here, because the bound depends on the bundle.",
|
|
538
|
+
"type": "integer",
|
|
539
|
+
"minimum": 0,
|
|
540
|
+
"maximum": 4095
|
|
541
|
+
},
|
|
542
|
+
"TransferMode": {
|
|
543
|
+
"title": "TransferMode",
|
|
544
|
+
"type": "string",
|
|
545
|
+
"enum": [
|
|
546
|
+
"direct",
|
|
547
|
+
"proxied"
|
|
548
|
+
],
|
|
549
|
+
"description": "How a blob's bytes move. `proxied`: through the host, as chunk documents (rooms/blobs/upload/chunk, rooms/blobs/chunk). `direct`: straight between the member and the storage the room is assigned to, over time-limited URLs the host issues for one object and one method each; the host authorizes every object and verifies every upload, and never carries a byte. Which mode applies is the host's answer, from what the producer accepts, what the room's storage can do, and the room's tier."
|
|
550
|
+
},
|
|
551
|
+
"TransferId": {
|
|
552
|
+
"title": "TransferId",
|
|
553
|
+
"type": "string",
|
|
554
|
+
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
555
|
+
"description": "Handle for one upload (begin → chunk → commit or abort) or one download (get → chunk). Host-generated and unguessable, which is what lets a reference to another party's transfer be answered as not-found without confirming that it exists. Bound at creation to the party that opened it: the subject the host authenticated for the opening request. Opaque: a producer quotes what it was given."
|
|
556
|
+
},
|
|
557
|
+
"PartPlan": {
|
|
558
|
+
"title": "PartPlan",
|
|
559
|
+
"type": "object",
|
|
560
|
+
"additionalProperties": false,
|
|
561
|
+
"required": [
|
|
562
|
+
"partSize",
|
|
563
|
+
"partCount",
|
|
564
|
+
"partDigests"
|
|
565
|
+
],
|
|
566
|
+
"description": "How the uploader will cut a blob for direct transfer, committed before any byte moves: one storage object, written in `partCount` parts of `partSize` bytes (the last may be shorter), each with its digest. Independent of the chunk manifest, because storage imposes part sizes a chunk document cannot carry; the chunk manifest still describes the blob and readers still check it.\n\nConsistency rules JSON Schema cannot state: `partCount` MUST equal ceil(size / partSize) for the manifest's `size`, and `partDigests` MUST have exactly `partCount` items. Every digest MUST be sha2-256, because it is what the storage itself checks the part against.",
|
|
567
|
+
"properties": {
|
|
568
|
+
"partSize": {
|
|
569
|
+
"type": "integer",
|
|
570
|
+
"minimum": 1,
|
|
571
|
+
"maximum": 1073741824,
|
|
572
|
+
"description": "Bytes per part. One part of the whole blob's size is a single-object write."
|
|
573
|
+
},
|
|
574
|
+
"partCount": {
|
|
575
|
+
"type": "integer",
|
|
576
|
+
"minimum": 1,
|
|
577
|
+
"maximum": 1024
|
|
578
|
+
},
|
|
579
|
+
"partDigests": {
|
|
580
|
+
"type": "array",
|
|
581
|
+
"minItems": 1,
|
|
582
|
+
"maxItems": 1024,
|
|
583
|
+
"items": {
|
|
584
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
585
|
+
},
|
|
586
|
+
"description": "The sha2-256 digest of each part's ciphertext, in order."
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
"DigestMultibase": {
|
|
591
|
+
"title": "DigestMultibase",
|
|
592
|
+
"description": "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.",
|
|
593
|
+
"type": "string",
|
|
594
|
+
"minLength": 16,
|
|
595
|
+
"pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
|
|
596
|
+
"examples": [
|
|
597
|
+
"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
|
|
598
|
+
]
|
|
599
|
+
},
|
|
600
|
+
"BlobManifest": {
|
|
601
|
+
"title": "BlobManifest",
|
|
602
|
+
"type": "object",
|
|
603
|
+
"additionalProperties": false,
|
|
604
|
+
"required": [
|
|
605
|
+
"size",
|
|
606
|
+
"chunks",
|
|
607
|
+
"digest"
|
|
608
|
+
],
|
|
609
|
+
"description": "The ciphertext manifest of one blob, committed by the uploader before any byte moves. Its digest is the BlobRef. Every chunk is checked against `chunks.chunkDigests` on arrival and the reassembled blob against `digest`, so a host can neither accept nor serve bytes the uploader did not commit to. The manifest also appears, by its BlobRef, inside the sealed FileManifest the author signs; a reader who opens the record therefore knows which ciphertext its author meant, and a host cannot substitute a different blob under the same record.\n\nConsistency rules JSON Schema cannot state: `chunks.chunkCount` MUST equal ceil(size / chunks.chunkSize), and `chunks.chunkDigests` MUST have exactly `chunkCount` items. A party receiving a manifest violating either MUST refuse it.\n\nEach transfer chunk is exactly one sealed STREAM segment (see FileManifest): every chunk but the last is `chunkSize` bytes, and `chunkSize` is the plaintext segment size plus the 16-byte AEAD tag. The 262144-byte ceiling of ChunkSize therefore puts the largest plaintext segment at 262128 bytes, and the 4096-chunk ceiling of ChunkCount puts the largest blob at 1 GiB of ciphertext.",
|
|
610
|
+
"properties": {
|
|
611
|
+
"size": {
|
|
612
|
+
"$ref": "#/$defs/ExpectedSizeBytes",
|
|
613
|
+
"description": "Ciphertext bytes, padding included. What the host stores, and what every limit and usage figure is stated in."
|
|
614
|
+
},
|
|
615
|
+
"chunks": {
|
|
616
|
+
"$ref": "#/$defs/ChunkManifest"
|
|
617
|
+
},
|
|
618
|
+
"digest": {
|
|
619
|
+
"$ref": "#/$defs/DigestMultibase",
|
|
620
|
+
"description": "Digest of the whole ciphertext, over its bytes. Checked after reassembly, so a correct set of chunks in the wrong order is still caught."
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
"ChunkManifest": {
|
|
625
|
+
"title": "ChunkManifest",
|
|
626
|
+
"description": "The terms of a `chunkedTrustTask` transfer, committed before any chunk moves. On export the recipient states them in the descriptor; on import the producer pre-commits them in the request and the recipient echoes them. Either way the manifest arrives in a document whose proof is REQUIRED, so the per-chunk digests are authenticated by the party that computed them and each chunk can be verified — and a single bad chunk re-fetched or refused — on arrival rather than only after reassembly.\n\nConsistency rules JSON Schema cannot state: `chunkCount` MUST equal ceil(expectedSizeBytes / chunkSize) for the bundle the manifest describes, and `chunkDigests` MUST have exactly `chunkCount` items. A party receiving a manifest violating either MUST refuse it.",
|
|
627
|
+
"type": "object",
|
|
628
|
+
"additionalProperties": false,
|
|
629
|
+
"required": [
|
|
630
|
+
"chunkSize",
|
|
631
|
+
"chunkCount",
|
|
632
|
+
"chunkDigests"
|
|
633
|
+
],
|
|
634
|
+
"properties": {
|
|
635
|
+
"chunkSize": {
|
|
636
|
+
"$ref": "#/$defs/ChunkSize"
|
|
637
|
+
},
|
|
638
|
+
"chunkCount": {
|
|
639
|
+
"$ref": "#/$defs/ChunkCount"
|
|
640
|
+
},
|
|
641
|
+
"chunkDigests": {
|
|
642
|
+
"type": "array",
|
|
643
|
+
"minItems": 1,
|
|
644
|
+
"maxItems": 4096,
|
|
645
|
+
"description": "Digest of each chunk's raw bytes (not of its base64url encoding), in index order. Compared as decoded multihash bytes, never as encoded strings. sha2-256 is RECOMMENDED and MUST be implemented by every party; a party that does not implement the hash a digest names MUST treat the manifest as unverifiable rather than skip the check.",
|
|
646
|
+
"items": {
|
|
647
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
"ChunkCount": {
|
|
653
|
+
"title": "ChunkCount",
|
|
654
|
+
"description": "Number of chunks in the bundle, equal to ceil(expectedSizeBytes / chunkSize). Bounded at 4096 so that the manifest itself — one digest per chunk — fits in the single document that carries it under the same message-size reasoning as a chunk.",
|
|
655
|
+
"type": "integer",
|
|
656
|
+
"minimum": 1,
|
|
657
|
+
"maximum": 4096
|
|
658
|
+
},
|
|
659
|
+
"ChunkSize": {
|
|
660
|
+
"title": "ChunkSize",
|
|
661
|
+
"description": "Size in bytes of every chunk except the last, which carries the remainder and is between 1 and this value inclusive. The ceiling of 262144 (256 KiB) is normative and is derived in `vta/backup/initiate-export/1.1` under Chunked transfer: it is the largest power of two whose `get-chunk` or `put-chunk` document still fits a 1 MiB mediator message after base64url encoding of `data`, DIDComm authcrypt encoding, and two nested forward wrappers. The floor of 16384 keeps a 1 GiB bundle within `ChunkCount`'s ceiling at sizes a constrained transport can still choose.",
|
|
662
|
+
"type": "integer",
|
|
663
|
+
"minimum": 16384,
|
|
664
|
+
"maximum": 262144
|
|
665
|
+
},
|
|
666
|
+
"ExpectedSizeBytes": {
|
|
667
|
+
"title": "ExpectedSizeBytes",
|
|
668
|
+
"description": "Total byte count of the bundle. A zero-length bundle is not a degenerate success — nothing was serialized — so the floor is 1.",
|
|
669
|
+
"type": "integer",
|
|
670
|
+
"minimum": 1
|
|
671
|
+
},
|
|
672
|
+
"AuthorityPresentation": {
|
|
673
|
+
"title": "AuthorityPresentation",
|
|
674
|
+
"type": "object",
|
|
675
|
+
"additionalProperties": false,
|
|
676
|
+
"required": [
|
|
677
|
+
"membership",
|
|
678
|
+
"authority"
|
|
679
|
+
],
|
|
680
|
+
"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. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.",
|
|
681
|
+
"properties": {
|
|
682
|
+
"membership": {
|
|
683
|
+
"type": "string",
|
|
684
|
+
"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."
|
|
685
|
+
},
|
|
686
|
+
"authority": {
|
|
687
|
+
"type": "array",
|
|
688
|
+
"minItems": 1,
|
|
689
|
+
"maxItems": 8,
|
|
690
|
+
"items": {
|
|
691
|
+
"type": "string"
|
|
692
|
+
},
|
|
693
|
+
"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."
|
|
694
|
+
},
|
|
695
|
+
"subjectBinding": {
|
|
696
|
+
"type": "string",
|
|
697
|
+
"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."
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
} as const;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
706
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
707
|
+
* per-specification and cannot be derived from the document alone, and
|
|
708
|
+
* item 2 needs the schema this carries.
|
|
709
|
+
*/
|
|
710
|
+
export const SPEC = {
|
|
711
|
+
typeUri: TYPE_URI,
|
|
712
|
+
isBearer: false,
|
|
713
|
+
isProofRequired: true,
|
|
714
|
+
isRecipientRequired: true,
|
|
715
|
+
isIssuedAtRequired: true,
|
|
716
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
717
|
+
} as const;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
721
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
722
|
+
* parties (§7.3 item 5).
|
|
723
|
+
*/
|
|
724
|
+
export const RESPONSE_SPEC = {
|
|
725
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
726
|
+
isBearer: false,
|
|
727
|
+
isProofRequired: true,
|
|
728
|
+
isRecipientRequired: true,
|
|
729
|
+
isIssuedAtRequired: true,
|
|
730
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
731
|
+
} as const;
|