@openvtc/trust-tasks 0.26.25 → 0.26.27
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 +92 -0
- package/dist/_shared/components.d.ts +207 -4
- package/dist/_shared/components.d.ts.map +1 -1
- package/dist/device/list/0.1/payload.d.ts +4 -4
- package/dist/device/list/0.1/payload.d.ts.map +1 -1
- package/dist/device/list/0.1/payload.js +4 -2
- package/dist/device/list/0.1/payload.js.map +1 -1
- package/dist/device/list/0.2/payload.d.ts +4 -4
- package/dist/device/list/0.2/payload.d.ts.map +1 -1
- package/dist/device/list/0.2/payload.js +4 -2
- package/dist/device/list/0.2/payload.js.map +1 -1
- package/dist/device/register/0.1/payload.d.ts +4 -4
- package/dist/device/register/0.1/payload.d.ts.map +1 -1
- package/dist/device/register/0.1/payload.js +4 -2
- package/dist/device/register/0.1/payload.js.map +1 -1
- package/dist/device/register/0.2/payload.d.ts +4 -4
- package/dist/device/register/0.2/payload.d.ts.map +1 -1
- package/dist/device/register/0.2/payload.js +4 -2
- package/dist/device/register/0.2/payload.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/voting/_shared/0.1/voting.d.ts +1 -1
- package/dist/voting/_shared/0.1/voting.d.ts.map +1 -1
- package/dist/voting/ballot/cast-encrypted/0.1/payload.d.ts +1166 -0
- package/dist/voting/ballot/cast-encrypted/0.1/payload.d.ts.map +1 -0
- package/dist/voting/ballot/cast-encrypted/0.1/payload.js +690 -0
- package/dist/voting/ballot/cast-encrypted/0.1/payload.js.map +1 -0
- package/dist/voting/board/read/0.1/payload.d.ts +2555 -719
- package/dist/voting/board/read/0.1/payload.d.ts.map +1 -1
- package/dist/voting/board/read/0.1/payload.js +1517 -391
- package/dist/voting/board/read/0.1/payload.js.map +1 -1
- package/dist/voting/election/register/0.1/payload.d.ts +4 -4
- package/dist/voting/election/register/0.1/payload.js +2 -2
- package/dist/voting/election/register/0.1/payload.js.map +1 -1
- package/dist/voting/election/show/0.1/payload.d.ts +4 -4
- package/dist/voting/election/show/0.1/payload.js +2 -2
- package/dist/voting/election/show/0.1/payload.js.map +1 -1
- package/dist/voting/trustees/confirm/0.1/payload.d.ts +620 -0
- package/dist/voting/trustees/confirm/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/confirm/0.1/payload.js +388 -0
- package/dist/voting/trustees/confirm/0.1/payload.js.map +1 -0
- package/dist/voting/trustees/deal/0.1/payload.d.ts +1032 -0
- package/dist/voting/trustees/deal/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/deal/0.1/payload.js +630 -0
- package/dist/voting/trustees/deal/0.1/payload.js.map +1 -0
- package/dist/voting/trustees/decrypt/0.1/payload.d.ts +1009 -0
- package/dist/voting/trustees/decrypt/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/decrypt/0.1/payload.js +623 -0
- package/dist/voting/trustees/decrypt/0.1/payload.js.map +1 -0
- package/dist/voting/trustees/enrol/0.1/payload.d.ts +792 -0
- package/dist/voting/trustees/enrol/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/enrol/0.1/payload.js +490 -0
- package/dist/voting/trustees/enrol/0.1/payload.js.map +1 -0
- package/dist/voting/trustees/justify/0.1/payload.d.ts +642 -0
- package/dist/voting/trustees/justify/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/justify/0.1/payload.js +402 -0
- package/dist/voting/trustees/justify/0.1/payload.js.map +1 -0
- package/dist/voting/trustees/status/0.1/payload.d.ts +1411 -0
- package/dist/voting/trustees/status/0.1/payload.d.ts.map +1 -0
- package/dist/voting/trustees/status/0.1/payload.js +822 -0
- package/dist/voting/trustees/status/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/trustee/deal/0.1/payload.d.ts +2005 -0
- package/dist/vta/pcs/trustee/deal/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/trustee/deal/0.1/payload.js +1176 -0
- package/dist/vta/pcs/trustee/deal/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/trustee/decrypt/0.1/payload.d.ts +736 -0
- package/dist/vta/pcs/trustee/decrypt/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/trustee/decrypt/0.1/payload.js +412 -0
- package/dist/vta/pcs/trustee/decrypt/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/trustee/enrol/0.1/payload.d.ts +1756 -0
- package/dist/vta/pcs/trustee/enrol/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/trustee/enrol/0.1/payload.js +1040 -0
- package/dist/vta/pcs/trustee/enrol/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/trustee/justify/0.1/payload.d.ts +504 -0
- package/dist/vta/pcs/trustee/justify/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/trustee/justify/0.1/payload.js +274 -0
- package/dist/vta/pcs/trustee/justify/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/trustee/keys/0.1/payload.d.ts +2501 -0
- package/dist/vta/pcs/trustee/keys/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/trustee/keys/0.1/payload.js +1455 -0
- package/dist/vta/pcs/trustee/keys/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/vote/0.1/payload.d.ts +4 -4
- package/dist/vta/pcs/vote/0.1/payload.js +2 -2
- package/dist/vta/pcs/vote/0.1/payload.js.map +1 -1
- package/dist/vta/pcs/vote-encrypted/0.1/payload.d.ts +2375 -0
- package/dist/vta/pcs/vote-encrypted/0.1/payload.d.ts.map +1 -0
- package/dist/vta/pcs/vote-encrypted/0.1/payload.js +1389 -0
- package/dist/vta/pcs/vote-encrypted/0.1/payload.js.map +1 -0
- package/dist/vta/pcs/voter/register/0.1/payload.d.ts +4 -4
- package/dist/vta/pcs/voter/register/0.1/payload.js +2 -2
- package/dist/vta/pcs/voter/register/0.1/payload.js.map +1 -1
- package/dist/vtc/config/did-hosting/list/0.1/payload.d.ts +339 -0
- package/dist/vtc/config/did-hosting/list/0.1/payload.d.ts.map +1 -0
- package/dist/vtc/config/did-hosting/list/0.1/payload.js +185 -0
- package/dist/vtc/config/did-hosting/list/0.1/payload.js.map +1 -0
- package/dist/vtc/elections/create/0.1/payload.d.ts +4 -4
- package/dist/vtc/elections/create/0.1/payload.js +2 -2
- package/dist/vtc/elections/create/0.1/payload.js.map +1 -1
- package/dist/vtc/elections/show/0.1/payload.d.ts +242 -6
- package/dist/vtc/elections/show/0.1/payload.d.ts.map +1 -1
- package/dist/vtc/elections/show/0.1/payload.js +132 -2
- package/dist/vtc/elections/show/0.1/payload.js.map +1 -1
- package/package.json +1 -1
- package/src/_shared/components.ts +222 -4
- package/src/device/list/0.1/payload.ts +4 -2
- package/src/device/list/0.2/payload.ts +4 -2
- package/src/device/register/0.1/payload.ts +4 -2
- package/src/device/register/0.2/payload.ts +4 -2
- package/src/index.ts +14 -0
- package/src/voting/_shared/0.1/voting.ts +1 -1
- package/src/voting/ballot/cast-encrypted/0.1/payload.ts +735 -0
- package/src/voting/board/read/0.1/payload.ts +1519 -393
- package/src/voting/election/register/0.1/payload.ts +2 -2
- package/src/voting/election/show/0.1/payload.ts +2 -2
- package/src/voting/trustees/confirm/0.1/payload.ts +429 -0
- package/src/voting/trustees/deal/0.1/payload.ts +665 -0
- package/src/voting/trustees/decrypt/0.1/payload.ts +663 -0
- package/src/voting/trustees/enrol/0.1/payload.ts +525 -0
- package/src/voting/trustees/justify/0.1/payload.ts +439 -0
- package/src/voting/trustees/status/0.1/payload.ts +890 -0
- package/src/vta/pcs/trustee/deal/0.1/payload.ts +1250 -0
- package/src/vta/pcs/trustee/decrypt/0.1/payload.ts +489 -0
- package/src/vta/pcs/trustee/enrol/0.1/payload.ts +1107 -0
- package/src/vta/pcs/trustee/justify/0.1/payload.ts +341 -0
- package/src/vta/pcs/trustee/keys/0.1/payload.ts +1545 -0
- package/src/vta/pcs/vote/0.1/payload.ts +2 -2
- package/src/vta/pcs/vote-encrypted/0.1/payload.ts +1455 -0
- package/src/vta/pcs/voter/register/0.1/payload.ts +2 -2
- package/src/vtc/config/did-hosting/list/0.1/payload.ts +233 -0
- package/src/vtc/elections/create/0.1/payload.ts +2 -2
- package/src/vtc/elections/show/0.1/payload.ts +138 -4
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/voting/ballot/cast-encrypted/0.1/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
/** Trust Task type URI. */
|
|
6
|
+
export const TYPE_URI = "https://trusttasks.org/spec/voting/ballot/cast-encrypted/0.1";
|
|
7
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
8
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/voting/ballot/cast-encrypted/0.1#response";
|
|
9
|
+
/**
|
|
10
|
+
* This specification's payload schema, as a value.
|
|
11
|
+
*
|
|
12
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
13
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
14
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
15
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
16
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
17
|
+
*/
|
|
18
|
+
export const PAYLOAD_SCHEMA = {
|
|
19
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
+
"$id": "https://trusttasks.org/spec/voting/ballot/cast-encrypted/0.1",
|
|
21
|
+
"title": "Voting — Ballot — Cast Encrypted — payload",
|
|
22
|
+
"description": "A voter casts a sealed or tallied-encrypted ballot, admitted by its PCS attestation and, when tallied-encrypted, by its proofs of validity.",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": [
|
|
26
|
+
"community",
|
|
27
|
+
"electionId",
|
|
28
|
+
"cast"
|
|
29
|
+
],
|
|
30
|
+
"properties": {
|
|
31
|
+
"community": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"minLength": 1,
|
|
34
|
+
"maxLength": 2048,
|
|
35
|
+
"description": "The community's DID."
|
|
36
|
+
},
|
|
37
|
+
"electionId": {
|
|
38
|
+
"$ref": "#/$defs/ElectionId"
|
|
39
|
+
},
|
|
40
|
+
"cast": {
|
|
41
|
+
"$ref": "#/$defs/EncryptedCast"
|
|
42
|
+
},
|
|
43
|
+
"ext": {
|
|
44
|
+
"$ref": "#/$defs/Ext"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"$defs": {
|
|
48
|
+
"Response": {
|
|
49
|
+
"$anchor": "response",
|
|
50
|
+
"title": "Voting — Ballot — Cast Encrypted — response payload",
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": [
|
|
54
|
+
"electionId",
|
|
55
|
+
"outcome",
|
|
56
|
+
"leafIndex",
|
|
57
|
+
"entryHash",
|
|
58
|
+
"head",
|
|
59
|
+
"receiptToken"
|
|
60
|
+
],
|
|
61
|
+
"properties": {
|
|
62
|
+
"electionId": {
|
|
63
|
+
"$ref": "#/$defs/ElectionId"
|
|
64
|
+
},
|
|
65
|
+
"outcome": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"enum": [
|
|
68
|
+
"counted",
|
|
69
|
+
"replaced",
|
|
70
|
+
"alreadyCounted"
|
|
71
|
+
],
|
|
72
|
+
"description": "As voting/ballot/cast."
|
|
73
|
+
},
|
|
74
|
+
"leafIndex": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"minimum": 0,
|
|
77
|
+
"description": "The board index of this cast's `encryptedCast` entry."
|
|
78
|
+
},
|
|
79
|
+
"entryHash": {
|
|
80
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
81
|
+
},
|
|
82
|
+
"head": {
|
|
83
|
+
"$ref": "#/$defs/BoardHead"
|
|
84
|
+
},
|
|
85
|
+
"receiptToken": {
|
|
86
|
+
"$ref": "#/$defs/Multibase"
|
|
87
|
+
},
|
|
88
|
+
"ext": {
|
|
89
|
+
"$ref": "#/$defs/Ext"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"Ext": {
|
|
94
|
+
"title": "Ext",
|
|
95
|
+
"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.",
|
|
96
|
+
"type": "object",
|
|
97
|
+
"minProperties": 1,
|
|
98
|
+
"additionalProperties": true,
|
|
99
|
+
"propertyNames": {
|
|
100
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"Multibase": {
|
|
104
|
+
"title": "Multibase",
|
|
105
|
+
"description": "A binary value, multibase base58btc over the suite's canonical (compressed) encoding.",
|
|
106
|
+
"type": "string",
|
|
107
|
+
"maxLength": 16384,
|
|
108
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
109
|
+
},
|
|
110
|
+
"BoardHead": {
|
|
111
|
+
"title": "BoardHead",
|
|
112
|
+
"description": "A board's tree head (RFC 9162 §2.1). A head is signed by being carried in a document the ballot box signs; whoever keeps a head keeps that whole document.",
|
|
113
|
+
"type": "object",
|
|
114
|
+
"additionalProperties": false,
|
|
115
|
+
"required": [
|
|
116
|
+
"electionId",
|
|
117
|
+
"treeSize",
|
|
118
|
+
"rootHash",
|
|
119
|
+
"issuedAt"
|
|
120
|
+
],
|
|
121
|
+
"properties": {
|
|
122
|
+
"electionId": {
|
|
123
|
+
"$ref": "#/$defs/ElectionId"
|
|
124
|
+
},
|
|
125
|
+
"treeSize": {
|
|
126
|
+
"type": "integer",
|
|
127
|
+
"minimum": 0
|
|
128
|
+
},
|
|
129
|
+
"rootHash": {
|
|
130
|
+
"$ref": "#/$defs/DigestMultibase",
|
|
131
|
+
"description": "The RFC 9162 Merkle tree hash (SHA-256) of the first `treeSize` entries, as a multihash."
|
|
132
|
+
},
|
|
133
|
+
"issuedAt": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"format": "date-time"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"ElectionId": {
|
|
140
|
+
"title": "ElectionId",
|
|
141
|
+
"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.",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"pattern": "^[A-Za-z0-9._-]{1,128}$"
|
|
144
|
+
},
|
|
145
|
+
"DigestMultibase": {
|
|
146
|
+
"title": "DigestMultibase",
|
|
147
|
+
"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`.",
|
|
148
|
+
"type": "string",
|
|
149
|
+
"minLength": 16,
|
|
150
|
+
"pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
|
|
151
|
+
"examples": [
|
|
152
|
+
"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"EncryptedCast": {
|
|
156
|
+
"title": "EncryptedCast",
|
|
157
|
+
"description": "A cast of a sealed or tallied-encrypted election: exactly one of `sealed` (the Ballot's JCS bytes sealed to the election key) or `encrypted`, with the tag and the attestation over the JCS bytes of whichever is present (CONVENTIONS §3.6, §9.5).",
|
|
158
|
+
"type": "object",
|
|
159
|
+
"additionalProperties": false,
|
|
160
|
+
"required": [
|
|
161
|
+
"tag",
|
|
162
|
+
"attestation"
|
|
163
|
+
],
|
|
164
|
+
"properties": {
|
|
165
|
+
"sealed": {
|
|
166
|
+
"$ref": "#/$defs/SealedPayload"
|
|
167
|
+
},
|
|
168
|
+
"encrypted": {
|
|
169
|
+
"$ref": "#/$defs/EncryptedBallot"
|
|
170
|
+
},
|
|
171
|
+
"tag": {
|
|
172
|
+
"$ref": "#/$defs/Multibase"
|
|
173
|
+
},
|
|
174
|
+
"attestation": {
|
|
175
|
+
"$ref": "#/$defs/Multibase"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"oneOf": [
|
|
179
|
+
{
|
|
180
|
+
"required": [
|
|
181
|
+
"sealed"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"required": [
|
|
186
|
+
"encrypted"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
"EncryptedBallot": {
|
|
192
|
+
"title": "EncryptedBallot",
|
|
193
|
+
"description": "A tallied-encrypted ballot: one EncryptedQuestion per manifest question, in the manifest's order. Never decrypted (VTI-VOT-064).",
|
|
194
|
+
"type": "object",
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"required": [
|
|
197
|
+
"electionId",
|
|
198
|
+
"manifestDigest",
|
|
199
|
+
"questions"
|
|
200
|
+
],
|
|
201
|
+
"properties": {
|
|
202
|
+
"electionId": {
|
|
203
|
+
"$ref": "#/$defs/ElectionId"
|
|
204
|
+
},
|
|
205
|
+
"manifestDigest": {
|
|
206
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
207
|
+
},
|
|
208
|
+
"questions": {
|
|
209
|
+
"type": "array",
|
|
210
|
+
"minItems": 1,
|
|
211
|
+
"maxItems": 64,
|
|
212
|
+
"items": {
|
|
213
|
+
"$ref": "#/$defs/EncryptedQuestion"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"EncryptedQuestion": {
|
|
219
|
+
"title": "EncryptedQuestion",
|
|
220
|
+
"description": "One choice question of a tallied-encrypted ballot: per option, in the manifest's order, an encryption of 0 or 1 with its proof; and a proof that the selections sum to a count the question admits (CONVENTIONS §9.5).",
|
|
221
|
+
"type": "object",
|
|
222
|
+
"additionalProperties": false,
|
|
223
|
+
"required": [
|
|
224
|
+
"question",
|
|
225
|
+
"options",
|
|
226
|
+
"sumProof"
|
|
227
|
+
],
|
|
228
|
+
"properties": {
|
|
229
|
+
"question": {
|
|
230
|
+
"$ref": "#/$defs/Key"
|
|
231
|
+
},
|
|
232
|
+
"options": {
|
|
233
|
+
"type": "array",
|
|
234
|
+
"minItems": 1,
|
|
235
|
+
"maxItems": 64,
|
|
236
|
+
"items": {
|
|
237
|
+
"$ref": "#/$defs/EncryptedOption"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"sumProof": {
|
|
241
|
+
"$ref": "#/$defs/DisjunctiveProof"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"DisjunctiveProof": {
|
|
246
|
+
"title": "DisjunctiveProof",
|
|
247
|
+
"description": "A disjunctive proof that a ciphertext encrypts one value of a public list: one `(c, z)` per value, in the list's order (CONVENTIONS §9.3).",
|
|
248
|
+
"type": "array",
|
|
249
|
+
"minItems": 1,
|
|
250
|
+
"maxItems": 65,
|
|
251
|
+
"items": {
|
|
252
|
+
"$ref": "#/$defs/SigmaProof"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"SigmaProof": {
|
|
256
|
+
"title": "SigmaProof",
|
|
257
|
+
"description": "A non-interactive sigma proof as its challenge and response `(c, z)` (Schnorr or Chaum–Pedersen; CONVENTIONS §9.3).",
|
|
258
|
+
"type": "object",
|
|
259
|
+
"additionalProperties": false,
|
|
260
|
+
"required": [
|
|
261
|
+
"c",
|
|
262
|
+
"z"
|
|
263
|
+
],
|
|
264
|
+
"properties": {
|
|
265
|
+
"c": {
|
|
266
|
+
"$ref": "#/$defs/GroupScalar"
|
|
267
|
+
},
|
|
268
|
+
"z": {
|
|
269
|
+
"$ref": "#/$defs/GroupScalar"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"GroupScalar": {
|
|
274
|
+
"title": "GroupScalar",
|
|
275
|
+
"description": "A scalar mod the Ristretto group order: 32 canonical little-endian bytes, multibase base58btc (CONVENTIONS §9.1).",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"minLength": 2,
|
|
278
|
+
"maxLength": 64,
|
|
279
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
280
|
+
},
|
|
281
|
+
"EncryptedOption": {
|
|
282
|
+
"title": "EncryptedOption",
|
|
283
|
+
"type": "object",
|
|
284
|
+
"additionalProperties": false,
|
|
285
|
+
"required": [
|
|
286
|
+
"ciphertext",
|
|
287
|
+
"proof"
|
|
288
|
+
],
|
|
289
|
+
"properties": {
|
|
290
|
+
"ciphertext": {
|
|
291
|
+
"$ref": "#/$defs/ElGamalCiphertext"
|
|
292
|
+
},
|
|
293
|
+
"proof": {
|
|
294
|
+
"$ref": "#/$defs/DisjunctiveProof"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"ElGamalCiphertext": {
|
|
299
|
+
"title": "ElGamalCiphertext",
|
|
300
|
+
"description": "`(a, b) = (r·G, M + r·Y)` under the election key `Y` (CONVENTIONS §9.2).",
|
|
301
|
+
"type": "object",
|
|
302
|
+
"additionalProperties": false,
|
|
303
|
+
"required": [
|
|
304
|
+
"a",
|
|
305
|
+
"b"
|
|
306
|
+
],
|
|
307
|
+
"properties": {
|
|
308
|
+
"a": {
|
|
309
|
+
"$ref": "#/$defs/GroupElement"
|
|
310
|
+
},
|
|
311
|
+
"b": {
|
|
312
|
+
"$ref": "#/$defs/GroupElement"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"GroupElement": {
|
|
317
|
+
"title": "GroupElement",
|
|
318
|
+
"description": "A Ristretto group element: its 32-byte compression, multibase base58btc. Never the identity (CONVENTIONS §9.1).",
|
|
319
|
+
"type": "string",
|
|
320
|
+
"minLength": 2,
|
|
321
|
+
"maxLength": 64,
|
|
322
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
323
|
+
},
|
|
324
|
+
"Key": {
|
|
325
|
+
"title": "Key",
|
|
326
|
+
"description": "A question or option key, unique within its manifest or question.",
|
|
327
|
+
"type": "string",
|
|
328
|
+
"pattern": "^[A-Za-z0-9._-]{1,64}$"
|
|
329
|
+
},
|
|
330
|
+
"SealedPayload": {
|
|
331
|
+
"title": "SealedPayload",
|
|
332
|
+
"description": "Bytes sealed to a key: a random group element encrypted as `kem`, and the bytes under ChaCha20-Poly1305 with a key derived from it, multibase base58btc (CONVENTIONS §9.4).",
|
|
333
|
+
"type": "object",
|
|
334
|
+
"additionalProperties": false,
|
|
335
|
+
"required": [
|
|
336
|
+
"kem",
|
|
337
|
+
"body"
|
|
338
|
+
],
|
|
339
|
+
"properties": {
|
|
340
|
+
"kem": {
|
|
341
|
+
"$ref": "#/$defs/ElGamalCiphertext"
|
|
342
|
+
},
|
|
343
|
+
"body": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"minLength": 2,
|
|
346
|
+
"maxLength": 131072,
|
|
347
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
354
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
355
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
356
|
+
"$ref": "#/$defs/Response",
|
|
357
|
+
"$defs": {
|
|
358
|
+
"Response": {
|
|
359
|
+
"$anchor": "response",
|
|
360
|
+
"title": "Voting — Ballot — Cast Encrypted — response payload",
|
|
361
|
+
"type": "object",
|
|
362
|
+
"additionalProperties": false,
|
|
363
|
+
"required": [
|
|
364
|
+
"electionId",
|
|
365
|
+
"outcome",
|
|
366
|
+
"leafIndex",
|
|
367
|
+
"entryHash",
|
|
368
|
+
"head",
|
|
369
|
+
"receiptToken"
|
|
370
|
+
],
|
|
371
|
+
"properties": {
|
|
372
|
+
"electionId": {
|
|
373
|
+
"$ref": "#/$defs/ElectionId"
|
|
374
|
+
},
|
|
375
|
+
"outcome": {
|
|
376
|
+
"type": "string",
|
|
377
|
+
"enum": [
|
|
378
|
+
"counted",
|
|
379
|
+
"replaced",
|
|
380
|
+
"alreadyCounted"
|
|
381
|
+
],
|
|
382
|
+
"description": "As voting/ballot/cast."
|
|
383
|
+
},
|
|
384
|
+
"leafIndex": {
|
|
385
|
+
"type": "integer",
|
|
386
|
+
"minimum": 0,
|
|
387
|
+
"description": "The board index of this cast's `encryptedCast` entry."
|
|
388
|
+
},
|
|
389
|
+
"entryHash": {
|
|
390
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
391
|
+
},
|
|
392
|
+
"head": {
|
|
393
|
+
"$ref": "#/$defs/BoardHead"
|
|
394
|
+
},
|
|
395
|
+
"receiptToken": {
|
|
396
|
+
"$ref": "#/$defs/Multibase"
|
|
397
|
+
},
|
|
398
|
+
"ext": {
|
|
399
|
+
"$ref": "#/$defs/Ext"
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"Ext": {
|
|
404
|
+
"title": "Ext",
|
|
405
|
+
"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.",
|
|
406
|
+
"type": "object",
|
|
407
|
+
"minProperties": 1,
|
|
408
|
+
"additionalProperties": true,
|
|
409
|
+
"propertyNames": {
|
|
410
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
"Multibase": {
|
|
414
|
+
"title": "Multibase",
|
|
415
|
+
"description": "A binary value, multibase base58btc over the suite's canonical (compressed) encoding.",
|
|
416
|
+
"type": "string",
|
|
417
|
+
"maxLength": 16384,
|
|
418
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
419
|
+
},
|
|
420
|
+
"BoardHead": {
|
|
421
|
+
"title": "BoardHead",
|
|
422
|
+
"description": "A board's tree head (RFC 9162 §2.1). A head is signed by being carried in a document the ballot box signs; whoever keeps a head keeps that whole document.",
|
|
423
|
+
"type": "object",
|
|
424
|
+
"additionalProperties": false,
|
|
425
|
+
"required": [
|
|
426
|
+
"electionId",
|
|
427
|
+
"treeSize",
|
|
428
|
+
"rootHash",
|
|
429
|
+
"issuedAt"
|
|
430
|
+
],
|
|
431
|
+
"properties": {
|
|
432
|
+
"electionId": {
|
|
433
|
+
"$ref": "#/$defs/ElectionId"
|
|
434
|
+
},
|
|
435
|
+
"treeSize": {
|
|
436
|
+
"type": "integer",
|
|
437
|
+
"minimum": 0
|
|
438
|
+
},
|
|
439
|
+
"rootHash": {
|
|
440
|
+
"$ref": "#/$defs/DigestMultibase",
|
|
441
|
+
"description": "The RFC 9162 Merkle tree hash (SHA-256) of the first `treeSize` entries, as a multihash."
|
|
442
|
+
},
|
|
443
|
+
"issuedAt": {
|
|
444
|
+
"type": "string",
|
|
445
|
+
"format": "date-time"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
"ElectionId": {
|
|
450
|
+
"title": "ElectionId",
|
|
451
|
+
"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.",
|
|
452
|
+
"type": "string",
|
|
453
|
+
"pattern": "^[A-Za-z0-9._-]{1,128}$"
|
|
454
|
+
},
|
|
455
|
+
"DigestMultibase": {
|
|
456
|
+
"title": "DigestMultibase",
|
|
457
|
+
"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`.",
|
|
458
|
+
"type": "string",
|
|
459
|
+
"minLength": 16,
|
|
460
|
+
"pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
|
|
461
|
+
"examples": [
|
|
462
|
+
"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
"EncryptedCast": {
|
|
466
|
+
"title": "EncryptedCast",
|
|
467
|
+
"description": "A cast of a sealed or tallied-encrypted election: exactly one of `sealed` (the Ballot's JCS bytes sealed to the election key) or `encrypted`, with the tag and the attestation over the JCS bytes of whichever is present (CONVENTIONS §3.6, §9.5).",
|
|
468
|
+
"type": "object",
|
|
469
|
+
"additionalProperties": false,
|
|
470
|
+
"required": [
|
|
471
|
+
"tag",
|
|
472
|
+
"attestation"
|
|
473
|
+
],
|
|
474
|
+
"properties": {
|
|
475
|
+
"sealed": {
|
|
476
|
+
"$ref": "#/$defs/SealedPayload"
|
|
477
|
+
},
|
|
478
|
+
"encrypted": {
|
|
479
|
+
"$ref": "#/$defs/EncryptedBallot"
|
|
480
|
+
},
|
|
481
|
+
"tag": {
|
|
482
|
+
"$ref": "#/$defs/Multibase"
|
|
483
|
+
},
|
|
484
|
+
"attestation": {
|
|
485
|
+
"$ref": "#/$defs/Multibase"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
"oneOf": [
|
|
489
|
+
{
|
|
490
|
+
"required": [
|
|
491
|
+
"sealed"
|
|
492
|
+
]
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"required": [
|
|
496
|
+
"encrypted"
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
},
|
|
501
|
+
"EncryptedBallot": {
|
|
502
|
+
"title": "EncryptedBallot",
|
|
503
|
+
"description": "A tallied-encrypted ballot: one EncryptedQuestion per manifest question, in the manifest's order. Never decrypted (VTI-VOT-064).",
|
|
504
|
+
"type": "object",
|
|
505
|
+
"additionalProperties": false,
|
|
506
|
+
"required": [
|
|
507
|
+
"electionId",
|
|
508
|
+
"manifestDigest",
|
|
509
|
+
"questions"
|
|
510
|
+
],
|
|
511
|
+
"properties": {
|
|
512
|
+
"electionId": {
|
|
513
|
+
"$ref": "#/$defs/ElectionId"
|
|
514
|
+
},
|
|
515
|
+
"manifestDigest": {
|
|
516
|
+
"$ref": "#/$defs/DigestMultibase"
|
|
517
|
+
},
|
|
518
|
+
"questions": {
|
|
519
|
+
"type": "array",
|
|
520
|
+
"minItems": 1,
|
|
521
|
+
"maxItems": 64,
|
|
522
|
+
"items": {
|
|
523
|
+
"$ref": "#/$defs/EncryptedQuestion"
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"EncryptedQuestion": {
|
|
529
|
+
"title": "EncryptedQuestion",
|
|
530
|
+
"description": "One choice question of a tallied-encrypted ballot: per option, in the manifest's order, an encryption of 0 or 1 with its proof; and a proof that the selections sum to a count the question admits (CONVENTIONS §9.5).",
|
|
531
|
+
"type": "object",
|
|
532
|
+
"additionalProperties": false,
|
|
533
|
+
"required": [
|
|
534
|
+
"question",
|
|
535
|
+
"options",
|
|
536
|
+
"sumProof"
|
|
537
|
+
],
|
|
538
|
+
"properties": {
|
|
539
|
+
"question": {
|
|
540
|
+
"$ref": "#/$defs/Key"
|
|
541
|
+
},
|
|
542
|
+
"options": {
|
|
543
|
+
"type": "array",
|
|
544
|
+
"minItems": 1,
|
|
545
|
+
"maxItems": 64,
|
|
546
|
+
"items": {
|
|
547
|
+
"$ref": "#/$defs/EncryptedOption"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
"sumProof": {
|
|
551
|
+
"$ref": "#/$defs/DisjunctiveProof"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
"DisjunctiveProof": {
|
|
556
|
+
"title": "DisjunctiveProof",
|
|
557
|
+
"description": "A disjunctive proof that a ciphertext encrypts one value of a public list: one `(c, z)` per value, in the list's order (CONVENTIONS §9.3).",
|
|
558
|
+
"type": "array",
|
|
559
|
+
"minItems": 1,
|
|
560
|
+
"maxItems": 65,
|
|
561
|
+
"items": {
|
|
562
|
+
"$ref": "#/$defs/SigmaProof"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
"SigmaProof": {
|
|
566
|
+
"title": "SigmaProof",
|
|
567
|
+
"description": "A non-interactive sigma proof as its challenge and response `(c, z)` (Schnorr or Chaum–Pedersen; CONVENTIONS §9.3).",
|
|
568
|
+
"type": "object",
|
|
569
|
+
"additionalProperties": false,
|
|
570
|
+
"required": [
|
|
571
|
+
"c",
|
|
572
|
+
"z"
|
|
573
|
+
],
|
|
574
|
+
"properties": {
|
|
575
|
+
"c": {
|
|
576
|
+
"$ref": "#/$defs/GroupScalar"
|
|
577
|
+
},
|
|
578
|
+
"z": {
|
|
579
|
+
"$ref": "#/$defs/GroupScalar"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
"GroupScalar": {
|
|
584
|
+
"title": "GroupScalar",
|
|
585
|
+
"description": "A scalar mod the Ristretto group order: 32 canonical little-endian bytes, multibase base58btc (CONVENTIONS §9.1).",
|
|
586
|
+
"type": "string",
|
|
587
|
+
"minLength": 2,
|
|
588
|
+
"maxLength": 64,
|
|
589
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
590
|
+
},
|
|
591
|
+
"EncryptedOption": {
|
|
592
|
+
"title": "EncryptedOption",
|
|
593
|
+
"type": "object",
|
|
594
|
+
"additionalProperties": false,
|
|
595
|
+
"required": [
|
|
596
|
+
"ciphertext",
|
|
597
|
+
"proof"
|
|
598
|
+
],
|
|
599
|
+
"properties": {
|
|
600
|
+
"ciphertext": {
|
|
601
|
+
"$ref": "#/$defs/ElGamalCiphertext"
|
|
602
|
+
},
|
|
603
|
+
"proof": {
|
|
604
|
+
"$ref": "#/$defs/DisjunctiveProof"
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
"ElGamalCiphertext": {
|
|
609
|
+
"title": "ElGamalCiphertext",
|
|
610
|
+
"description": "`(a, b) = (r·G, M + r·Y)` under the election key `Y` (CONVENTIONS §9.2).",
|
|
611
|
+
"type": "object",
|
|
612
|
+
"additionalProperties": false,
|
|
613
|
+
"required": [
|
|
614
|
+
"a",
|
|
615
|
+
"b"
|
|
616
|
+
],
|
|
617
|
+
"properties": {
|
|
618
|
+
"a": {
|
|
619
|
+
"$ref": "#/$defs/GroupElement"
|
|
620
|
+
},
|
|
621
|
+
"b": {
|
|
622
|
+
"$ref": "#/$defs/GroupElement"
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
"GroupElement": {
|
|
627
|
+
"title": "GroupElement",
|
|
628
|
+
"description": "A Ristretto group element: its 32-byte compression, multibase base58btc. Never the identity (CONVENTIONS §9.1).",
|
|
629
|
+
"type": "string",
|
|
630
|
+
"minLength": 2,
|
|
631
|
+
"maxLength": 64,
|
|
632
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
633
|
+
},
|
|
634
|
+
"Key": {
|
|
635
|
+
"title": "Key",
|
|
636
|
+
"description": "A question or option key, unique within its manifest or question.",
|
|
637
|
+
"type": "string",
|
|
638
|
+
"pattern": "^[A-Za-z0-9._-]{1,64}$"
|
|
639
|
+
},
|
|
640
|
+
"SealedPayload": {
|
|
641
|
+
"title": "SealedPayload",
|
|
642
|
+
"description": "Bytes sealed to a key: a random group element encrypted as `kem`, and the bytes under ChaCha20-Poly1305 with a key derived from it, multibase base58btc (CONVENTIONS §9.4).",
|
|
643
|
+
"type": "object",
|
|
644
|
+
"additionalProperties": false,
|
|
645
|
+
"required": [
|
|
646
|
+
"kem",
|
|
647
|
+
"body"
|
|
648
|
+
],
|
|
649
|
+
"properties": {
|
|
650
|
+
"kem": {
|
|
651
|
+
"$ref": "#/$defs/ElGamalCiphertext"
|
|
652
|
+
},
|
|
653
|
+
"body": {
|
|
654
|
+
"type": "string",
|
|
655
|
+
"minLength": 2,
|
|
656
|
+
"maxLength": 131072,
|
|
657
|
+
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
665
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
666
|
+
* per-specification and cannot be derived from the document alone, and
|
|
667
|
+
* item 2 needs the schema this carries.
|
|
668
|
+
*/
|
|
669
|
+
export const SPEC = {
|
|
670
|
+
typeUri: TYPE_URI,
|
|
671
|
+
isBearer: false,
|
|
672
|
+
isProofRequired: true,
|
|
673
|
+
isRecipientRequired: true,
|
|
674
|
+
isIssuedAtRequired: true,
|
|
675
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
676
|
+
};
|
|
677
|
+
/**
|
|
678
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
679
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
680
|
+
* parties (§7.3 item 5).
|
|
681
|
+
*/
|
|
682
|
+
export const RESPONSE_SPEC = {
|
|
683
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
684
|
+
isBearer: false,
|
|
685
|
+
isProofRequired: true,
|
|
686
|
+
isRecipientRequired: true,
|
|
687
|
+
isIssuedAtRequired: true,
|
|
688
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
689
|
+
};
|
|
690
|
+
//# sourceMappingURL=payload.js.map
|