@openvtc/trust-tasks 0.28.5 → 0.28.7

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 (187) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/_shared/components.d.ts +45 -0
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/index.d.ts +42 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +42 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/voting/_shared/0.3/voting.d.ts +16 -0
  9. package/dist/voting/_shared/0.3/voting.d.ts.map +1 -0
  10. package/dist/voting/_shared/0.3/voting.js +6 -0
  11. package/dist/voting/_shared/0.3/voting.js.map +1 -0
  12. package/dist/voting/election/register/0.1/payload.d.ts +4 -4
  13. package/dist/voting/election/register/0.1/payload.js +1 -1
  14. package/dist/voting/election/register/0.2/payload.d.ts +13 -2
  15. package/dist/voting/election/register/0.2/payload.d.ts.map +1 -1
  16. package/dist/voting/election/register/0.2/payload.js +1 -1
  17. package/dist/voting/election/register/0.2/payload.js.map +1 -1
  18. package/dist/voting/election/register/0.3/payload.d.ts +1934 -0
  19. package/dist/voting/election/register/0.3/payload.d.ts.map +1 -0
  20. package/dist/voting/election/register/0.3/payload.js +1180 -0
  21. package/dist/voting/election/register/0.3/payload.js.map +1 -0
  22. package/dist/voting/election/show/0.1/payload.d.ts +4 -4
  23. package/dist/voting/election/show/0.1/payload.js +1 -1
  24. package/dist/voting/election/show/0.2/payload.d.ts +13 -2
  25. package/dist/voting/election/show/0.2/payload.d.ts.map +1 -1
  26. package/dist/voting/election/show/0.2/payload.js +1 -1
  27. package/dist/voting/election/show/0.2/payload.js.map +1 -1
  28. package/dist/voting/election/show/0.3/payload.d.ts +1838 -0
  29. package/dist/voting/election/show/0.3/payload.d.ts.map +1 -0
  30. package/dist/voting/election/show/0.3/payload.js +1126 -0
  31. package/dist/voting/election/show/0.3/payload.js.map +1 -0
  32. package/dist/vta/pcs/trustee/deal/0.2/payload.d.ts +4 -4
  33. package/dist/vta/pcs/trustee/deal/0.2/payload.js +1 -1
  34. package/dist/vta/pcs/trustee/deal/0.3/payload.d.ts +13 -2
  35. package/dist/vta/pcs/trustee/deal/0.3/payload.d.ts.map +1 -1
  36. package/dist/vta/pcs/trustee/deal/0.3/payload.js +1 -1
  37. package/dist/vta/pcs/trustee/deal/0.3/payload.js.map +1 -1
  38. package/dist/vta/pcs/trustee/deal/0.4/payload.d.ts +1846 -0
  39. package/dist/vta/pcs/trustee/deal/0.4/payload.d.ts.map +1 -0
  40. package/dist/vta/pcs/trustee/deal/0.4/payload.js +1091 -0
  41. package/dist/vta/pcs/trustee/deal/0.4/payload.js.map +1 -0
  42. package/dist/vta/pcs/trustee/enrol/0.1/payload.d.ts +4 -4
  43. package/dist/vta/pcs/trustee/enrol/0.1/payload.js +1 -1
  44. package/dist/vta/pcs/trustee/enrol/0.2/payload.d.ts +13 -2
  45. package/dist/vta/pcs/trustee/enrol/0.2/payload.d.ts.map +1 -1
  46. package/dist/vta/pcs/trustee/enrol/0.2/payload.js +1 -1
  47. package/dist/vta/pcs/trustee/enrol/0.2/payload.js.map +1 -1
  48. package/dist/vta/pcs/trustee/enrol/0.3/payload.d.ts +1770 -0
  49. package/dist/vta/pcs/trustee/enrol/0.3/payload.d.ts.map +1 -0
  50. package/dist/vta/pcs/trustee/enrol/0.3/payload.js +1054 -0
  51. package/dist/vta/pcs/trustee/enrol/0.3/payload.js.map +1 -0
  52. package/dist/vta/pcs/trustee/justify/0.2/payload.d.ts +4 -4
  53. package/dist/vta/pcs/trustee/justify/0.2/payload.js +1 -1
  54. package/dist/vta/pcs/trustee/justify/0.3/payload.d.ts +13 -2
  55. package/dist/vta/pcs/trustee/justify/0.3/payload.d.ts.map +1 -1
  56. package/dist/vta/pcs/trustee/justify/0.3/payload.js +1 -1
  57. package/dist/vta/pcs/trustee/justify/0.3/payload.js.map +1 -1
  58. package/dist/vta/pcs/trustee/justify/0.4/payload.d.ts +1881 -0
  59. package/dist/vta/pcs/trustee/justify/0.4/payload.d.ts.map +1 -0
  60. package/dist/vta/pcs/trustee/justify/0.4/payload.js +1109 -0
  61. package/dist/vta/pcs/trustee/justify/0.4/payload.js.map +1 -0
  62. package/dist/vta/pcs/trustee/keys/0.2/payload.d.ts +4 -4
  63. package/dist/vta/pcs/trustee/keys/0.2/payload.js +1 -1
  64. package/dist/vta/pcs/trustee/keys/0.3/payload.d.ts +13 -2
  65. package/dist/vta/pcs/trustee/keys/0.3/payload.d.ts.map +1 -1
  66. package/dist/vta/pcs/trustee/keys/0.3/payload.js +1 -1
  67. package/dist/vta/pcs/trustee/keys/0.3/payload.js.map +1 -1
  68. package/dist/vta/pcs/trustee/keys/0.4/payload.d.ts +1926 -0
  69. package/dist/vta/pcs/trustee/keys/0.4/payload.d.ts.map +1 -0
  70. package/dist/vta/pcs/trustee/keys/0.4/payload.js +1129 -0
  71. package/dist/vta/pcs/trustee/keys/0.4/payload.js.map +1 -0
  72. package/dist/vta/pcs/trustee/read/0.1/payload.d.ts +4 -4
  73. package/dist/vta/pcs/trustee/read/0.1/payload.js +1 -1
  74. package/dist/vta/pcs/trustee/read/0.2/payload.d.ts +14 -2
  75. package/dist/vta/pcs/trustee/read/0.2/payload.d.ts.map +1 -1
  76. package/dist/vta/pcs/trustee/read/0.2/payload.js +1 -1
  77. package/dist/vta/pcs/trustee/read/0.2/payload.js.map +1 -1
  78. package/dist/vta/pcs/trustee/read/0.3/payload.d.ts +540 -0
  79. package/dist/vta/pcs/trustee/read/0.3/payload.d.ts.map +1 -0
  80. package/dist/vta/pcs/trustee/read/0.3/payload.js +304 -0
  81. package/dist/vta/pcs/trustee/read/0.3/payload.js.map +1 -0
  82. package/dist/vta/pcs/vote/0.1/payload.d.ts +4 -4
  83. package/dist/vta/pcs/vote/0.1/payload.js +1 -1
  84. package/dist/vta/pcs/vote/0.2/payload.d.ts +13 -2
  85. package/dist/vta/pcs/vote/0.2/payload.d.ts.map +1 -1
  86. package/dist/vta/pcs/vote/0.2/payload.js +1 -1
  87. package/dist/vta/pcs/vote/0.2/payload.js.map +1 -1
  88. package/dist/vta/pcs/vote/0.3/payload.d.ts +2222 -0
  89. package/dist/vta/pcs/vote/0.3/payload.d.ts.map +1 -0
  90. package/dist/vta/pcs/vote/0.3/payload.js +1296 -0
  91. package/dist/vta/pcs/vote/0.3/payload.js.map +1 -0
  92. package/dist/vta/pcs/vote-encrypted/0.2/payload.d.ts +4 -4
  93. package/dist/vta/pcs/vote-encrypted/0.2/payload.js +1 -1
  94. package/dist/vta/pcs/vote-encrypted/0.3/payload.d.ts +13 -2
  95. package/dist/vta/pcs/vote-encrypted/0.3/payload.d.ts.map +1 -1
  96. package/dist/vta/pcs/vote-encrypted/0.3/payload.js +1 -1
  97. package/dist/vta/pcs/vote-encrypted/0.3/payload.js.map +1 -1
  98. package/dist/vta/pcs/vote-encrypted/0.4/payload.d.ts +2242 -0
  99. package/dist/vta/pcs/vote-encrypted/0.4/payload.d.ts.map +1 -0
  100. package/dist/vta/pcs/vote-encrypted/0.4/payload.js +1314 -0
  101. package/dist/vta/pcs/vote-encrypted/0.4/payload.js.map +1 -0
  102. package/dist/vta/pcs/voter/read/0.1/payload.d.ts +4 -4
  103. package/dist/vta/pcs/voter/read/0.1/payload.js +1 -1
  104. package/dist/vta/pcs/voter/read/0.2/payload.d.ts +14 -2
  105. package/dist/vta/pcs/voter/read/0.2/payload.d.ts.map +1 -1
  106. package/dist/vta/pcs/voter/read/0.2/payload.js +1 -1
  107. package/dist/vta/pcs/voter/read/0.2/payload.js.map +1 -1
  108. package/dist/vta/pcs/voter/read/0.3/payload.d.ts +503 -0
  109. package/dist/vta/pcs/voter/read/0.3/payload.d.ts.map +1 -0
  110. package/dist/vta/pcs/voter/read/0.3/payload.js +285 -0
  111. package/dist/vta/pcs/voter/read/0.3/payload.js.map +1 -0
  112. package/dist/vta/pcs/voter/register/0.1/payload.d.ts +4 -4
  113. package/dist/vta/pcs/voter/register/0.1/payload.js +1 -1
  114. package/dist/vta/pcs/voter/register/0.2/payload.d.ts +14 -2
  115. package/dist/vta/pcs/voter/register/0.2/payload.d.ts.map +1 -1
  116. package/dist/vta/pcs/voter/register/0.2/payload.js +1 -1
  117. package/dist/vta/pcs/voter/register/0.2/payload.js.map +1 -1
  118. package/dist/vta/pcs/voter/register/0.3/payload.d.ts +2176 -0
  119. package/dist/vta/pcs/voter/register/0.3/payload.d.ts.map +1 -0
  120. package/dist/vta/pcs/voter/register/0.3/payload.js +1262 -0
  121. package/dist/vta/pcs/voter/register/0.3/payload.js.map +1 -0
  122. package/dist/vtc/elections/create/0.1/payload.d.ts +4 -4
  123. package/dist/vtc/elections/create/0.1/payload.js +1 -1
  124. package/dist/vtc/elections/create/0.2/payload.d.ts +4 -4
  125. package/dist/vtc/elections/create/0.2/payload.js +1 -1
  126. package/dist/vtc/elections/create/0.3/payload.d.ts +14 -2
  127. package/dist/vtc/elections/create/0.3/payload.d.ts.map +1 -1
  128. package/dist/vtc/elections/create/0.3/payload.js +1 -1
  129. package/dist/vtc/elections/create/0.3/payload.js.map +1 -1
  130. package/dist/vtc/elections/create/0.4/payload.d.ts +1670 -0
  131. package/dist/vtc/elections/create/0.4/payload.d.ts.map +1 -0
  132. package/dist/vtc/elections/create/0.4/payload.js +1008 -0
  133. package/dist/vtc/elections/create/0.4/payload.js.map +1 -0
  134. package/dist/vtc/elections/show/0.1/payload.d.ts +4 -4
  135. package/dist/vtc/elections/show/0.1/payload.js +1 -1
  136. package/dist/vtc/elections/show/0.2/payload.d.ts +14 -2
  137. package/dist/vtc/elections/show/0.2/payload.d.ts.map +1 -1
  138. package/dist/vtc/elections/show/0.2/payload.js +1 -1
  139. package/dist/vtc/elections/show/0.2/payload.js.map +1 -1
  140. package/dist/vtc/elections/show/0.3/payload.d.ts +3022 -0
  141. package/dist/vtc/elections/show/0.3/payload.d.ts.map +1 -0
  142. package/dist/vtc/elections/show/0.3/payload.js +1765 -0
  143. package/dist/vtc/elections/show/0.3/payload.js.map +1 -0
  144. package/package.json +1 -1
  145. package/src/_shared/components.ts +45 -0
  146. package/src/index.ts +42 -0
  147. package/src/voting/_shared/0.3/voting.ts +17 -0
  148. package/src/voting/election/register/0.1/payload.ts +5 -5
  149. package/src/voting/election/register/0.2/payload.ts +14 -3
  150. package/src/voting/election/register/0.3/payload.ts +1223 -0
  151. package/src/voting/election/show/0.1/payload.ts +5 -5
  152. package/src/voting/election/show/0.2/payload.ts +14 -3
  153. package/src/voting/election/show/0.3/payload.ts +1165 -0
  154. package/src/vta/pcs/trustee/deal/0.2/payload.ts +5 -5
  155. package/src/vta/pcs/trustee/deal/0.3/payload.ts +14 -3
  156. package/src/vta/pcs/trustee/deal/0.4/payload.ts +1164 -0
  157. package/src/vta/pcs/trustee/enrol/0.1/payload.ts +5 -5
  158. package/src/vta/pcs/trustee/enrol/0.2/payload.ts +14 -3
  159. package/src/vta/pcs/trustee/enrol/0.3/payload.ts +1123 -0
  160. package/src/vta/pcs/trustee/justify/0.2/payload.ts +5 -5
  161. package/src/vta/pcs/trustee/justify/0.3/payload.ts +14 -3
  162. package/src/vta/pcs/trustee/justify/0.4/payload.ts +1183 -0
  163. package/src/vta/pcs/trustee/keys/0.2/payload.ts +5 -5
  164. package/src/vta/pcs/trustee/keys/0.3/payload.ts +14 -3
  165. package/src/vta/pcs/trustee/keys/0.4/payload.ts +1210 -0
  166. package/src/vta/pcs/trustee/read/0.1/payload.ts +5 -5
  167. package/src/vta/pcs/trustee/read/0.2/payload.ts +15 -3
  168. package/src/vta/pcs/trustee/read/0.3/payload.ts +385 -0
  169. package/src/vta/pcs/vote/0.1/payload.ts +5 -5
  170. package/src/vta/pcs/vote/0.2/payload.ts +14 -3
  171. package/src/vta/pcs/vote/0.3/payload.ts +1381 -0
  172. package/src/vta/pcs/vote-encrypted/0.2/payload.ts +5 -5
  173. package/src/vta/pcs/vote-encrypted/0.3/payload.ts +14 -3
  174. package/src/vta/pcs/vote-encrypted/0.4/payload.ts +1385 -0
  175. package/src/vta/pcs/voter/read/0.1/payload.ts +5 -5
  176. package/src/vta/pcs/voter/read/0.2/payload.ts +15 -3
  177. package/src/vta/pcs/voter/read/0.3/payload.ts +363 -0
  178. package/src/vta/pcs/voter/register/0.1/payload.ts +5 -5
  179. package/src/vta/pcs/voter/register/0.2/payload.ts +15 -3
  180. package/src/vta/pcs/voter/register/0.3/payload.ts +1372 -0
  181. package/src/vtc/elections/create/0.1/payload.ts +5 -5
  182. package/src/vtc/elections/create/0.2/payload.ts +5 -5
  183. package/src/vtc/elections/create/0.3/payload.ts +15 -3
  184. package/src/vtc/elections/create/0.4/payload.ts +1057 -0
  185. package/src/vtc/elections/show/0.1/payload.ts +5 -5
  186. package/src/vtc/elections/show/0.2/payload.ts +15 -3
  187. package/src/vtc/elections/show/0.3/payload.ts +1865 -0
