@openvtc/trust-tasks 0.26.19 → 0.26.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/_shared/components.d.ts +328 -17
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/device/list/0.2/payload.d.ts +4 -4
  5. package/dist/device/list/0.2/payload.d.ts.map +1 -1
  6. package/dist/device/list/0.2/payload.js +4 -2
  7. package/dist/device/list/0.2/payload.js.map +1 -1
  8. package/dist/device/register/0.2/payload.d.ts +4 -4
  9. package/dist/device/register/0.2/payload.d.ts.map +1 -1
  10. package/dist/device/register/0.2/payload.js +4 -2
  11. package/dist/device/register/0.2/payload.js.map +1 -1
  12. package/dist/index.d.ts +24 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +24 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/voting/_shared/0.1/voting.d.ts +16 -0
  17. package/dist/voting/_shared/0.1/voting.d.ts.map +1 -0
  18. package/dist/voting/_shared/0.1/voting.js +6 -0
  19. package/dist/voting/_shared/0.1/voting.js.map +1 -0
  20. package/dist/voting/ballot/cast/0.1/payload.d.ts +887 -0
  21. package/dist/voting/ballot/cast/0.1/payload.d.ts.map +1 -0
  22. package/dist/voting/ballot/cast/0.1/payload.js +506 -0
  23. package/dist/voting/ballot/cast/0.1/payload.js.map +1 -0
  24. package/dist/voting/board/consistency/0.1/payload.d.ts +389 -0
  25. package/dist/voting/board/consistency/0.1/payload.d.ts.map +1 -0
  26. package/dist/voting/board/consistency/0.1/payload.js +218 -0
  27. package/dist/voting/board/consistency/0.1/payload.js.map +1 -0
  28. package/dist/voting/board/head/0.1/payload.d.ts +380 -0
  29. package/dist/voting/board/head/0.1/payload.d.ts.map +1 -0
  30. package/dist/voting/board/head/0.1/payload.js +224 -0
  31. package/dist/voting/board/head/0.1/payload.js.map +1 -0
  32. package/dist/voting/board/inclusion/0.1/payload.d.ts +449 -0
  33. package/dist/voting/board/inclusion/0.1/payload.d.ts.map +1 -0
  34. package/dist/voting/board/inclusion/0.1/payload.js +246 -0
  35. package/dist/voting/board/inclusion/0.1/payload.js.map +1 -0
  36. package/dist/voting/board/read/0.1/payload.d.ts +1596 -0
  37. package/dist/voting/board/read/0.1/payload.d.ts.map +1 -0
  38. package/dist/voting/board/read/0.1/payload.js +920 -0
  39. package/dist/voting/board/read/0.1/payload.js.map +1 -0
  40. package/dist/voting/election/cancel/0.1/payload.d.ts +540 -0
  41. package/dist/voting/election/cancel/0.1/payload.d.ts.map +1 -0
  42. package/dist/voting/election/cancel/0.1/payload.js +331 -0
  43. package/dist/voting/election/cancel/0.1/payload.js.map +1 -0
  44. package/dist/voting/election/close/0.1/payload.d.ts +540 -0
  45. package/dist/voting/election/close/0.1/payload.d.ts.map +1 -0
  46. package/dist/voting/election/close/0.1/payload.js +330 -0
  47. package/dist/voting/election/close/0.1/payload.js.map +1 -0
  48. package/dist/voting/election/register/0.1/payload.d.ts +1920 -0
  49. package/dist/voting/election/register/0.1/payload.d.ts.map +1 -0
  50. package/dist/voting/election/register/0.1/payload.js +1166 -0
  51. package/dist/voting/election/register/0.1/payload.js.map +1 -0
  52. package/dist/voting/election/show/0.1/payload.d.ts +1824 -0
  53. package/dist/voting/election/show/0.1/payload.d.ts.map +1 -0
  54. package/dist/voting/election/show/0.1/payload.js +1112 -0
  55. package/dist/voting/election/show/0.1/payload.js.map +1 -0
  56. package/dist/voting/result/show/0.1/payload.d.ts +849 -0
  57. package/dist/voting/result/show/0.1/payload.d.ts.map +1 -0
  58. package/dist/voting/result/show/0.1/payload.js +498 -0
  59. package/dist/voting/result/show/0.1/payload.js.map +1 -0
  60. package/dist/vta/_shared/0.1/app-state-record.d.ts +1 -1
  61. package/dist/vta/_shared/0.1/app-state-record.d.ts.map +1 -1
  62. package/dist/vta/_shared/0.4/pcs-engine.d.ts +1 -1
  63. package/dist/vta/_shared/0.4/pcs-engine.d.ts.map +1 -1
  64. package/dist/vta/app-state/delete/1.0/payload.d.ts +1 -1
  65. package/dist/vta/app-state/delete/1.0/payload.d.ts.map +1 -1
  66. package/dist/vta/app-state/get/1.0/payload.d.ts +1 -1
  67. package/dist/vta/app-state/get/1.0/payload.d.ts.map +1 -1
  68. package/dist/vta/app-state/get-many/1.0/payload.d.ts +1 -1
  69. package/dist/vta/app-state/get-many/1.0/payload.d.ts.map +1 -1
  70. package/dist/vta/app-state/list/1.0/payload.d.ts +1 -1
  71. package/dist/vta/app-state/list/1.0/payload.d.ts.map +1 -1
  72. package/dist/vta/app-state/put/1.0/payload.d.ts +1 -1
  73. package/dist/vta/app-state/put/1.0/payload.d.ts.map +1 -1
  74. package/dist/vta/app-state/put-many/1.0/payload.d.ts +1 -1
  75. package/dist/vta/app-state/put-many/1.0/payload.d.ts.map +1 -1
  76. package/dist/vta/pcs/applications/create/0.1/payload.d.ts +1 -1
  77. package/dist/vta/pcs/applications/create/0.1/payload.d.ts.map +1 -1
  78. package/dist/vta/pcs/applications/show/0.1/payload.d.ts +1 -1
  79. package/dist/vta/pcs/applications/show/0.1/payload.d.ts.map +1 -1
  80. package/dist/vta/pcs/attest/0.1/payload.d.ts +1 -1
  81. package/dist/vta/pcs/attest/0.1/payload.d.ts.map +1 -1
  82. package/dist/vta/pcs/prove/0.1/payload.d.ts +1 -1
  83. package/dist/vta/pcs/prove/0.1/payload.d.ts.map +1 -1
  84. package/dist/vta/pcs/root-accept/0.1/payload.d.ts +1 -1
  85. package/dist/vta/pcs/root-accept/0.1/payload.d.ts.map +1 -1
  86. package/dist/vta/pcs/tokens/abandon/0.1/payload.d.ts +1 -1
  87. package/dist/vta/pcs/tokens/abandon/0.1/payload.d.ts.map +1 -1
  88. package/dist/vta/pcs/tokens/accept/0.1/payload.d.ts +1 -1
  89. package/dist/vta/pcs/tokens/accept/0.1/payload.d.ts.map +1 -1
  90. package/dist/vta/pcs/verify-attestation/0.1/payload.d.ts +1 -1
  91. package/dist/vta/pcs/verify-attestation/0.1/payload.d.ts.map +1 -1
  92. package/dist/vta/pcs/vetter/show/0.1/payload.d.ts +1 -1
  93. package/dist/vta/pcs/vetter/show/0.1/payload.d.ts.map +1 -1
  94. package/dist/vta/pcs/vote/0.1/payload.d.ts +2208 -0
  95. package/dist/vta/pcs/vote/0.1/payload.d.ts.map +1 -0
  96. package/dist/vta/pcs/vote/0.1/payload.js +1282 -0
  97. package/dist/vta/pcs/vote/0.1/payload.js.map +1 -0
  98. package/dist/vta/pcs/voter/accept/0.1/payload.d.ts +450 -0
  99. package/dist/vta/pcs/voter/accept/0.1/payload.d.ts.map +1 -0
  100. package/dist/vta/pcs/voter/accept/0.1/payload.js +247 -0
  101. package/dist/vta/pcs/voter/accept/0.1/payload.js.map +1 -0
  102. package/dist/vta/pcs/voter/receipt/0.1/payload.d.ts +531 -0
  103. package/dist/vta/pcs/voter/receipt/0.1/payload.d.ts.map +1 -0
  104. package/dist/vta/pcs/voter/receipt/0.1/payload.js +301 -0
  105. package/dist/vta/pcs/voter/receipt/0.1/payload.js.map +1 -0
  106. package/dist/vta/pcs/voter/register/0.1/payload.d.ts +1934 -0
  107. package/dist/vta/pcs/voter/register/0.1/payload.d.ts.map +1 -0
  108. package/dist/vta/pcs/voter/register/0.1/payload.js +1133 -0
  109. package/dist/vta/pcs/voter/register/0.1/payload.js.map +1 -0
  110. package/dist/vtc/directory/card/present/0.1/payload.d.ts +2 -2
  111. package/dist/vtc/directory/card/present/0.1/payload.js +1 -1
  112. package/dist/vtc/directory/card/present/0.1/payload.js.map +1 -1
  113. package/dist/vtc/directory/card/public/0.1/payload.d.ts +4 -4
  114. package/dist/vtc/directory/card/public/0.1/payload.js +2 -2
  115. package/dist/vtc/directory/card/public/0.1/payload.js.map +1 -1
  116. package/dist/vtc/directory/card/publish/0.1/payload.d.ts +4 -4
  117. package/dist/vtc/directory/card/publish/0.1/payload.js +2 -2
  118. package/dist/vtc/directory/card/publish/0.1/payload.js.map +1 -1
  119. package/dist/vtc/elections/cancel/0.1/payload.d.ts +301 -0
  120. package/dist/vtc/elections/cancel/0.1/payload.d.ts.map +1 -0
  121. package/dist/vtc/elections/cancel/0.1/payload.js +183 -0
  122. package/dist/vtc/elections/cancel/0.1/payload.js.map +1 -0
  123. package/dist/vtc/elections/certify/0.1/payload.d.ts +914 -0
  124. package/dist/vtc/elections/certify/0.1/payload.d.ts.map +1 -0
  125. package/dist/vtc/elections/certify/0.1/payload.js +512 -0
  126. package/dist/vtc/elections/certify/0.1/payload.js.map +1 -0
  127. package/dist/vtc/elections/close/0.1/payload.d.ts +301 -0
  128. package/dist/vtc/elections/close/0.1/payload.d.ts.map +1 -0
  129. package/dist/vtc/elections/close/0.1/payload.js +182 -0
  130. package/dist/vtc/elections/close/0.1/payload.js.map +1 -0
  131. package/dist/vtc/elections/create/0.1/payload.d.ts +1656 -0
  132. package/dist/vtc/elections/create/0.1/payload.d.ts.map +1 -0
  133. package/dist/vtc/elections/create/0.1/payload.js +994 -0
  134. package/dist/vtc/elections/create/0.1/payload.js.map +1 -0
  135. package/dist/vtc/elections/list/0.1/payload.d.ts +521 -0
  136. package/dist/vtc/elections/list/0.1/payload.d.ts.map +1 -0
  137. package/dist/vtc/elections/list/0.1/payload.js +290 -0
  138. package/dist/vtc/elections/list/0.1/payload.js.map +1 -0
  139. package/dist/vtc/elections/show/0.1/payload.d.ts +2688 -0
  140. package/dist/vtc/elections/show/0.1/payload.d.ts.map +1 -0
  141. package/dist/vtc/elections/show/0.1/payload.js +1581 -0
  142. package/dist/vtc/elections/show/0.1/payload.js.map +1 -0
  143. package/dist/vtc/elections/tickets/issue/0.1/payload.d.ts +597 -0
  144. package/dist/vtc/elections/tickets/issue/0.1/payload.d.ts.map +1 -0
  145. package/dist/vtc/elections/tickets/issue/0.1/payload.js +318 -0
  146. package/dist/vtc/elections/tickets/issue/0.1/payload.js.map +1 -0
  147. package/dist/vtc/groups/create/0.1/payload.d.ts +4 -4
  148. package/dist/vtc/groups/create/0.1/payload.js +2 -2
  149. package/dist/vtc/groups/create/0.1/payload.js.map +1 -1
  150. package/dist/vtc/groups/list/0.1/payload.d.ts +4 -4
  151. package/dist/vtc/groups/list/0.1/payload.js +2 -2
  152. package/dist/vtc/groups/list/0.1/payload.js.map +1 -1
  153. package/dist/vtc/groups/managers/add/0.1/payload.d.ts +337 -0
  154. package/dist/vtc/groups/managers/add/0.1/payload.d.ts.map +1 -0
  155. package/dist/vtc/groups/managers/add/0.1/payload.js +184 -0
  156. package/dist/vtc/groups/managers/add/0.1/payload.js.map +1 -0
  157. package/dist/vtc/groups/managers/remove/0.1/payload.d.ts +337 -0
  158. package/dist/vtc/groups/managers/remove/0.1/payload.d.ts.map +1 -0
  159. package/dist/vtc/groups/managers/remove/0.1/payload.js +184 -0
  160. package/dist/vtc/groups/managers/remove/0.1/payload.js.map +1 -0
  161. package/dist/vtc/groups/show/0.1/payload.d.ts +4 -4
  162. package/dist/vtc/groups/show/0.1/payload.js +2 -2
  163. package/dist/vtc/groups/show/0.1/payload.js.map +1 -1
  164. package/dist/vtc/groups/update/0.1/payload.d.ts +4 -4
  165. package/dist/vtc/groups/update/0.1/payload.js +2 -2
  166. package/dist/vtc/groups/update/0.1/payload.js.map +1 -1
  167. package/package.json +1 -1
  168. package/src/_shared/components.ts +331 -17
  169. package/src/device/list/0.2/payload.ts +4 -2
  170. package/src/device/register/0.2/payload.ts +4 -2
  171. package/src/index.ts +24 -0
  172. package/src/voting/_shared/0.1/voting.ts +17 -0
  173. package/src/voting/ballot/cast/0.1/payload.ts +560 -0
  174. package/src/voting/board/consistency/0.1/payload.ts +264 -0
  175. package/src/voting/board/head/0.1/payload.ts +257 -0
  176. package/src/voting/board/inclusion/0.1/payload.ts +300 -0
  177. package/src/voting/board/read/0.1/payload.ts +981 -0
  178. package/src/voting/election/cancel/0.1/payload.ts +368 -0
  179. package/src/voting/election/close/0.1/payload.ts +367 -0
  180. package/src/voting/election/register/0.1/payload.ts +1207 -0
  181. package/src/voting/election/show/0.1/payload.ts +1149 -0
  182. package/src/voting/result/show/0.1/payload.ts +536 -0
  183. package/src/vta/_shared/0.1/app-state-record.ts +1 -1
  184. package/src/vta/_shared/0.4/pcs-engine.ts +1 -1
  185. package/src/vta/app-state/delete/1.0/payload.ts +1 -1
  186. package/src/vta/app-state/get/1.0/payload.ts +1 -1
  187. package/src/vta/app-state/get-many/1.0/payload.ts +1 -1
  188. package/src/vta/app-state/list/1.0/payload.ts +1 -1
  189. package/src/vta/app-state/put/1.0/payload.ts +1 -1
  190. package/src/vta/app-state/put-many/1.0/payload.ts +1 -1
  191. package/src/vta/pcs/applications/create/0.1/payload.ts +1 -1
  192. package/src/vta/pcs/applications/show/0.1/payload.ts +1 -1
  193. package/src/vta/pcs/attest/0.1/payload.ts +1 -1
  194. package/src/vta/pcs/prove/0.1/payload.ts +1 -1
  195. package/src/vta/pcs/root-accept/0.1/payload.ts +1 -1
  196. package/src/vta/pcs/tokens/abandon/0.1/payload.ts +1 -1
  197. package/src/vta/pcs/tokens/accept/0.1/payload.ts +1 -1
  198. package/src/vta/pcs/verify-attestation/0.1/payload.ts +1 -1
  199. package/src/vta/pcs/vetter/show/0.1/payload.ts +1 -1
  200. package/src/vta/pcs/vote/0.1/payload.ts +1365 -0
  201. package/src/vta/pcs/voter/accept/0.1/payload.ts +306 -0
  202. package/src/vta/pcs/voter/receipt/0.1/payload.ts +367 -0
  203. package/src/vta/pcs/voter/register/0.1/payload.ts +1211 -0
  204. package/src/vtc/directory/card/present/0.1/payload.ts +1 -1
  205. package/src/vtc/directory/card/public/0.1/payload.ts +2 -2
  206. package/src/vtc/directory/card/publish/0.1/payload.ts +2 -2
  207. package/src/vtc/elections/cancel/0.1/payload.ts +223 -0
  208. package/src/vtc/elections/certify/0.1/payload.ts +565 -0
  209. package/src/vtc/elections/close/0.1/payload.ts +222 -0
  210. package/src/vtc/elections/create/0.1/payload.ts +1041 -0
  211. package/src/vtc/elections/list/0.1/payload.ts +371 -0
  212. package/src/vtc/elections/show/0.1/payload.ts +1671 -0
  213. package/src/vtc/elections/tickets/issue/0.1/payload.ts +394 -0
  214. package/src/vtc/groups/create/0.1/payload.ts +2 -2
  215. package/src/vtc/groups/list/0.1/payload.ts +2 -2
  216. package/src/vtc/groups/managers/add/0.1/payload.ts +230 -0
  217. package/src/vtc/groups/managers/remove/0.1/payload.ts +230 -0
  218. package/src/vtc/groups/show/0.1/payload.ts +2 -2
  219. package/src/vtc/groups/update/0.1/payload.ts +2 -2
