@openvtc/trust-tasks 0.26.27 → 0.26.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,369 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/vta/pcs/trustee/read/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { ElectionId, Ext } from "../../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * A trustee's client asks its VTA for a voting/trustees/status or voting/election/show request signed as the trustee, so it can follow the election's ceremony at the ballot box — on a private board as on a public one — without holding the trustee's key.
11
+ */
12
+ export interface VTAPCSTrusteeReadPayload {
13
+ /**
14
+ * The VTA context the trustee's keys live in.
15
+ */
16
+ contextId: string;
17
+ /**
18
+ * The community's DID: the registrar that registered the election.
19
+ */
20
+ community: string;
21
+ electionId: ElectionId;
22
+ /**
23
+ * The trustee's DID: a persona this VTA holds an authentication key of.
24
+ */
25
+ trustee: string;
26
+ /**
27
+ * The ballot box's DID: the recipient of the signed request.
28
+ */
29
+ ballotBox: string;
30
+ /**
31
+ * Which read to sign: voting/trustees/status/0.1 or voting/election/show/0.1.
32
+ */
33
+ read: "status" | "election";
34
+ ext?: Ext;
35
+ }
36
+ /**
37
+ * The signed read, to send to the ballot box.
38
+ */
39
+ export interface VTAPCSTrusteeReadResponsePayload {
40
+ document: ReadDocument;
41
+ ext?: Ext;
42
+ }
43
+ /**
44
+ * A complete, signed voting/trustees/status/0.1 or voting/election/show/0.1 request document, ready to send to the ballot box unchanged.
45
+ */
46
+ export interface ReadDocument {
47
+ id: string;
48
+ type:
49
+ | "https://trusttasks.org/spec/voting/trustees/status/0.1"
50
+ | "https://trusttasks.org/spec/voting/election/show/0.1";
51
+ /**
52
+ * The request's `trustee`.
53
+ */
54
+ issuer: string;
55
+ /**
56
+ * The request's `ballotBox`.
57
+ */
58
+ recipient: string;
59
+ issuedAt: string;
60
+ expiresAt?: string;
61
+ /**
62
+ * `{ community, electionId }` from the request, exactly.
63
+ */
64
+ payload: {};
65
+ /**
66
+ * A Data Integrity proof by an `authentication` key of `issuer`.
67
+ */
68
+ proof: {};
69
+ }
70
+
71
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
72
+ export type { ElectionId, Ext };
73
+
74
+ /** Trust Task type URI. */
75
+ export const TYPE_URI = "https://trusttasks.org/spec/vta/pcs/trustee/read/0.1" as const;
76
+
77
+ /** Stable alias for this specification's request payload shape. */
78
+ export type Payload = VTAPCSTrusteeReadPayload;
79
+
80
+ /** Trust Task response type URI (request type URI + "#response"). */
81
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/vta/pcs/trustee/read/0.1#response" as const;
82
+
83
+ /** Stable alias for this specification's success-response payload shape. */
84
+ export type Response = VTAPCSTrusteeReadResponsePayload;
85
+
86
+ /**
87
+ * This specification's payload schema, as a value.
88
+ *
89
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
90
+ * rather than only as a `.json` file because TypeScript types are erased
91
+ * at runtime: without a schema a consumer has nothing to validate, and
92
+ * every REQUIRED payload member is optional in practice. Cross-file
93
+ * `$ref`s are already inlined, so it needs no resolver.
94
+ */
95
+ export const PAYLOAD_SCHEMA = {
96
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
97
+ "$id": "https://trusttasks.org/spec/vta/pcs/trustee/read/0.1",
98
+ "title": "VTA PCS — Trustee Read — payload",
99
+ "description": "A trustee's client asks its VTA for a voting/trustees/status or voting/election/show request signed as the trustee, so it can follow the election's ceremony at the ballot box — on a private board as on a public one — without holding the trustee's key.",
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": [
103
+ "contextId",
104
+ "community",
105
+ "electionId",
106
+ "trustee",
107
+ "ballotBox",
108
+ "read"
109
+ ],
110
+ "properties": {
111
+ "contextId": {
112
+ "type": "string",
113
+ "minLength": 1,
114
+ "maxLength": 256,
115
+ "description": "The VTA context the trustee's keys live in."
116
+ },
117
+ "community": {
118
+ "type": "string",
119
+ "minLength": 1,
120
+ "maxLength": 2048,
121
+ "description": "The community's DID: the registrar that registered the election."
122
+ },
123
+ "electionId": {
124
+ "$ref": "#/$defs/ElectionId"
125
+ },
126
+ "trustee": {
127
+ "type": "string",
128
+ "minLength": 1,
129
+ "maxLength": 2048,
130
+ "pattern": "^did:",
131
+ "description": "The trustee's DID: a persona this VTA holds an authentication key of."
132
+ },
133
+ "ballotBox": {
134
+ "type": "string",
135
+ "minLength": 1,
136
+ "maxLength": 2048,
137
+ "pattern": "^did:",
138
+ "description": "The ballot box's DID: the recipient of the signed request."
139
+ },
140
+ "read": {
141
+ "type": "string",
142
+ "enum": [
143
+ "status",
144
+ "election"
145
+ ],
146
+ "description": "Which read to sign: voting/trustees/status/0.1 or voting/election/show/0.1."
147
+ },
148
+ "ext": {
149
+ "$ref": "#/$defs/Ext"
150
+ }
151
+ },
152
+ "$defs": {
153
+ "ReadDocument": {
154
+ "title": "ReadDocument",
155
+ "description": "A complete, signed voting/trustees/status/0.1 or voting/election/show/0.1 request document, ready to send to the ballot box unchanged.",
156
+ "type": "object",
157
+ "required": [
158
+ "id",
159
+ "type",
160
+ "issuer",
161
+ "recipient",
162
+ "issuedAt",
163
+ "payload",
164
+ "proof"
165
+ ],
166
+ "properties": {
167
+ "id": {
168
+ "type": "string",
169
+ "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
170
+ },
171
+ "type": {
172
+ "type": "string",
173
+ "enum": [
174
+ "https://trusttasks.org/spec/voting/trustees/status/0.1",
175
+ "https://trusttasks.org/spec/voting/election/show/0.1"
176
+ ]
177
+ },
178
+ "issuer": {
179
+ "type": "string",
180
+ "minLength": 1,
181
+ "maxLength": 2048,
182
+ "description": "The request's `trustee`."
183
+ },
184
+ "recipient": {
185
+ "type": "string",
186
+ "minLength": 1,
187
+ "maxLength": 2048,
188
+ "description": "The request's `ballotBox`."
189
+ },
190
+ "issuedAt": {
191
+ "type": "string",
192
+ "format": "date-time"
193
+ },
194
+ "expiresAt": {
195
+ "type": "string",
196
+ "format": "date-time"
197
+ },
198
+ "payload": {
199
+ "type": "object",
200
+ "description": "`{ community, electionId }` from the request, exactly."
201
+ },
202
+ "proof": {
203
+ "type": "object",
204
+ "description": "A Data Integrity proof by an `authentication` key of `issuer`."
205
+ }
206
+ }
207
+ },
208
+ "Response": {
209
+ "$anchor": "response",
210
+ "title": "VTA PCS — Trustee Read — response payload",
211
+ "description": "The signed read, to send to the ballot box.",
212
+ "type": "object",
213
+ "additionalProperties": false,
214
+ "required": [
215
+ "document"
216
+ ],
217
+ "properties": {
218
+ "document": {
219
+ "$ref": "#/$defs/ReadDocument"
220
+ },
221
+ "ext": {
222
+ "$ref": "#/$defs/Ext"
223
+ }
224
+ }
225
+ },
226
+ "Ext": {
227
+ "title": "Ext",
228
+ "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.",
229
+ "type": "object",
230
+ "minProperties": 1,
231
+ "additionalProperties": true,
232
+ "propertyNames": {
233
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
234
+ }
235
+ },
236
+ "ElectionId": {
237
+ "title": "ElectionId",
238
+ "description": "An election's identifier, unique within its community. A closed alphabet: it appears in the ticket class label `voter/<electionId>` and is framed into every hash a cast is bound to.",
239
+ "type": "string",
240
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
241
+ }
242
+ }
243
+ } as const;
244
+
245
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
246
+ export const RESPONSE_PAYLOAD_SCHEMA = {
247
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
248
+ "$ref": "#/$defs/Response",
249
+ "$defs": {
250
+ "ReadDocument": {
251
+ "title": "ReadDocument",
252
+ "description": "A complete, signed voting/trustees/status/0.1 or voting/election/show/0.1 request document, ready to send to the ballot box unchanged.",
253
+ "type": "object",
254
+ "required": [
255
+ "id",
256
+ "type",
257
+ "issuer",
258
+ "recipient",
259
+ "issuedAt",
260
+ "payload",
261
+ "proof"
262
+ ],
263
+ "properties": {
264
+ "id": {
265
+ "type": "string",
266
+ "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
267
+ },
268
+ "type": {
269
+ "type": "string",
270
+ "enum": [
271
+ "https://trusttasks.org/spec/voting/trustees/status/0.1",
272
+ "https://trusttasks.org/spec/voting/election/show/0.1"
273
+ ]
274
+ },
275
+ "issuer": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "maxLength": 2048,
279
+ "description": "The request's `trustee`."
280
+ },
281
+ "recipient": {
282
+ "type": "string",
283
+ "minLength": 1,
284
+ "maxLength": 2048,
285
+ "description": "The request's `ballotBox`."
286
+ },
287
+ "issuedAt": {
288
+ "type": "string",
289
+ "format": "date-time"
290
+ },
291
+ "expiresAt": {
292
+ "type": "string",
293
+ "format": "date-time"
294
+ },
295
+ "payload": {
296
+ "type": "object",
297
+ "description": "`{ community, electionId }` from the request, exactly."
298
+ },
299
+ "proof": {
300
+ "type": "object",
301
+ "description": "A Data Integrity proof by an `authentication` key of `issuer`."
302
+ }
303
+ }
304
+ },
305
+ "Response": {
306
+ "$anchor": "response",
307
+ "title": "VTA PCS — Trustee Read — response payload",
308
+ "description": "The signed read, to send to the ballot box.",
309
+ "type": "object",
310
+ "additionalProperties": false,
311
+ "required": [
312
+ "document"
313
+ ],
314
+ "properties": {
315
+ "document": {
316
+ "$ref": "#/$defs/ReadDocument"
317
+ },
318
+ "ext": {
319
+ "$ref": "#/$defs/Ext"
320
+ }
321
+ }
322
+ },
323
+ "Ext": {
324
+ "title": "Ext",
325
+ "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.",
326
+ "type": "object",
327
+ "minProperties": 1,
328
+ "additionalProperties": true,
329
+ "propertyNames": {
330
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
331
+ }
332
+ },
333
+ "ElectionId": {
334
+ "title": "ElectionId",
335
+ "description": "An election's identifier, unique within its community. A closed alphabet: it appears in the ticket class label `voter/<electionId>` and is framed into every hash a cast is bound to.",
336
+ "type": "string",
337
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
338
+ }
339
+ }
340
+ } as const;
341
+
342
+ /**
343
+ * SPEC.md §7.2 policy for the request variant, from this specification's
344
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
345
+ * per-specification and cannot be derived from the document alone, and
346
+ * item 2 needs the schema this carries.
347
+ */
348
+ export const SPEC = {
349
+ typeUri: TYPE_URI,
350
+ isBearer: false,
351
+ isProofRequired: true,
352
+ isRecipientRequired: true,
353
+ isIssuedAtRequired: true,
354
+ payloadSchema: PAYLOAD_SCHEMA,
355
+ } as const;
356
+
357
+ /**
358
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
359
+ * tracks the *issuer* party's requirement because a response swaps the
360
+ * parties (§7.3 item 5).
361
+ */
362
+ export const RESPONSE_SPEC = {
363
+ typeUri: RESPONSE_TYPE_URI,
364
+ isBearer: false,
365
+ isProofRequired: false,
366
+ isRecipientRequired: true,
367
+ isIssuedAtRequired: true,
368
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
369
+ } as const;