@@ -0,0 +1,1057 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/vtc/elections/create/0.4/payload.schema.json
4
+ */
5
+
6
+ import type { ActionId, BoardVisibility, ChoiceQuestion, DigestMultibase, ElectionId, Ext, Key_VotingV0_1 as Key, Manifest_VotingV0_3 as Manifest, Question, QuestionOption, RankingQuestion, Revote, RollRule, ScoreQuestion, SecrecyLevel, TextQuestion, Trustees } from "../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * An administrator creates an election of the community: the community checks the manifest, records the election and registers it with the ballot box the manifest names. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.
11
+ */
12
+ export interface VTCElectionsCreatePayload {
13
+ /**
14
+ * The election's manifest, exactly as it will be registered with the ballot box. `community` is this community's DID; `ballotBox` is a voting service on the community's trusted list. Its digest (CONVENTIONS §1) is what every ticket and cast of the election is bound to, so the community registers these bytes and no others.
15
+ */
16
+ manifest: Manifest;
17
+ ext?: Ext;
18
+ }
19
+ /**
20
+ * Success response to vtc/elections/create/0.1: the election as recorded. Type https://trusttasks.org/spec/vtc/elections/create/0.4#response — carried directly, or on the request's threadId when a parked creation executes after its approval.
21
+ */
22
+ export interface VTCElectionsCreateResponsePayload {
23
+ electionId: ElectionId;
24
+ /**
25
+ * The SHA-256 multihash of the RFC 8785 (JCS) canonicalization of the manifest as registered.
26
+ */
27
+ manifestDigest: DigestMultibase;
28
+ /**
29
+ * `registered`: the ballot box answered the registration. `pendingRegistration`: the election is recorded and the community is still delivering it to the ballot box; it keeps trying, and issues no ticket until the ballot box has answered.
30
+ */
31
+ state: "pendingRegistration" | "registered";
32
+ /**
33
+ * Present when this response follows the execution of a creation that was parked for another administrator's consent: the identifier of that action, as vtc/admin/actions/show named it.
34
+ */
35
+ actionId?: ActionId;
36
+ ext?: Ext;
37
+ }
38
+
39
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
40
+ export type { ActionId, BoardVisibility, ChoiceQuestion, DigestMultibase, ElectionId, Ext, Key, Manifest, Question, QuestionOption, RankingQuestion, Revote, RollRule, ScoreQuestion, SecrecyLevel, TextQuestion, Trustees };
41
+
42
+ /** Trust Task type URI. */
43
+ export const TYPE_URI = "https://trusttasks.org/spec/vtc/elections/create/0.4" as const;
44
+
45
+ /**
46
+ * The earlier version of this specification that this one declares it
47
+ * extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
48
+ * `null`. Only the direct declaration — follow the chain with
49
+ * `extendsChain` / `readForSpec`.
50
+ */
51
+ export const EXTENDS: string | null = null;
52
+
53
+ /**
54
+ * Why this version is deprecated, or `null` while it is current. A
55
+ * superseded or retired version is still supported, and is withdrawn from
56
+ * this package in a later scheduled batch (SPEC "Superseded and Withdrawn
57
+ * Versions").
58
+ */
59
+ export const DEPRECATION: string | null = null;
60
+
61
+ /** Stable alias for this specification's request payload shape. */
62
+ export type Payload = VTCElectionsCreatePayload;
63
+
64
+ /** Trust Task response type URI (request type URI + "#response"). */
65
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/vtc/elections/create/0.4#response" as const;
66
+
67
+ /** Stable alias for this specification's success-response payload shape. */
68
+ export type Response = VTCElectionsCreateResponsePayload;
69
+
70
+ /**
71
+ * This specification's payload schema, as a value.
72
+ *
73
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
74
+ * rather than only as a `.json` file because TypeScript types are erased
75
+ * at runtime: without a schema a consumer has nothing to validate, and
76
+ * every REQUIRED payload member is optional in practice. Cross-file
77
+ * `$ref`s are already inlined, so it needs no resolver.
78
+ */
79
+ export const PAYLOAD_SCHEMA = {
80
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
81
+ "$id": "https://trusttasks.org/spec/vtc/elections/create/0.4",
82
+ "title": "VTC Elections — Create — payload",
83
+ "description": "An administrator creates an election of the community: the community checks the manifest, records the election and registers it with the ballot box the manifest names. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.",
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": [
87
+ "manifest"
88
+ ],
89
+ "properties": {
90
+ "manifest": {
91
+ "$ref": "#/$defs/Manifest",
92
+ "description": "The election's manifest, exactly as it will be registered with the ballot box. `community` is this community's DID; `ballotBox` is a voting service on the community's trusted list. Its digest (CONVENTIONS §1) is what every ticket and cast of the election is bound to, so the community registers these bytes and no others."
93
+ },
94
+ "ext": {
95
+ "$ref": "#/$defs/Ext"
96
+ }
97
+ },
98
+ "$defs": {
99
+ "Response": {
100
+ "$anchor": "response",
101
+ "title": "VTC Elections — Create — response payload",
102
+ "description": "Success response to vtc/elections/create/0.1: the election as recorded. Type https://trusttasks.org/spec/vtc/elections/create/0.4#response — carried directly, or on the request's threadId when a parked creation executes after its approval.",
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": [
106
+ "electionId",
107
+ "manifestDigest",
108
+ "state"
109
+ ],
110
+ "properties": {
111
+ "electionId": {
112
+ "$ref": "#/$defs/ElectionId"
113
+ },
114
+ "manifestDigest": {
115
+ "$ref": "#/$defs/DigestMultibase",
116
+ "description": "The SHA-256 multihash of the RFC 8785 (JCS) canonicalization of the manifest as registered."
117
+ },
118
+ "state": {
119
+ "type": "string",
120
+ "enum": [
121
+ "pendingRegistration",
122
+ "registered"
123
+ ],
124
+ "description": "`registered`: the ballot box answered the registration. `pendingRegistration`: the election is recorded and the community is still delivering it to the ballot box; it keeps trying, and issues no ticket until the ballot box has answered."
125
+ },
126
+ "actionId": {
127
+ "$ref": "#/$defs/ActionId",
128
+ "description": "Present when this response follows the execution of a creation that was parked for another administrator's consent: the identifier of that action, as vtc/admin/actions/show named it."
129
+ },
130
+ "ext": {
131
+ "$ref": "#/$defs/Ext"
132
+ }
133
+ }
134
+ },
135
+ "Ext": {
136
+ "title": "Ext",
137
+ "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.",
138
+ "type": "object",
139
+ "minProperties": 1,
140
+ "additionalProperties": true,
141
+ "propertyNames": {
142
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
143
+ }
144
+ },
145
+ "ActionId": {
146
+ "title": "ActionId",
147
+ "description": "Opaque, community-minted identifier of one action. A consumer MUST NOT parse or order it; it is compared for equality only. Long enough to be unguessable, because a show of an id the caller may not see is answered `notFound` and an enumerable id would turn that answer into an oracle.",
148
+ "type": "string",
149
+ "minLength": 16,
150
+ "maxLength": 128,
151
+ "pattern": "^[A-Za-z0-9._~:-]+$"
152
+ },
153
+ "DigestMultibase": {
154
+ "title": "DigestMultibase",
155
+ "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`.",
156
+ "type": "string",
157
+ "minLength": 16,
158
+ "pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
159
+ "examples": [
160
+ "zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
161
+ ]
162
+ },
163
+ "ElectionId": {
164
+ "title": "ElectionId",
165
+ "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.",
166
+ "type": "string",
167
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
168
+ },
169
+ "Manifest": {
170
+ "title": "Manifest",
171
+ "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).",
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "required": [
175
+ "electionId",
176
+ "community",
177
+ "questions",
178
+ "secrecy",
179
+ "roll",
180
+ "registrationOpensAt",
181
+ "votingOpensAt",
182
+ "votingClosesAt",
183
+ "revote",
184
+ "board",
185
+ "ballotBox",
186
+ "binding",
187
+ "allowEarlyClose",
188
+ "resultsBeforeClose",
189
+ "textReleaseThreshold"
190
+ ],
191
+ "properties": {
192
+ "electionId": {
193
+ "$ref": "#/$defs/ElectionId"
194
+ },
195
+ "community": {
196
+ "type": "string",
197
+ "minLength": 1,
198
+ "maxLength": 2048,
199
+ "description": "The community's DID."
200
+ },
201
+ "title": {
202
+ "type": "string",
203
+ "maxLength": 512
204
+ },
205
+ "description": {
206
+ "type": "string",
207
+ "maxLength": 8192
208
+ },
209
+ "questions": {
210
+ "type": "array",
211
+ "minItems": 1,
212
+ "maxItems": 128,
213
+ "items": {
214
+ "$ref": "#/$defs/Question"
215
+ }
216
+ },
217
+ "secrecy": {
218
+ "$ref": "#/$defs/SecrecyLevel"
219
+ },
220
+ "roll": {
221
+ "$ref": "#/$defs/RollRule"
222
+ },
223
+ "registrationOpensAt": {
224
+ "type": "string",
225
+ "format": "date-time"
226
+ },
227
+ "votingOpensAt": {
228
+ "type": "string",
229
+ "format": "date-time"
230
+ },
231
+ "votingClosesAt": {
232
+ "type": "string",
233
+ "format": "date-time"
234
+ },
235
+ "revote": {
236
+ "$ref": "#/$defs/Revote"
237
+ },
238
+ "board": {
239
+ "type": "object",
240
+ "additionalProperties": false,
241
+ "required": [
242
+ "visibility",
243
+ "auditors"
244
+ ],
245
+ "properties": {
246
+ "visibility": {
247
+ "$ref": "#/$defs/BoardVisibility"
248
+ },
249
+ "auditors": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "string",
253
+ "minLength": 1,
254
+ "maxLength": 2048
255
+ },
256
+ "uniqueItems": true
257
+ }
258
+ }
259
+ },
260
+ "ballotBox": {
261
+ "type": "string",
262
+ "minLength": 1,
263
+ "maxLength": 2048,
264
+ "description": "The DID of the voting service that holds the board."
265
+ },
266
+ "trustees": {
267
+ "$ref": "#/$defs/Trustees"
268
+ },
269
+ "binding": {
270
+ "type": "boolean",
271
+ "description": "Whether the community treats the result as deciding something; creating a binding election takes another administrator's consent (VTI-VOT-081)."
272
+ },
273
+ "allowEarlyClose": {
274
+ "type": "boolean"
275
+ },
276
+ "resultsBeforeClose": {
277
+ "type": "boolean",
278
+ "description": "Open elections only: whether running totals may be read while voting is open (VTI-VOT-061)."
279
+ },
280
+ "textReleaseThreshold": {
281
+ "type": "integer",
282
+ "minimum": 1,
283
+ "description": "Counted ballots required before any text answer is disclosed (VTI-VOT-065). At least 1, and SHOULD be at least 10: a written answer can identify its author by what it says or how it is phrased, and the fewer the ballots released together, the easier that is. Where it is below 10, the disclosure a member is shown before they request a ticket MUST say so, and MUST say that a written answer may identify its author (VTI-VOT-090)."
284
+ }
285
+ }
286
+ },
287
+ "Trustees": {
288
+ "title": "Trustees",
289
+ "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.",
290
+ "type": "object",
291
+ "additionalProperties": false,
292
+ "required": [
293
+ "dids",
294
+ "threshold"
295
+ ],
296
+ "properties": {
297
+ "dids": {
298
+ "type": "array",
299
+ "minItems": 2,
300
+ "items": {
301
+ "type": "string",
302
+ "minLength": 1,
303
+ "maxLength": 2048
304
+ },
305
+ "uniqueItems": true
306
+ },
307
+ "threshold": {
308
+ "type": "integer",
309
+ "minimum": 2
310
+ }
311
+ }
312
+ },
313
+ "BoardVisibility": {
314
+ "title": "BoardVisibility",
315
+ "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).",
316
+ "type": "string",
317
+ "enum": [
318
+ "public",
319
+ "private"
320
+ ]
321
+ },
322
+ "Revote": {
323
+ "title": "Revote",
324
+ "description": "What a later, different ballot under one ticket does: `replace` the earlier one, or be refused (`refuse`) (VTI-VOT-041).",
325
+ "type": "string",
326
+ "enum": [
327
+ "replace",
328
+ "refuse"
329
+ ]
330
+ },
331
+ "RollRule": {
332
+ "title": "RollRule",
333
+ "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.",
334
+ "type": "object",
335
+ "additionalProperties": false,
336
+ "required": [
337
+ "rule"
338
+ ],
339
+ "properties": {
340
+ "rule": {
341
+ "type": "string",
342
+ "enum": [
343
+ "members",
344
+ "membersAndListed",
345
+ "listed"
346
+ ]
347
+ },
348
+ "listed": {
349
+ "type": "array",
350
+ "items": {
351
+ "type": "string",
352
+ "minLength": 1,
353
+ "maxLength": 2048,
354
+ "description": "A DID enfranchised by name."
355
+ },
356
+ "uniqueItems": true
357
+ }
358
+ }
359
+ },
360
+ "SecrecyLevel": {
361
+ "title": "SecrecyLevel",
362
+ "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). The encrypted levels are cast with `voting/ballot/cast-encrypted/0.1`, under an election key the trustees generate with `voting/trustees/*` (CONVENTIONS §9).",
363
+ "type": "string",
364
+ "enum": [
365
+ "open",
366
+ "sealed",
367
+ "talliedEncrypted"
368
+ ]
369
+ },
370
+ "Question": {
371
+ "title": "Question",
372
+ "description": "One question. Tagged union over `type`.",
373
+ "oneOf": [
374
+ {
375
+ "title": "ChoiceQuestion",
376
+ "description": "Select between `minSelections` and `maxSelections` of `options`. A yes/no/abstain motion is a choice of exactly one of three.",
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": [
380
+ "key",
381
+ "type",
382
+ "options",
383
+ "minSelections",
384
+ "maxSelections",
385
+ "optional"
386
+ ],
387
+ "properties": {
388
+ "key": {
389
+ "$ref": "#/$defs/Key"
390
+ },
391
+ "type": {
392
+ "const": "choice"
393
+ },
394
+ "text": {
395
+ "type": "string",
396
+ "maxLength": 2048
397
+ },
398
+ "options": {
399
+ "type": "array",
400
+ "minItems": 2,
401
+ "maxItems": 256,
402
+ "items": {
403
+ "$ref": "#/$defs/QuestionOption"
404
+ }
405
+ },
406
+ "minSelections": {
407
+ "type": "integer",
408
+ "minimum": 0
409
+ },
410
+ "maxSelections": {
411
+ "type": "integer",
412
+ "minimum": 1
413
+ },
414
+ "optional": {
415
+ "type": "boolean"
416
+ }
417
+ }
418
+ },
419
+ {
420
+ "title": "RankingQuestion",
421
+ "description": "Order `options`; a ballot ranks every option or, when `partial` is true, a prefix of them.",
422
+ "type": "object",
423
+ "additionalProperties": false,
424
+ "required": [
425
+ "key",
426
+ "type",
427
+ "options",
428
+ "partial",
429
+ "optional"
430
+ ],
431
+ "properties": {
432
+ "key": {
433
+ "$ref": "#/$defs/Key"
434
+ },
435
+ "type": {
436
+ "const": "ranking"
437
+ },
438
+ "text": {
439
+ "type": "string",
440
+ "maxLength": 2048
441
+ },
442
+ "options": {
443
+ "type": "array",
444
+ "minItems": 2,
445
+ "maxItems": 64,
446
+ "items": {
447
+ "$ref": "#/$defs/QuestionOption"
448
+ }
449
+ },
450
+ "partial": {
451
+ "type": "boolean"
452
+ },
453
+ "optional": {
454
+ "type": "boolean"
455
+ }
456
+ }
457
+ },
458
+ {
459
+ "title": "ScoreQuestion",
460
+ "description": "Give each option an integer score within [min, max].",
461
+ "type": "object",
462
+ "additionalProperties": false,
463
+ "required": [
464
+ "key",
465
+ "type",
466
+ "options",
467
+ "min",
468
+ "max",
469
+ "optional"
470
+ ],
471
+ "properties": {
472
+ "key": {
473
+ "$ref": "#/$defs/Key"
474
+ },
475
+ "type": {
476
+ "const": "score"
477
+ },
478
+ "text": {
479
+ "type": "string",
480
+ "maxLength": 2048
481
+ },
482
+ "options": {
483
+ "type": "array",
484
+ "minItems": 1,
485
+ "maxItems": 256,
486
+ "items": {
487
+ "$ref": "#/$defs/QuestionOption"
488
+ }
489
+ },
490
+ "min": {
491
+ "type": "integer"
492
+ },
493
+ "max": {
494
+ "type": "integer"
495
+ },
496
+ "optional": {
497
+ "type": "boolean"
498
+ }
499
+ }
500
+ },
501
+ {
502
+ "title": "TextQuestion",
503
+ "description": "Free text of at most `maxLength` characters.",
504
+ "type": "object",
505
+ "additionalProperties": false,
506
+ "required": [
507
+ "key",
508
+ "type",
509
+ "maxLength",
510
+ "optional"
511
+ ],
512
+ "properties": {
513
+ "key": {
514
+ "$ref": "#/$defs/Key"
515
+ },
516
+ "type": {
517
+ "const": "text"
518
+ },
519
+ "text": {
520
+ "type": "string",
521
+ "maxLength": 2048
522
+ },
523
+ "maxLength": {
524
+ "type": "integer",
525
+ "minimum": 1,
526
+ "maximum": 4096
527
+ },
528
+ "optional": {
529
+ "type": "boolean"
530
+ }
531
+ }
532
+ }
533
+ ]
534
+ },
535
+ "Key": {
536
+ "title": "Key",
537
+ "description": "A question or option key, unique within its manifest or question.",
538
+ "type": "string",
539
+ "pattern": "^[A-Za-z0-9._-]{1,64}$"
540
+ },
541
+ "QuestionOption": {
542
+ "title": "QuestionOption",
543
+ "type": "object",
544
+ "additionalProperties": false,
545
+ "required": [
546
+ "key"
547
+ ],
548
+ "properties": {
549
+ "key": {
550
+ "$ref": "#/$defs/Key"
551
+ },
552
+ "label": {
553
+ "type": "string",
554
+ "maxLength": 512,
555
+ "description": "Display text. Absent from a manifest registered with a ballot box that holds no question text (VTI-VOT-014)."
556
+ }
557
+ }
558
+ }
559
+ }
560
+ } as const;
561
+
562
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
563
+ export const RESPONSE_PAYLOAD_SCHEMA = {
564
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
565
+ "$ref": "#/$defs/Response",
566
+ "$defs": {
567
+ "Response": {
568
+ "$anchor": "response",
569
+ "title": "VTC Elections — Create — response payload",
570
+ "description": "Success response to vtc/elections/create/0.1: the election as recorded. Type https://trusttasks.org/spec/vtc/elections/create/0.4#response — carried directly, or on the request's threadId when a parked creation executes after its approval.",
571
+ "type": "object",
572
+ "additionalProperties": false,
573
+ "required": [
574
+ "electionId",
575
+ "manifestDigest",
576
+ "state"
577
+ ],
578
+ "properties": {
579
+ "electionId": {
580
+ "$ref": "#/$defs/ElectionId"
581
+ },
582
+ "manifestDigest": {
583
+ "$ref": "#/$defs/DigestMultibase",
584
+ "description": "The SHA-256 multihash of the RFC 8785 (JCS) canonicalization of the manifest as registered."
585
+ },
586
+ "state": {
587
+ "type": "string",
588
+ "enum": [
589
+ "pendingRegistration",
590
+ "registered"
591
+ ],
592
+ "description": "`registered`: the ballot box answered the registration. `pendingRegistration`: the election is recorded and the community is still delivering it to the ballot box; it keeps trying, and issues no ticket until the ballot box has answered."
593
+ },
594
+ "actionId": {
595
+ "$ref": "#/$defs/ActionId",
596
+ "description": "Present when this response follows the execution of a creation that was parked for another administrator's consent: the identifier of that action, as vtc/admin/actions/show named it."
597
+ },
598
+ "ext": {
599
+ "$ref": "#/$defs/Ext"
600
+ }
601
+ }
602
+ },
603
+ "Ext": {
604
+ "title": "Ext",
605
+ "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.",
606
+ "type": "object",
607
+ "minProperties": 1,
608
+ "additionalProperties": true,
609
+ "propertyNames": {
610
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
611
+ }
612
+ },
613
+ "ActionId": {
614
+ "title": "ActionId",
615
+ "description": "Opaque, community-minted identifier of one action. A consumer MUST NOT parse or order it; it is compared for equality only. Long enough to be unguessable, because a show of an id the caller may not see is answered `notFound` and an enumerable id would turn that answer into an oracle.",
616
+ "type": "string",
617
+ "minLength": 16,
618
+ "maxLength": 128,
619
+ "pattern": "^[A-Za-z0-9._~:-]+$"
620
+ },
621
+ "DigestMultibase": {
622
+ "title": "DigestMultibase",
623
+ "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`.",
624
+ "type": "string",
625
+ "minLength": 16,
626
+ "pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$",
627
+ "examples": [
628
+ "zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"
629
+ ]
630
+ },
631
+ "ElectionId": {
632
+ "title": "ElectionId",
633
+ "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.",
634
+ "type": "string",
635
+ "pattern": "^[A-Za-z0-9._-]{1,128}$"
636
+ },
637
+ "Manifest": {
638
+ "title": "Manifest",
639
+ "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).",
640
+ "type": "object",
641
+ "additionalProperties": false,
642
+ "required": [
643
+ "electionId",
644
+ "community",
645
+ "questions",
646
+ "secrecy",
647
+ "roll",
648
+ "registrationOpensAt",
649
+ "votingOpensAt",
650
+ "votingClosesAt",
651
+ "revote",
652
+ "board",
653
+ "ballotBox",
654
+ "binding",
655
+ "allowEarlyClose",
656
+ "resultsBeforeClose",
657
+ "textReleaseThreshold"
658
+ ],
659
+ "properties": {
660
+ "electionId": {
661
+ "$ref": "#/$defs/ElectionId"
662
+ },
663
+ "community": {
664
+ "type": "string",
665
+ "minLength": 1,
666
+ "maxLength": 2048,
667
+ "description": "The community's DID."
668
+ },
669
+ "title": {
670
+ "type": "string",
671
+ "maxLength": 512
672
+ },
673
+ "description": {
674
+ "type": "string",
675
+ "maxLength": 8192
676
+ },
677
+ "questions": {
678
+ "type": "array",
679
+ "minItems": 1,
680
+ "maxItems": 128,
681
+ "items": {
682
+ "$ref": "#/$defs/Question"
683
+ }
684
+ },
685
+ "secrecy": {
686
+ "$ref": "#/$defs/SecrecyLevel"
687
+ },
688
+ "roll": {
689
+ "$ref": "#/$defs/RollRule"
690
+ },
691
+ "registrationOpensAt": {
692
+ "type": "string",
693
+ "format": "date-time"
694
+ },
695
+ "votingOpensAt": {
696
+ "type": "string",
697
+ "format": "date-time"
698
+ },
699
+ "votingClosesAt": {
700
+ "type": "string",
701
+ "format": "date-time"
702
+ },
703
+ "revote": {
704
+ "$ref": "#/$defs/Revote"
705
+ },
706
+ "board": {
707
+ "type": "object",
708
+ "additionalProperties": false,
709
+ "required": [
710
+ "visibility",
711
+ "auditors"
712
+ ],
713
+ "properties": {
714
+ "visibility": {
715
+ "$ref": "#/$defs/BoardVisibility"
716
+ },
717
+ "auditors": {
718
+ "type": "array",
719
+ "items": {
720
+ "type": "string",
721
+ "minLength": 1,
722
+ "maxLength": 2048
723
+ },
724
+ "uniqueItems": true
725
+ }
726
+ }
727
+ },
728
+ "ballotBox": {
729
+ "type": "string",
730
+ "minLength": 1,
731
+ "maxLength": 2048,
732
+ "description": "The DID of the voting service that holds the board."
733
+ },
734
+ "trustees": {
735
+ "$ref": "#/$defs/Trustees"
736
+ },
737
+ "binding": {
738
+ "type": "boolean",
739
+ "description": "Whether the community treats the result as deciding something; creating a binding election takes another administrator's consent (VTI-VOT-081)."
740
+ },
741
+ "allowEarlyClose": {
742
+ "type": "boolean"
743
+ },
744
+ "resultsBeforeClose": {
745
+ "type": "boolean",
746
+ "description": "Open elections only: whether running totals may be read while voting is open (VTI-VOT-061)."
747
+ },
748
+ "textReleaseThreshold": {
749
+ "type": "integer",
750
+ "minimum": 1,
751
+ "description": "Counted ballots required before any text answer is disclosed (VTI-VOT-065). At least 1, and SHOULD be at least 10: a written answer can identify its author by what it says or how it is phrased, and the fewer the ballots released together, the easier that is. Where it is below 10, the disclosure a member is shown before they request a ticket MUST say so, and MUST say that a written answer may identify its author (VTI-VOT-090)."
752
+ }
753
+ }
754
+ },
755
+ "Trustees": {
756
+ "title": "Trustees",
757
+ "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.",
758
+ "type": "object",
759
+ "additionalProperties": false,
760
+ "required": [
761
+ "dids",
762
+ "threshold"
763
+ ],
764
+ "properties": {
765
+ "dids": {
766
+ "type": "array",
767
+ "minItems": 2,
768
+ "items": {
769
+ "type": "string",
770
+ "minLength": 1,
771
+ "maxLength": 2048
772
+ },
773
+ "uniqueItems": true
774
+ },
775
+ "threshold": {
776
+ "type": "integer",
777
+ "minimum": 2
778
+ }
779
+ }
780
+ },
781
+ "BoardVisibility": {
782
+ "title": "BoardVisibility",
783
+ "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).",
784
+ "type": "string",
785
+ "enum": [
786
+ "public",
787
+ "private"
788
+ ]
789
+ },
790
+ "Revote": {
791
+ "title": "Revote",
792
+ "description": "What a later, different ballot under one ticket does: `replace` the earlier one, or be refused (`refuse`) (VTI-VOT-041).",
793
+ "type": "string",
794
+ "enum": [
795
+ "replace",
796
+ "refuse"
797
+ ]
798
+ },
799
+ "RollRule": {
800
+ "title": "RollRule",
801
+ "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.",
802
+ "type": "object",
803
+ "additionalProperties": false,
804
+ "required": [
805
+ "rule"
806
+ ],
807
+ "properties": {
808
+ "rule": {
809
+ "type": "string",
810
+ "enum": [
811
+ "members",
812
+ "membersAndListed",
813
+ "listed"
814
+ ]
815
+ },
816
+ "listed": {
817
+ "type": "array",
818
+ "items": {
819
+ "type": "string",
820
+ "minLength": 1,
821
+ "maxLength": 2048,
822
+ "description": "A DID enfranchised by name."
823
+ },
824
+ "uniqueItems": true
825
+ }
826
+ }
827
+ },
828
+ "SecrecyLevel": {
829
+ "title": "SecrecyLevel",
830
+ "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). The encrypted levels are cast with `voting/ballot/cast-encrypted/0.1`, under an election key the trustees generate with `voting/trustees/*` (CONVENTIONS §9).",
831
+ "type": "string",
832
+ "enum": [
833
+ "open",
834
+ "sealed",
835
+ "talliedEncrypted"
836
+ ]
837
+ },
838
+ "Question": {
839
+ "title": "Question",
840
+ "description": "One question. Tagged union over `type`.",
841
+ "oneOf": [
842
+ {
843
+ "title": "ChoiceQuestion",
844
+ "description": "Select between `minSelections` and `maxSelections` of `options`. A yes/no/abstain motion is a choice of exactly one of three.",
845
+ "type": "object",
846
+ "additionalProperties": false,
847
+ "required": [
848
+ "key",
849
+ "type",
850
+ "options",
851
+ "minSelections",
852
+ "maxSelections",
853
+ "optional"
854
+ ],
855
+ "properties": {
856
+ "key": {
857
+ "$ref": "#/$defs/Key"
858
+ },
859
+ "type": {
860
+ "const": "choice"
861
+ },
862
+ "text": {
863
+ "type": "string",
864
+ "maxLength": 2048
865
+ },
866
+ "options": {
867
+ "type": "array",
868
+ "minItems": 2,
869
+ "maxItems": 256,
870
+ "items": {
871
+ "$ref": "#/$defs/QuestionOption"
872
+ }
873
+ },
874
+ "minSelections": {
875
+ "type": "integer",
876
+ "minimum": 0
877
+ },
878
+ "maxSelections": {
879
+ "type": "integer",
880
+ "minimum": 1
881
+ },
882
+ "optional": {
883
+ "type": "boolean"
884
+ }
885
+ }
886
+ },
887
+ {
888
+ "title": "RankingQuestion",
889
+ "description": "Order `options`; a ballot ranks every option or, when `partial` is true, a prefix of them.",
890
+ "type": "object",
891
+ "additionalProperties": false,
892
+ "required": [
893
+ "key",
894
+ "type",
895
+ "options",
896
+ "partial",
897
+ "optional"
898
+ ],
899
+ "properties": {
900
+ "key": {
901
+ "$ref": "#/$defs/Key"
902
+ },
903
+ "type": {
904
+ "const": "ranking"
905
+ },
906
+ "text": {
907
+ "type": "string",
908
+ "maxLength": 2048
909
+ },
910
+ "options": {
911
+ "type": "array",
912
+ "minItems": 2,
913
+ "maxItems": 64,
914
+ "items": {
915
+ "$ref": "#/$defs/QuestionOption"
916
+ }
917
+ },
918
+ "partial": {
919
+ "type": "boolean"
920
+ },
921
+ "optional": {
922
+ "type": "boolean"
923
+ }
924
+ }
925
+ },
926
+ {
927
+ "title": "ScoreQuestion",
928
+ "description": "Give each option an integer score within [min, max].",
929
+ "type": "object",
930
+ "additionalProperties": false,
931
+ "required": [
932
+ "key",
933
+ "type",
934
+ "options",
935
+ "min",
936
+ "max",
937
+ "optional"
938
+ ],
939
+ "properties": {
940
+ "key": {
941
+ "$ref": "#/$defs/Key"
942
+ },
943
+ "type": {
944
+ "const": "score"
945
+ },
946
+ "text": {
947
+ "type": "string",
948
+ "maxLength": 2048
949
+ },
950
+ "options": {
951
+ "type": "array",
952
+ "minItems": 1,
953
+ "maxItems": 256,
954
+ "items": {
955
+ "$ref": "#/$defs/QuestionOption"
956
+ }
957
+ },
958
+ "min": {
959
+ "type": "integer"
960
+ },
961
+ "max": {
962
+ "type": "integer"
963
+ },
964
+ "optional": {
965
+ "type": "boolean"
966
+ }
967
+ }
968
+ },
969
+ {
970
+ "title": "TextQuestion",
971
+ "description": "Free text of at most `maxLength` characters.",
972
+ "type": "object",
973
+ "additionalProperties": false,
974
+ "required": [
975
+ "key",
976
+ "type",
977
+ "maxLength",
978
+ "optional"
979
+ ],
980
+ "properties": {
981
+ "key": {
982
+ "$ref": "#/$defs/Key"
983
+ },
984
+ "type": {
985
+ "const": "text"
986
+ },
987
+ "text": {
988
+ "type": "string",
989
+ "maxLength": 2048
990
+ },
991
+ "maxLength": {
992
+ "type": "integer",
993
+ "minimum": 1,
994
+ "maximum": 4096
995
+ },
996
+ "optional": {
997
+ "type": "boolean"
998
+ }
999
+ }
1000
+ }
1001
+ ]
1002
+ },
1003
+ "Key": {
1004
+ "title": "Key",
1005
+ "description": "A question or option key, unique within its manifest or question.",
1006
+ "type": "string",
1007
+ "pattern": "^[A-Za-z0-9._-]{1,64}$"
1008
+ },
1009
+ "QuestionOption": {
1010
+ "title": "QuestionOption",
1011
+ "type": "object",
1012
+ "additionalProperties": false,
1013
+ "required": [
1014
+ "key"
1015
+ ],
1016
+ "properties": {
1017
+ "key": {
1018
+ "$ref": "#/$defs/Key"
1019
+ },
1020
+ "label": {
1021
+ "type": "string",
1022
+ "maxLength": 512,
1023
+ "description": "Display text. Absent from a manifest registered with a ballot box that holds no question text (VTI-VOT-014)."
1024
+ }
1025
+ }
1026
+ }
1027
+ }
1028
+ } as const;
1029
+
1030
+ /**
1031
+ * SPEC.md §7.2 policy for the request variant, from this specification's
1032
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
1033
+ * per-specification and cannot be derived from the document alone, and
1034
+ * item 2 needs the schema this carries.
1035
+ */
1036
+ export const SPEC = {
1037
+ typeUri: TYPE_URI,
1038
+ isBearer: false,
1039
+ isProofRequired: true,
1040
+ isRecipientRequired: true,
1041
+ isIssuedAtRequired: true,
1042
+ payloadSchema: PAYLOAD_SCHEMA,
1043
+ } as const;
1044
+
1045
+ /**
1046
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
1047
+ * tracks the *issuer* party's requirement because a response swaps the
1048
+ * parties (§7.3 item 5).
1049
+ */
1050
+ export const RESPONSE_SPEC = {
1051
+ typeUri: RESPONSE_TYPE_URI,
1052
+ isBearer: false,
1053
+ isProofRequired: true,
1054
+ isRecipientRequired: true,
1055
+ isIssuedAtRequired: true,
1056
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
1057
+ } as const;