@@ -0,0 +1,1365 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/vta/pcs/vote/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { Answer, Ballot, BoardVisibility, ChoiceQuestion, DigestMultibase, ElectionId, Ext, Key_VotingV0_1 as Key, Manifest, Multibase_VotingV0_1 as Multibase, Question, QuestionOption, RankingQuestion, Revote, RollRule, ScoreQuestion, SecrecyLevel, TextQuestion, Trustees, VotingParameters } from "../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * A voter's client hands its VTA a ballot; the VTA checks it against the election's manifest, makes the ticket's attestation over it, and returns the complete voting/ballot/cast document, signed by a did:key used for this cast alone, for the client to send.
11
+ */
12
+ export interface VTAPCSVotePayload {
13
+ /**
14
+ * The context the voter belongs to.
15
+ */
16
+ contextId: string;
17
+ /**
18
+ * The community's DID. MUST equal the manifest's `community`.
19
+ */
20
+ community: string;
21
+ /**
22
+ * The community's published voting parameters. Its `votingKey` MUST be the one the ticket was issued under.
23
+ */
24
+ parameters: VotingParameters;
25
+ /**
26
+ * The election's manifest, exactly as registered. The engine recomputes its digest and checks it against the one it recorded at voter/register.
27
+ */
28
+ manifest: Manifest;
29
+ /**
30
+ * The voter's ballot. The cast binds its RFC 8785 (JCS) canonicalization.
31
+ */
32
+ ballot: Ballot;
33
+ ext?: Ext;
34
+ }
35
+ export interface VTAPCSVoteResponsePayload {
36
+ castDocument: CastDocument;
37
+ /**
38
+ * The cast's tag (the election's nullifier for this ticket), as the cast carries it. The same for every cast this ticket makes in this election.
39
+ */
40
+ tag: string;
41
+ ext?: Ext;
42
+ }
43
+ /**
44
+ * A complete, signed voting/ballot/cast/0.1 request document, ready to send to the ballot box. Its payload is validated by that specification's schema; the members fixed here are the ones this task guarantees.
45
+ */
46
+ export interface CastDocument {
47
+ /**
48
+ * A random (version 4) UUID URN, generated for this cast and derived from nothing else.
49
+ */
50
+ id: string;
51
+ type: "https://trusttasks.org/spec/voting/ballot/cast/0.1#request";
52
+ /**
53
+ * The did:key generated for this cast alone (VTI-VOT-003).
54
+ */
55
+ issuer: string;
56
+ /**
57
+ * The manifest's `ballotBox`.
58
+ */
59
+ recipient: string;
60
+ issuedAt: string;
61
+ /**
62
+ * When present, the manifest's `votingCloses`.
63
+ */
64
+ expiresAt?: string;
65
+ /**
66
+ * The voting/ballot/cast/0.1 request payload — `community`, `electionId` and the Cast the engine built — and nothing else.
67
+ */
68
+ payload: {};
69
+ /**
70
+ * The Data Integrity proof made with the cast's one-time key.
71
+ */
72
+ proof: {};
73
+ }
74
+
75
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
76
+ export type { Answer, Ballot, BoardVisibility, ChoiceQuestion, DigestMultibase, ElectionId, Ext, Key, Manifest, Multibase, Question, QuestionOption, RankingQuestion, Revote, RollRule, ScoreQuestion, SecrecyLevel, TextQuestion, Trustees, VotingParameters };
77
+
78
+ /** Trust Task type URI. */
79
+ export const TYPE_URI = "https://trusttasks.org/spec/vta/pcs/vote/0.1" as const;
80
+
81
+ /** Stable alias for this specification's request payload shape. */
82
+ export type Payload = VTAPCSVotePayload;
83
+
84
+ /** Trust Task response type URI (request type URI + "#response"). */
85
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/vta/pcs/vote/0.1#response" as const;
86
+
87
+ /** Stable alias for this specification's success-response payload shape. */
88
+ export type Response = VTAPCSVoteResponsePayload;
89
+
90
+ /**
91
+ * This specification's payload schema, as a value.
92
+ *
93
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
94
+ * rather than only as a `.json` file because TypeScript types are erased
95
+ * at runtime: without a schema a consumer has nothing to validate, and
96
+ * every REQUIRED payload member is optional in practice. Cross-file
97
+ * `$ref`s are already inlined, so it needs no resolver.
98
+ */
99
+ export const PAYLOAD_SCHEMA = {
100
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
101
+ "$id": "https://trusttasks.org/spec/vta/pcs/vote/0.1",
102
+ "title": "VTA PCS — Vote — payload",
103
+ "description": "A voter's client hands its VTA a ballot; the VTA checks it against the election's manifest, makes the ticket's attestation over it, and returns the complete voting/ballot/cast document, signed by a did:key used for this cast alone, for the client to send.",
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": [
107
+ "contextId",
108
+ "community",
109
+ "parameters",
110
+ "manifest",
111
+ "ballot"
112
+ ],
113
+ "properties": {
114
+ "contextId": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "maxLength": 256,
118
+ "description": "The context the voter belongs to."
119
+ },
120
+ "community": {
121
+ "type": "string",
122
+ "minLength": 1,
123
+ "maxLength": 2048,
124
+ "description": "The community's DID. MUST equal the manifest's `community`."
125
+ },
126
+ "parameters": {
127
+ "$ref": "#/$defs/VotingParameters",
128
+ "description": "The community's published voting parameters. Its `votingKey` MUST be the one the ticket was issued under."
129
+ },
130
+ "manifest": {
131
+ "$ref": "#/$defs/Manifest",
132
+ "description": "The election's manifest, exactly as registered. The engine recomputes its digest and checks it against the one it recorded at voter/register."
133
+ },
134
+ "ballot": {
135
+ "$ref": "#/$defs/Ballot",
136
+ "description": "The voter's ballot. The cast binds its RFC 8785 (JCS) canonicalization."
137
+ },
138
+ "ext": {
139
+ "$ref": "#/$defs/Ext"
140
+ }
141
+ },
142
+ "$defs": {
143
+ "CastDocument": {
144
+ "title": "CastDocument",
145
+ "description": "A complete, signed voting/ballot/cast/0.1 request document, ready to send to the ballot box. Its payload is validated by that specification's schema; the members fixed here are the ones this task guarantees.",
146
+ "type": "object",
147
+ "required": [
148
+ "id",
149
+ "type",
150
+ "issuer",
151
+ "recipient",
152
+ "issuedAt",
153
+ "payload",
154
+ "proof"
155
+ ],
156
+ "properties": {
157
+ "id": {
158
+ "type": "string",
159
+ "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}$",
160
+ "description": "A random (version 4) UUID URN, generated for this cast and derived from nothing else."
161
+ },
162
+ "type": {
163
+ "const": "https://trusttasks.org/spec/voting/ballot/cast/0.1#request"
164
+ },
165
+ "issuer": {
166
+ "type": "string",
167
+ "maxLength": 256,
168
+ "pattern": "^did:key:z[1-9A-HJ-NP-Za-km-z]+$",
169
+ "description": "The did:key generated for this cast alone (VTI-VOT-003)."
170
+ },
171
+ "recipient": {
172
+ "type": "string",
173
+ "minLength": 1,
174
+ "maxLength": 2048,
175
+ "description": "The manifest's `ballotBox`."
176
+ },
177
+ "issuedAt": {
178
+ "type": "string",
179
+ "format": "date-time"
180
+ },
181
+ "expiresAt": {
182
+ "type": "string",
183
+ "format": "date-time",
184
+ "description": "When present, the manifest's `votingCloses`."
185
+ },
186
+ "payload": {
187
+ "type": "object",
188
+ "description": "The voting/ballot/cast/0.1 request payload — `community`, `electionId` and the Cast the engine built — and nothing else."
189
+ },
190
+ "proof": {
191
+ "type": "object",
192
+ "description": "The Data Integrity proof made with the cast's one-time key."
193
+ }
194
+ }
195
+ },
196
+ "Response": {
197
+ "$anchor": "response",
198
+ "title": "VTA PCS — Vote — response payload",
199
+ "type": "object",
200
+ "additionalProperties": false,
201
+ "required": [
202
+ "castDocument",
203
+ "tag"
204
+ ],
205
+ "properties": {
206
+ "castDocument": {
207
+ "$ref": "#/$defs/CastDocument"
208
+ },
209
+ "tag": {
210
+ "type": "string",
211
+ "maxLength": 4096,
212
+ "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$",
213
+ "description": "The cast's tag (the election's nullifier for this ticket), as the cast carries it. The same for every cast this ticket makes in this election."
214
+ },
215
+ "ext": {
216
+ "$ref": "#/$defs/Ext"
217
+ }
218
+ }
219
+ },
220
+ "Ext": {
221
+ "title": "Ext",
222
+ "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.",
223
+ "type": "object",
224
+ "minProperties": 1,
225
+ "additionalProperties": true,
226
+ "propertyNames": {
227
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
228
+ }
229
+ },
230
+ "Ballot": {
231
+ "title": "Ballot",
232
+ "description": "An open ballot: one answer per question of the manifest, in any order. The bytes a cast's proof binds are the RFC 8785 (JCS) canonicalization of this object as received.",
233
+ "type": "object",
234
+ "additionalProperties": false,
235
+ "required": [
236
+ "electionId",
237
+ "manifestDigest",
238
+ "answers"
239
+ ],
240
+ "properties": {
241
+ "electionId": {
242
+ "$ref": "#/$defs/ElectionId"
243
+ },
244
+ "manifestDigest": {
245
+ "$ref": "#/$defs/DigestMultibase"
246
+ },
247
+ "answers": {
248
+ "type": "array",
249
+ "minItems": 1,
250
+ "maxItems": 128,
251
+ "items": {
252
+ "$ref": "#/$defs/Answer"
253
+ }
254
+ }
255
+ }
256
+ },
257
+ "Answer": {
258
+ "title": "Answer",
259
+ "description": "The answer to one question. Exactly one member besides `question` is present, matching the question's type, or `abstain` for an optional question left unanswered.",
260
+ "type": "object",
261
+ "additionalProperties": false,
262
+ "required": [
263
+ "question"
264
+ ],
265
+ "minProperties": 2,
266
+ "maxProperties": 2,
267
+ "properties": {
268
+ "question": {
269
+ "$ref": "#/$defs/Key"
270
+ },
271
+ "choice": {
272
+ "type": "array",
273
+ "items": {
274
+ "$ref": "#/$defs/Key"
275
+ },
276
+ "uniqueItems": true
277
+ },
278
+ "ranking": {
279
+ "type": "array",
280
+ "items": {
281
+ "$ref": "#/$defs/Key"
282
+ },
283
+ "uniqueItems": true
284
+ },
285
+ "scores": {
286
+ "type": "object",
287
+ "propertyNames": {
288
+ "$ref": "#/$defs/Key"
289
+ },
290
+ "additionalProperties": {
291
+ "type": "integer"
292
+ }
293
+ },
294
+ "text": {
295
+ "type": "string",
296
+ "maxLength": 4096
297
+ },
298
+ "abstain": {
299
+ "const": true
300
+ }
301
+ }
302
+ },
303
+ "Key": {
304
+ "title": "Key",
305
+ "description": "A question or option key, unique within its manifest or question.",
306
+ "type": "string",
307
+ "pattern": "^[A-Za-z0-9._-]{1,64}$"
308
+ },
309
+ "ElectionId": {
310
+ "title": "ElectionId",
311
+ "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.",
312
+ "type": "string",
313
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
314
+ },
315
+ "DigestMultibase": {
316
+ "title": "DigestMultibase",
317
+ "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`.",
318
+ "type": "string",
319
+ "minLength": 16,
320
+ "pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
321
+ "examples": [
322
+ "zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
323
+ ]
324
+ },
325
+ "Manifest": {
326
+ "title": "Manifest",
327
+ "description": "What an election asks and how it is decided (VTI-VOT-010). Its digest (`manifestDigest`) is the SHA-256 multihash of its RFC 8785 (JCS) canonicalization, and every cast is bound to it (VTI-VOT-011).",
328
+ "type": "object",
329
+ "additionalProperties": false,
330
+ "required": [
331
+ "electionId",
332
+ "community",
333
+ "questions",
334
+ "secrecy",
335
+ "roll",
336
+ "registrationOpens",
337
+ "votingOpens",
338
+ "votingCloses",
339
+ "revote",
340
+ "board",
341
+ "ballotBox",
342
+ "binding",
343
+ "allowEarlyClose",
344
+ "resultsBeforeClose",
345
+ "textReleaseThreshold"
346
+ ],
347
+ "properties": {
348
+ "electionId": {
349
+ "$ref": "#/$defs/ElectionId"
350
+ },
351
+ "community": {
352
+ "type": "string",
353
+ "minLength": 1,
354
+ "maxLength": 2048,
355
+ "description": "The community's DID."
356
+ },
357
+ "title": {
358
+ "type": "string",
359
+ "maxLength": 512
360
+ },
361
+ "description": {
362
+ "type": "string",
363
+ "maxLength": 8192
364
+ },
365
+ "questions": {
366
+ "type": "array",
367
+ "minItems": 1,
368
+ "maxItems": 128,
369
+ "items": {
370
+ "$ref": "#/$defs/Question"
371
+ }
372
+ },
373
+ "secrecy": {
374
+ "$ref": "#/$defs/SecrecyLevel"
375
+ },
376
+ "roll": {
377
+ "$ref": "#/$defs/RollRule"
378
+ },
379
+ "registrationOpens": {
380
+ "type": "string",
381
+ "format": "date-time"
382
+ },
383
+ "votingOpens": {
384
+ "type": "string",
385
+ "format": "date-time"
386
+ },
387
+ "votingCloses": {
388
+ "type": "string",
389
+ "format": "date-time"
390
+ },
391
+ "revote": {
392
+ "$ref": "#/$defs/Revote"
393
+ },
394
+ "board": {
395
+ "type": "object",
396
+ "additionalProperties": false,
397
+ "required": [
398
+ "visibility",
399
+ "auditors"
400
+ ],
401
+ "properties": {
402
+ "visibility": {
403
+ "$ref": "#/$defs/BoardVisibility"
404
+ },
405
+ "auditors": {
406
+ "type": "array",
407
+ "items": {
408
+ "type": "string",
409
+ "minLength": 1,
410
+ "maxLength": 2048
411
+ },
412
+ "uniqueItems": true
413
+ }
414
+ }
415
+ },
416
+ "ballotBox": {
417
+ "type": "string",
418
+ "minLength": 1,
419
+ "maxLength": 2048,
420
+ "description": "The DID of the voting service that holds the board."
421
+ },
422
+ "trustees": {
423
+ "$ref": "#/$defs/Trustees"
424
+ },
425
+ "binding": {
426
+ "type": "boolean",
427
+ "description": "Whether the community treats the result as deciding something; creating a binding election takes another administrator's consent (VTI-VOT-081)."
428
+ },
429
+ "allowEarlyClose": {
430
+ "type": "boolean"
431
+ },
432
+ "resultsBeforeClose": {
433
+ "type": "boolean",
434
+ "description": "Open elections only: whether running totals may be read while voting is open (VTI-VOT-061)."
435
+ },
436
+ "textReleaseThreshold": {
437
+ "type": "integer",
438
+ "minimum": 10,
439
+ "description": "Counted ballots required before any text answer is disclosed (VTI-VOT-065)."
440
+ }
441
+ }
442
+ },
443
+ "Trustees": {
444
+ "title": "Trustees",
445
+ "description": "The trustees of a sealed or tallied-encrypted election and the number of them decryption needs (VTI-VOT-062). Neither the community nor the ballot box may be one.",
446
+ "type": "object",
447
+ "additionalProperties": false,
448
+ "required": [
449
+ "dids",
450
+ "threshold"
451
+ ],
452
+ "properties": {
453
+ "dids": {
454
+ "type": "array",
455
+ "minItems": 2,
456
+ "items": {
457
+ "type": "string",
458
+ "minLength": 1,
459
+ "maxLength": 2048
460
+ },
461
+ "uniqueItems": true
462
+ },
463
+ "threshold": {
464
+ "type": "integer",
465
+ "minimum": 2
466
+ }
467
+ }
468
+ },
469
+ "BoardVisibility": {
470
+ "title": "BoardVisibility",
471
+ "description": "`public`: anyone reads the board. `private`: the community, the auditors the manifest names and, for one cast's inclusion, the holder of its receipt (VTI-VOT-052).",
472
+ "type": "string",
473
+ "enum": [
474
+ "public",
475
+ "private"
476
+ ]
477
+ },
478
+ "Revote": {
479
+ "title": "Revote",
480
+ "description": "What a later, different ballot under one ticket does: `replace` the earlier one, or be refused (`refuse`) (VTI-VOT-041).",
481
+ "type": "string",
482
+ "enum": [
483
+ "replace",
484
+ "refuse"
485
+ ]
486
+ },
487
+ "RollRule": {
488
+ "title": "RollRule",
489
+ "description": "Who may be issued a ticket (VTI-VOT-021): the community's active members, its active members and the parties `listed` names, or only the parties `listed` names.",
490
+ "type": "object",
491
+ "additionalProperties": false,
492
+ "required": [
493
+ "rule"
494
+ ],
495
+ "properties": {
496
+ "rule": {
497
+ "type": "string",
498
+ "enum": [
499
+ "members",
500
+ "membersAndListed",
501
+ "listed"
502
+ ]
503
+ },
504
+ "listed": {
505
+ "type": "array",
506
+ "items": {
507
+ "type": "string",
508
+ "minLength": 1,
509
+ "maxLength": 2048,
510
+ "description": "A DID enfranchised by name."
511
+ },
512
+ "uniqueItems": true
513
+ }
514
+ }
515
+ },
516
+ "SecrecyLevel": {
517
+ "title": "SecrecyLevel",
518
+ "description": "`open`: ballots are recorded on the board as cast. `sealed`: ballots are encrypted to a jointly generated election key and decrypted after voting closes. `talliedEncrypted`: ballots are encrypted and only the totals are ever decrypted (VTI-VOT-060). Version 0.1 of the voting tasks carries open ballots only; a ballot box refuses to register any other level with `voting/election/register:unsupportedSecrecy` until the trustee tasks are specified.",
519
+ "type": "string",
520
+ "enum": [
521
+ "open",
522
+ "sealed",
523
+ "talliedEncrypted"
524
+ ]
525
+ },
526
+ "Question": {
527
+ "title": "Question",
528
+ "description": "One question. Tagged union over `type`.",
529
+ "oneOf": [
530
+ {
531
+ "title": "ChoiceQuestion",
532
+ "description": "Select between `minSelections` and `maxSelections` of `options`. A yes/no/abstain motion is a choice of exactly one of three.",
533
+ "type": "object",
534
+ "additionalProperties": false,
535
+ "required": [
536
+ "key",
537
+ "type",
538
+ "options",
539
+ "minSelections",
540
+ "maxSelections",
541
+ "optional"
542
+ ],
543
+ "properties": {
544
+ "key": {
545
+ "$ref": "#/$defs/Key"
546
+ },
547
+ "type": {
548
+ "const": "choice"
549
+ },
550
+ "text": {
551
+ "type": "string",
552
+ "maxLength": 2048
553
+ },
554
+ "options": {
555
+ "type": "array",
556
+ "minItems": 2,
557
+ "maxItems": 256,
558
+ "items": {
559
+ "$ref": "#/$defs/QuestionOption"
560
+ }
561
+ },
562
+ "minSelections": {
563
+ "type": "integer",
564
+ "minimum": 0
565
+ },
566
+ "maxSelections": {
567
+ "type": "integer",
568
+ "minimum": 1
569
+ },
570
+ "optional": {
571
+ "type": "boolean"
572
+ }
573
+ }
574
+ },
575
+ {
576
+ "title": "RankingQuestion",
577
+ "description": "Order `options`; a ballot ranks every option or, when `partial` is true, a prefix of them.",
578
+ "type": "object",
579
+ "additionalProperties": false,
580
+ "required": [
581
+ "key",
582
+ "type",
583
+ "options",
584
+ "partial",
585
+ "optional"
586
+ ],
587
+ "properties": {
588
+ "key": {
589
+ "$ref": "#/$defs/Key"
590
+ },
591
+ "type": {
592
+ "const": "ranking"
593
+ },
594
+ "text": {
595
+ "type": "string",
596
+ "maxLength": 2048
597
+ },
598
+ "options": {
599
+ "type": "array",
600
+ "minItems": 2,
601
+ "maxItems": 64,
602
+ "items": {
603
+ "$ref": "#/$defs/QuestionOption"
604
+ }
605
+ },
606
+ "partial": {
607
+ "type": "boolean"
608
+ },
609
+ "optional": {
610
+ "type": "boolean"
611
+ }
612
+ }
613
+ },
614
+ {
615
+ "title": "ScoreQuestion",
616
+ "description": "Give each option an integer score within [min, max].",
617
+ "type": "object",
618
+ "additionalProperties": false,
619
+ "required": [
620
+ "key",
621
+ "type",
622
+ "options",
623
+ "min",
624
+ "max",
625
+ "optional"
626
+ ],
627
+ "properties": {
628
+ "key": {
629
+ "$ref": "#/$defs/Key"
630
+ },
631
+ "type": {
632
+ "const": "score"
633
+ },
634
+ "text": {
635
+ "type": "string",
636
+ "maxLength": 2048
637
+ },
638
+ "options": {
639
+ "type": "array",
640
+ "minItems": 1,
641
+ "maxItems": 256,
642
+ "items": {
643
+ "$ref": "#/$defs/QuestionOption"
644
+ }
645
+ },
646
+ "min": {
647
+ "type": "integer"
648
+ },
649
+ "max": {
650
+ "type": "integer"
651
+ },
652
+ "optional": {
653
+ "type": "boolean"
654
+ }
655
+ }
656
+ },
657
+ {
658
+ "title": "TextQuestion",
659
+ "description": "Free text of at most `maxLength` characters.",
660
+ "type": "object",
661
+ "additionalProperties": false,
662
+ "required": [
663
+ "key",
664
+ "type",
665
+ "maxLength",
666
+ "optional"
667
+ ],
668
+ "properties": {
669
+ "key": {
670
+ "$ref": "#/$defs/Key"
671
+ },
672
+ "type": {
673
+ "const": "text"
674
+ },
675
+ "text": {
676
+ "type": "string",
677
+ "maxLength": 2048
678
+ },
679
+ "maxLength": {
680
+ "type": "integer",
681
+ "minimum": 1,
682
+ "maximum": 4096
683
+ },
684
+ "optional": {
685
+ "type": "boolean"
686
+ }
687
+ }
688
+ }
689
+ ]
690
+ },
691
+ "QuestionOption": {
692
+ "title": "QuestionOption",
693
+ "type": "object",
694
+ "additionalProperties": false,
695
+ "required": [
696
+ "key"
697
+ ],
698
+ "properties": {
699
+ "key": {
700
+ "$ref": "#/$defs/Key"
701
+ },
702
+ "label": {
703
+ "type": "string",
704
+ "maxLength": 512,
705
+ "description": "Display text. Absent from a manifest registered with a ballot box that holds no question text (VTI-VOT-014)."
706
+ }
707
+ }
708
+ },
709
+ "VotingParameters": {
710
+ "title": "VotingParameters",
711
+ "description": "The community's published voting parameters: the PCS suite and the voting verification key tickets are issued under (VTI-VOT-020). Distinct from its hidden-vetting helper key.",
712
+ "type": "object",
713
+ "additionalProperties": false,
714
+ "required": [
715
+ "suite",
716
+ "votingKey"
717
+ ],
718
+ "properties": {
719
+ "suite": {
720
+ "type": "string",
721
+ "const": "ps-ddh-bls12381"
722
+ },
723
+ "votingKey": {
724
+ "$ref": "#/$defs/Multibase"
725
+ }
726
+ }
727
+ },
728
+ "Multibase": {
729
+ "title": "Multibase",
730
+ "description": "A binary value, multibase base58btc over the suite's canonical (compressed) encoding.",
731
+ "type": "string",
732
+ "maxLength": 16384,
733
+ "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
734
+ }
735
+ }
736
+ } as const;
737
+
738
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
739
+ export const RESPONSE_PAYLOAD_SCHEMA = {
740
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
741
+ "$ref": "#/$defs/Response",
742
+ "$defs": {
743
+ "CastDocument": {
744
+ "title": "CastDocument",
745
+ "description": "A complete, signed voting/ballot/cast/0.1 request document, ready to send to the ballot box. Its payload is validated by that specification's schema; the members fixed here are the ones this task guarantees.",
746
+ "type": "object",
747
+ "required": [
748
+ "id",
749
+ "type",
750
+ "issuer",
751
+ "recipient",
752
+ "issuedAt",
753
+ "payload",
754
+ "proof"
755
+ ],
756
+ "properties": {
757
+ "id": {
758
+ "type": "string",
759
+ "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}$",
760
+ "description": "A random (version 4) UUID URN, generated for this cast and derived from nothing else."
761
+ },
762
+ "type": {
763
+ "const": "https://trusttasks.org/spec/voting/ballot/cast/0.1#request"
764
+ },
765
+ "issuer": {
766
+ "type": "string",
767
+ "maxLength": 256,
768
+ "pattern": "^did:key:z[1-9A-HJ-NP-Za-km-z]+$",
769
+ "description": "The did:key generated for this cast alone (VTI-VOT-003)."
770
+ },
771
+ "recipient": {
772
+ "type": "string",
773
+ "minLength": 1,
774
+ "maxLength": 2048,
775
+ "description": "The manifest's `ballotBox`."
776
+ },
777
+ "issuedAt": {
778
+ "type": "string",
779
+ "format": "date-time"
780
+ },
781
+ "expiresAt": {
782
+ "type": "string",
783
+ "format": "date-time",
784
+ "description": "When present, the manifest's `votingCloses`."
785
+ },
786
+ "payload": {
787
+ "type": "object",
788
+ "description": "The voting/ballot/cast/0.1 request payload — `community`, `electionId` and the Cast the engine built — and nothing else."
789
+ },
790
+ "proof": {
791
+ "type": "object",
792
+ "description": "The Data Integrity proof made with the cast's one-time key."
793
+ }
794
+ }
795
+ },
796
+ "Response": {
797
+ "$anchor": "response",
798
+ "title": "VTA PCS — Vote — response payload",
799
+ "type": "object",
800
+ "additionalProperties": false,
801
+ "required": [
802
+ "castDocument",
803
+ "tag"
804
+ ],
805
+ "properties": {
806
+ "castDocument": {
807
+ "$ref": "#/$defs/CastDocument"
808
+ },
809
+ "tag": {
810
+ "type": "string",
811
+ "maxLength": 4096,
812
+ "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$",
813
+ "description": "The cast's tag (the election's nullifier for this ticket), as the cast carries it. The same for every cast this ticket makes in this election."
814
+ },
815
+ "ext": {
816
+ "$ref": "#/$defs/Ext"
817
+ }
818
+ }
819
+ },
820
+ "Ext": {
821
+ "title": "Ext",
822
+ "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.",
823
+ "type": "object",
824
+ "minProperties": 1,
825
+ "additionalProperties": true,
826
+ "propertyNames": {
827
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
828
+ }
829
+ },
830
+ "Ballot": {
831
+ "title": "Ballot",
832
+ "description": "An open ballot: one answer per question of the manifest, in any order. The bytes a cast's proof binds are the RFC 8785 (JCS) canonicalization of this object as received.",
833
+ "type": "object",
834
+ "additionalProperties": false,
835
+ "required": [
836
+ "electionId",
837
+ "manifestDigest",
838
+ "answers"
839
+ ],
840
+ "properties": {
841
+ "electionId": {
842
+ "$ref": "#/$defs/ElectionId"
843
+ },
844
+ "manifestDigest": {
845
+ "$ref": "#/$defs/DigestMultibase"
846
+ },
847
+ "answers": {
848
+ "type": "array",
849
+ "minItems": 1,
850
+ "maxItems": 128,
851
+ "items": {
852
+ "$ref": "#/$defs/Answer"
853
+ }
854
+ }
855
+ }
856
+ },
857
+ "Answer": {
858
+ "title": "Answer",
859
+ "description": "The answer to one question. Exactly one member besides `question` is present, matching the question's type, or `abstain` for an optional question left unanswered.",
860
+ "type": "object",
861
+ "additionalProperties": false,
862
+ "required": [
863
+ "question"
864
+ ],
865
+ "minProperties": 2,
866
+ "maxProperties": 2,
867
+ "properties": {
868
+ "question": {
869
+ "$ref": "#/$defs/Key"
870
+ },
871
+ "choice": {
872
+ "type": "array",
873
+ "items": {
874
+ "$ref": "#/$defs/Key"
875
+ },
876
+ "uniqueItems": true
877
+ },
878
+ "ranking": {
879
+ "type": "array",
880
+ "items": {
881
+ "$ref": "#/$defs/Key"
882
+ },
883
+ "uniqueItems": true
884
+ },
885
+ "scores": {
886
+ "type": "object",
887
+ "propertyNames": {
888
+ "$ref": "#/$defs/Key"
889
+ },
890
+ "additionalProperties": {
891
+ "type": "integer"
892
+ }
893
+ },
894
+ "text": {
895
+ "type": "string",
896
+ "maxLength": 4096
897
+ },
898
+ "abstain": {
899
+ "const": true
900
+ }
901
+ }
902
+ },
903
+ "Key": {
904
+ "title": "Key",
905
+ "description": "A question or option key, unique within its manifest or question.",
906
+ "type": "string",
907
+ "pattern": "^[A-Za-z0-9._-]{1,64}$"
908
+ },
909
+ "ElectionId": {
910
+ "title": "ElectionId",
911
+ "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.",
912
+ "type": "string",
913
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
914
+ },
915
+ "DigestMultibase": {
916
+ "title": "DigestMultibase",
917
+ "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`.",
918
+ "type": "string",
919
+ "minLength": 16,
920
+ "pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
921
+ "examples": [
922
+ "zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
923
+ ]
924
+ },
925
+ "Manifest": {
926
+ "title": "Manifest",
927
+ "description": "What an election asks and how it is decided (VTI-VOT-010). Its digest (`manifestDigest`) is the SHA-256 multihash of its RFC 8785 (JCS) canonicalization, and every cast is bound to it (VTI-VOT-011).",
928
+ "type": "object",
929
+ "additionalProperties": false,
930
+ "required": [
931
+ "electionId",
932
+ "community",
933
+ "questions",
934
+ "secrecy",
935
+ "roll",
936
+ "registrationOpens",
937
+ "votingOpens",
938
+ "votingCloses",
939
+ "revote",
940
+ "board",
941
+ "ballotBox",
942
+ "binding",
943
+ "allowEarlyClose",
944
+ "resultsBeforeClose",
945
+ "textReleaseThreshold"
946
+ ],
947
+ "properties": {
948
+ "electionId": {
949
+ "$ref": "#/$defs/ElectionId"
950
+ },
951
+ "community": {
952
+ "type": "string",
953
+ "minLength": 1,
954
+ "maxLength": 2048,
955
+ "description": "The community's DID."
956
+ },
957
+ "title": {
958
+ "type": "string",
959
+ "maxLength": 512
960
+ },
961
+ "description": {
962
+ "type": "string",
963
+ "maxLength": 8192
964
+ },
965
+ "questions": {
966
+ "type": "array",
967
+ "minItems": 1,
968
+ "maxItems": 128,
969
+ "items": {
970
+ "$ref": "#/$defs/Question"
971
+ }
972
+ },
973
+ "secrecy": {
974
+ "$ref": "#/$defs/SecrecyLevel"
975
+ },
976
+ "roll": {
977
+ "$ref": "#/$defs/RollRule"
978
+ },
979
+ "registrationOpens": {
980
+ "type": "string",
981
+ "format": "date-time"
982
+ },
983
+ "votingOpens": {
984
+ "type": "string",
985
+ "format": "date-time"
986
+ },
987
+ "votingCloses": {
988
+ "type": "string",
989
+ "format": "date-time"
990
+ },
991
+ "revote": {
992
+ "$ref": "#/$defs/Revote"
993
+ },
994
+ "board": {
995
+ "type": "object",
996
+ "additionalProperties": false,
997
+ "required": [
998
+ "visibility",
999
+ "auditors"
1000
+ ],
1001
+ "properties": {
1002
+ "visibility": {
1003
+ "$ref": "#/$defs/BoardVisibility"
1004
+ },
1005
+ "auditors": {
1006
+ "type": "array",
1007
+ "items": {
1008
+ "type": "string",
1009
+ "minLength": 1,
1010
+ "maxLength": 2048
1011
+ },
1012
+ "uniqueItems": true
1013
+ }
1014
+ }
1015
+ },
1016
+ "ballotBox": {
1017
+ "type": "string",
1018
+ "minLength": 1,
1019
+ "maxLength": 2048,
1020
+ "description": "The DID of the voting service that holds the board."
1021
+ },
1022
+ "trustees": {
1023
+ "$ref": "#/$defs/Trustees"
1024
+ },
1025
+ "binding": {
1026
+ "type": "boolean",
1027
+ "description": "Whether the community treats the result as deciding something; creating a binding election takes another administrator's consent (VTI-VOT-081)."
1028
+ },
1029
+ "allowEarlyClose": {
1030
+ "type": "boolean"
1031
+ },
1032
+ "resultsBeforeClose": {
1033
+ "type": "boolean",
1034
+ "description": "Open elections only: whether running totals may be read while voting is open (VTI-VOT-061)."
1035
+ },
1036
+ "textReleaseThreshold": {
1037
+ "type": "integer",
1038
+ "minimum": 10,
1039
+ "description": "Counted ballots required before any text answer is disclosed (VTI-VOT-065)."
1040
+ }
1041
+ }
1042
+ },
1043
+ "Trustees": {
1044
+ "title": "Trustees",
1045
+ "description": "The trustees of a sealed or tallied-encrypted election and the number of them decryption needs (VTI-VOT-062). Neither the community nor the ballot box may be one.",
1046
+ "type": "object",
1047
+ "additionalProperties": false,
1048
+ "required": [
1049
+ "dids",
1050
+ "threshold"
1051
+ ],
1052
+ "properties": {
1053
+ "dids": {
1054
+ "type": "array",
1055
+ "minItems": 2,
1056
+ "items": {
1057
+ "type": "string",
1058
+ "minLength": 1,
1059
+ "maxLength": 2048
1060
+ },
1061
+ "uniqueItems": true
1062
+ },
1063
+ "threshold": {
1064
+ "type": "integer",
1065
+ "minimum": 2
1066
+ }
1067
+ }
1068
+ },
1069
+ "BoardVisibility": {
1070
+ "title": "BoardVisibility",
1071
+ "description": "`public`: anyone reads the board. `private`: the community, the auditors the manifest names and, for one cast's inclusion, the holder of its receipt (VTI-VOT-052).",
1072
+ "type": "string",
1073
+ "enum": [
1074
+ "public",
1075
+ "private"
1076
+ ]
1077
+ },
1078
+ "Revote": {
1079
+ "title": "Revote",
1080
+ "description": "What a later, different ballot under one ticket does: `replace` the earlier one, or be refused (`refuse`) (VTI-VOT-041).",
1081
+ "type": "string",
1082
+ "enum": [
1083
+ "replace",
1084
+ "refuse"
1085
+ ]
1086
+ },
1087
+ "RollRule": {
1088
+ "title": "RollRule",
1089
+ "description": "Who may be issued a ticket (VTI-VOT-021): the community's active members, its active members and the parties `listed` names, or only the parties `listed` names.",
1090
+ "type": "object",
1091
+ "additionalProperties": false,
1092
+ "required": [
1093
+ "rule"
1094
+ ],
1095
+ "properties": {
1096
+ "rule": {
1097
+ "type": "string",
1098
+ "enum": [
1099
+ "members",
1100
+ "membersAndListed",
1101
+ "listed"
1102
+ ]
1103
+ },
1104
+ "listed": {
1105
+ "type": "array",
1106
+ "items": {
1107
+ "type": "string",
1108
+ "minLength": 1,
1109
+ "maxLength": 2048,
1110
+ "description": "A DID enfranchised by name."
1111
+ },
1112
+ "uniqueItems": true
1113
+ }
1114
+ }
1115
+ },
1116
+ "SecrecyLevel": {
1117
+ "title": "SecrecyLevel",
1118
+ "description": "`open`: ballots are recorded on the board as cast. `sealed`: ballots are encrypted to a jointly generated election key and decrypted after voting closes. `talliedEncrypted`: ballots are encrypted and only the totals are ever decrypted (VTI-VOT-060). Version 0.1 of the voting tasks carries open ballots only; a ballot box refuses to register any other level with `voting/election/register:unsupportedSecrecy` until the trustee tasks are specified.",
1119
+ "type": "string",
1120
+ "enum": [
1121
+ "open",
1122
+ "sealed",
1123
+ "talliedEncrypted"
1124
+ ]
1125
+ },
1126
+ "Question": {
1127
+ "title": "Question",
1128
+ "description": "One question. Tagged union over `type`.",
1129
+ "oneOf": [
1130
+ {
1131
+ "title": "ChoiceQuestion",
1132
+ "description": "Select between `minSelections` and `maxSelections` of `options`. A yes/no/abstain motion is a choice of exactly one of three.",
1133
+ "type": "object",
1134
+ "additionalProperties": false,
1135
+ "required": [
1136
+ "key",
1137
+ "type",
1138
+ "options",
1139
+ "minSelections",
1140
+ "maxSelections",
1141
+ "optional"
1142
+ ],
1143
+ "properties": {
1144
+ "key": {
1145
+ "$ref": "#/$defs/Key"
1146
+ },
1147
+ "type": {
1148
+ "const": "choice"
1149
+ },
1150
+ "text": {
1151
+ "type": "string",
1152
+ "maxLength": 2048
1153
+ },
1154
+ "options": {
1155
+ "type": "array",
1156
+ "minItems": 2,
1157
+ "maxItems": 256,
1158
+ "items": {
1159
+ "$ref": "#/$defs/QuestionOption"
1160
+ }
1161
+ },
1162
+ "minSelections": {
1163
+ "type": "integer",
1164
+ "minimum": 0
1165
+ },
1166
+ "maxSelections": {
1167
+ "type": "integer",
1168
+ "minimum": 1
1169
+ },
1170
+ "optional": {
1171
+ "type": "boolean"
1172
+ }
1173
+ }
1174
+ },
1175
+ {
1176
+ "title": "RankingQuestion",
1177
+ "description": "Order `options`; a ballot ranks every option or, when `partial` is true, a prefix of them.",
1178
+ "type": "object",
1179
+ "additionalProperties": false,
1180
+ "required": [
1181
+ "key",
1182
+ "type",
1183
+ "options",
1184
+ "partial",
1185
+ "optional"
1186
+ ],
1187
+ "properties": {
1188
+ "key": {
1189
+ "$ref": "#/$defs/Key"
1190
+ },
1191
+ "type": {
1192
+ "const": "ranking"
1193
+ },
1194
+ "text": {
1195
+ "type": "string",
1196
+ "maxLength": 2048
1197
+ },
1198
+ "options": {
1199
+ "type": "array",
1200
+ "minItems": 2,
1201
+ "maxItems": 64,
1202
+ "items": {
1203
+ "$ref": "#/$defs/QuestionOption"
1204
+ }
1205
+ },
1206
+ "partial": {
1207
+ "type": "boolean"
1208
+ },
1209
+ "optional": {
1210
+ "type": "boolean"
1211
+ }
1212
+ }
1213
+ },
1214
+ {
1215
+ "title": "ScoreQuestion",
1216
+ "description": "Give each option an integer score within [min, max].",
1217
+ "type": "object",
1218
+ "additionalProperties": false,
1219
+ "required": [
1220
+ "key",
1221
+ "type",
1222
+ "options",
1223
+ "min",
1224
+ "max",
1225
+ "optional"
1226
+ ],
1227
+ "properties": {
1228
+ "key": {
1229
+ "$ref": "#/$defs/Key"
1230
+ },
1231
+ "type": {
1232
+ "const": "score"
1233
+ },
1234
+ "text": {
1235
+ "type": "string",
1236
+ "maxLength": 2048
1237
+ },
1238
+ "options": {
1239
+ "type": "array",
1240
+ "minItems": 1,
1241
+ "maxItems": 256,
1242
+ "items": {
1243
+ "$ref": "#/$defs/QuestionOption"
1244
+ }
1245
+ },
1246
+ "min": {
1247
+ "type": "integer"
1248
+ },
1249
+ "max": {
1250
+ "type": "integer"
1251
+ },
1252
+ "optional": {
1253
+ "type": "boolean"
1254
+ }
1255
+ }
1256
+ },
1257
+ {
1258
+ "title": "TextQuestion",
1259
+ "description": "Free text of at most `maxLength` characters.",
1260
+ "type": "object",
1261
+ "additionalProperties": false,
1262
+ "required": [
1263
+ "key",
1264
+ "type",
1265
+ "maxLength",
1266
+ "optional"
1267
+ ],
1268
+ "properties": {
1269
+ "key": {
1270
+ "$ref": "#/$defs/Key"
1271
+ },
1272
+ "type": {
1273
+ "const": "text"
1274
+ },
1275
+ "text": {
1276
+ "type": "string",
1277
+ "maxLength": 2048
1278
+ },
1279
+ "maxLength": {
1280
+ "type": "integer",
1281
+ "minimum": 1,
1282
+ "maximum": 4096
1283
+ },
1284
+ "optional": {
1285
+ "type": "boolean"
1286
+ }
1287
+ }
1288
+ }
1289
+ ]
1290
+ },
1291
+ "QuestionOption": {
1292
+ "title": "QuestionOption",
1293
+ "type": "object",
1294
+ "additionalProperties": false,
1295
+ "required": [
1296
+ "key"
1297
+ ],
1298
+ "properties": {
1299
+ "key": {
1300
+ "$ref": "#/$defs/Key"
1301
+ },
1302
+ "label": {
1303
+ "type": "string",
1304
+ "maxLength": 512,
1305
+ "description": "Display text. Absent from a manifest registered with a ballot box that holds no question text (VTI-VOT-014)."
1306
+ }
1307
+ }
1308
+ },
1309
+ "VotingParameters": {
1310
+ "title": "VotingParameters",
1311
+ "description": "The community's published voting parameters: the PCS suite and the voting verification key tickets are issued under (VTI-VOT-020). Distinct from its hidden-vetting helper key.",
1312
+ "type": "object",
1313
+ "additionalProperties": false,
1314
+ "required": [
1315
+ "suite",
1316
+ "votingKey"
1317
+ ],
1318
+ "properties": {
1319
+ "suite": {
1320
+ "type": "string",
1321
+ "const": "ps-ddh-bls12381"
1322
+ },
1323
+ "votingKey": {
1324
+ "$ref": "#/$defs/Multibase"
1325
+ }
1326
+ }
1327
+ },
1328
+ "Multibase": {
1329
+ "title": "Multibase",
1330
+ "description": "A binary value, multibase base58btc over the suite's canonical (compressed) encoding.",
1331
+ "type": "string",
1332
+ "maxLength": 16384,
1333
+ "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
1334
+ }
1335
+ }
1336
+ } as const;
1337
+
1338
+ /**
1339
+ * SPEC.md §7.2 policy for the request variant, from this specification's
1340
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
1341
+ * per-specification and cannot be derived from the document alone, and
1342
+ * item 2 needs the schema this carries.
1343
+ */
1344
+ export const SPEC = {
1345
+ typeUri: TYPE_URI,
1346
+ isBearer: false,
1347
+ isProofRequired: true,
1348
+ isRecipientRequired: true,
1349
+ isIssuedAtRequired: true,
1350
+ payloadSchema: PAYLOAD_SCHEMA,
1351
+ } as const;
1352
+
1353
+ /**
1354
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
1355
+ * tracks the *issuer* party's requirement because a response swaps the
1356
+ * parties (§7.3 item 5).
1357
+ */
1358
+ export const RESPONSE_SPEC = {
1359
+ typeUri: RESPONSE_TYPE_URI,
1360
+ isBearer: false,
1361
+ isProofRequired: false,
1362
+ isRecipientRequired: true,
1363
+ isIssuedAtRequired: true,
1364
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
1365
+ } as const;