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