//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `voting/board/read`. Version: `0.2`.
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = None;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///The answer to one question. Exactly one member besides `question` is present, matching the question's type, or `abstain` for an optional question left unanswered.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Answer {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub abstain: ::std::option::Option<::serde_json::Value>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub choice: ::std::option::Option<Vec<Key>>,
pub question: Key,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ranking: ::std::option::Option<Vec<Key>>,
#[serde(
default,
skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
)]
pub scores: ::std::collections::HashMap<Key, i64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub text: ::std::option::Option<AnswerText>,
}
impl Answer {
pub fn builder() -> builder::Answer {
Default::default()
}
}
///`AnswerText`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct AnswerText(::std::string::String);
impl ::std::ops::Deref for AnswerText {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AnswerText> for ::std::string::String {
fn from(value: AnswerText) -> Self {
value.0
}
}
impl ::std::str::FromStr for AnswerText {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for AnswerText {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for AnswerText {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for AnswerText {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for AnswerText {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///An open ballot: one answer per question of the manifest, in any order. The bytes a cast's proof binds are the RFC 8785 (JCS) canonicalization of this object as received.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Ballot {
pub answers: ::std::vec::Vec<Answer>,
#[serde(rename = "electionId")]
pub election_id: ElectionId,
#[serde(rename = "manifestDigest")]
pub manifest_digest: DigestMultibase,
}
impl Ballot {
pub fn builder() -> builder::Ballot {
Default::default()
}
}
///One leaf of a board. A leaf's hash is the RFC 9162 leaf hash of the JCS canonicalization of this object. Entries carry no time of arrival: the order is the board's, and a timestamp would hand anyone who reads the board the timing the registrar's log would need to pair a ticket with its cast.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum BoardEntry {
CastEntry {
cast: Cast,
kind: ::serde_json::Value,
},
ReplacementEntry {
by: u64,
kind: ::serde_json::Value,
replaces: u64,
tag: Multibase,
},
LifecycleEntry {
kind: LifecycleEntryKind,
#[serde(rename = "occurredAt")]
occurred_at: ::chrono::DateTime<::chrono::offset::Utc>,
},
ResultEntry {
kind: ::serde_json::Value,
result: ElectionResult,
},
EncryptedCastEntry {
cast: EncryptedCast,
kind: ::serde_json::Value,
},
TransportKeyEntry {
kind: ::serde_json::Value,
#[serde(rename = "transportKey")]
transport_key: TransportKey,
},
DealingEntry {
dealing: Dealing,
kind: ::serde_json::Value,
},
ConfirmationEntry {
complaints: ::std::vec::Vec<TrusteeIndex>,
kind: ::serde_json::Value,
trustee: TrusteeIndex,
},
JustificationEntry {
dealer: TrusteeIndex,
kind: ::serde_json::Value,
recipient: TrusteeIndex,
share: GroupScalar,
},
ElectionKeyEntry {
#[serde(rename = "electionKey")]
election_key: ElectionKey,
kind: ::serde_json::Value,
},
PartialDecryptionsEntry {
kind: ::serde_json::Value,
partials: ::std::vec::Vec<PartialDecryption>,
trustee: TrusteeIndex,
},
UnsealedEntry {
ballot: Ballot,
kind: ::serde_json::Value,
#[serde(rename = "leafIndex")]
leaf_index: u64,
},
SpoiledEntry {
kind: ::serde_json::Value,
#[serde(rename = "leafIndex")]
leaf_index: u64,
},
TrusteeStepEntry {
kind: ::serde_json::Value,
request: SignedRequest,
},
DecryptionAuthorizedEntry {
kind: ::serde_json::Value,
request: SignedRequest,
},
}
///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.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct BoardHead {
#[serde(rename = "electionId")]
pub election_id: ElectionId,
#[serde(rename = "issuedAt")]
pub issued_at: ::chrono::DateTime<::chrono::offset::Utc>,
///The RFC 9162 Merkle tree hash (SHA-256) of the first `treeSize` entries, as a multihash.
#[serde(rename = "rootHash")]
pub root_hash: DigestMultibase,
#[serde(rename = "treeSize")]
pub tree_size: u64,
}
impl BoardHead {
pub fn builder() -> builder::BoardHead {
Default::default()
}
}
///A ballot and the PCS attestation that admits it (VTI-VOT-030). `attestation` is the suite's canonical encoding of the attestation made for the election point with the ballot context bound in (CONVENTIONS §3); `tag` repeats its tag so a ballot box can refuse a duplicate before the pairing check.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Cast {
pub attestation: Multibase,
pub ballot: Ballot,
pub tag: Multibase,
}
impl Cast {
pub fn builder() -> builder::Cast {
Default::default()
}
}
///A trustee's contribution to the election key: Feldman commitments to its polynomial, a proof of knowledge of the constant term, and one share per trustee sealed to that trustee's transport key (CONVENTIONS §9.6).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Dealing {
pub commitments: ::std::vec::Vec<GroupElement>,
pub dealer: TrusteeIndex,
pub pok: SigmaProof,
pub shares: ::std::vec::Vec<SealedShare>,
}
impl Dealing {
pub fn builder() -> builder::Dealing {
Default::default()
}
}
///What a partial decryption decrypts: the sealed cast at a board leaf, or the total of one option of one question.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum DecryptionTarget {
Variant0 {
ciphertext: ElGamalCiphertext,
///A sealed cast's board leaf.
#[serde(rename = "leafIndex")]
leaf_index: u64,
},
Variant1 {
ciphertext: ElGamalCiphertext,
option: Key,
question: Key,
},
}
/**
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.
Multihash 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.
This 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.
Restricted 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`.*/
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct DigestMultibase(::std::string::String);
impl ::std::ops::Deref for DigestMultibase {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<DigestMultibase> for ::std::string::String {
fn from(value: DigestMultibase) -> Self {
value.0
}
}
impl ::std::str::FromStr for DigestMultibase {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 16usize {
return Err("shorter than 16 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\"".into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for DigestMultibase {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A disjunctive proof that a ciphertext encrypts one value of a public list: one `(c, z)` per value, in the list's order (CONVENTIONS §9.3).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct DisjunctiveProof(pub ::std::vec::Vec<SigmaProof>);
impl ::std::ops::Deref for DisjunctiveProof {
type Target = ::std::vec::Vec<SigmaProof>;
fn deref(&self) -> &::std::vec::Vec<SigmaProof> {
&self.0
}
}
impl ::std::convert::From<DisjunctiveProof> for ::std::vec::Vec<SigmaProof> {
fn from(value: DisjunctiveProof) -> Self {
value.0
}
}
impl ::std::convert::From<::std::vec::Vec<SigmaProof>> for DisjunctiveProof {
fn from(value: ::std::vec::Vec<SigmaProof>) -> Self {
Self(value)
}
}
///`(a, b) = (r·G, M + r·Y)` under the election key `Y` (CONVENTIONS §9.2).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ElGamalCiphertext {
pub a: GroupElement,
pub b: GroupElement,
}
impl ElGamalCiphertext {
pub fn builder() -> builder::ElGamalCiphertext {
Default::default()
}
}
///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.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ElectionId(::std::string::String);
impl ::std::ops::Deref for ElectionId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ElectionId> for ::std::string::String {
fn from(value: ElectionId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ElectionId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[A-Za-z0-9._-]{1,128}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9._-]{1,128}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ElectionId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ElectionId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ElectionId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ElectionId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The election key and each trustee's public verification key, computed from the qualified dealings (CONVENTIONS §9.6). Anyone can recompute it from the board.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ElectionKey {
pub key: GroupElement,
///The dealers whose dealings the key is formed from.
pub qualified: ::std::vec::Vec<TrusteeIndex>,
pub verification: ::std::vec::Vec<ElectionKeyVerificationItem>,
}
impl ElectionKey {
pub fn builder() -> builder::ElectionKey {
Default::default()
}
}
///`ElectionKeyVerificationItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ElectionKeyVerificationItem {
pub key: GroupElement,
pub trustee: TrusteeIndex,
}
impl ElectionKeyVerificationItem {
pub fn builder() -> builder::ElectionKeyVerificationItem {
Default::default()
}
}
///An election's result, computable by anyone who can read its board from the board and the registration alone (VTI-VOT-070).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ElectionResult {
#[serde(rename = "ballotsCounted")]
pub ballots_counted: u64,
#[serde(rename = "electionId")]
pub election_id: ElectionId,
///The head of the board as it stood at close: the result counts exactly its entries.
pub head: BoardHead,
#[serde(rename = "manifestDigest")]
pub manifest_digest: DigestMultibase,
pub questions: ::std::vec::Vec<QuestionResult>,
}
impl ElectionResult {
pub fn builder() -> builder::ElectionResult {
Default::default()
}
}
///A tallied-encrypted ballot: one EncryptedQuestion per manifest question, in the manifest's order. Never decrypted (VTI-VOT-064).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct EncryptedBallot {
#[serde(rename = "electionId")]
pub election_id: ElectionId,
#[serde(rename = "manifestDigest")]
pub manifest_digest: DigestMultibase,
pub questions: ::std::vec::Vec<EncryptedQuestion>,
}
impl EncryptedBallot {
pub fn builder() -> builder::EncryptedBallot {
Default::default()
}
}
///A cast of a sealed or tallied-encrypted election: exactly one of `sealed` (the Ballot's JCS bytes sealed to the election key) or `encrypted`, with the tag and the attestation over the JCS bytes of whichever is present (CONVENTIONS §3.6, §9.5).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum EncryptedCast {
Variant0 {
attestation: Multibase,
sealed: SealedPayload,
tag: Multibase,
},
Variant1 {
attestation: Multibase,
encrypted: EncryptedBallot,
tag: Multibase,
},
}
///`EncryptedOption`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct EncryptedOption {
pub ciphertext: ElGamalCiphertext,
pub proof: DisjunctiveProof,
}
impl EncryptedOption {
pub fn builder() -> builder::EncryptedOption {
Default::default()
}
}
///One choice question of a tallied-encrypted ballot: per option, in the manifest's order, an encryption of 0 or 1 with its proof; and a proof that the selections sum to a count the question admits (CONVENTIONS §9.5).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct EncryptedQuestion {
pub options: ::std::vec::Vec<EncryptedOption>,
pub question: Key,
#[serde(rename = "sumProof")]
pub sum_proof: DisjunctiveProof,
}
impl EncryptedQuestion {
pub fn builder() -> builder::EncryptedQuestion {
Default::default()
}
}
///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.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A Ristretto group element: its 32-byte compression, multibase base58btc. Never the identity (CONVENTIONS §9.1).
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct GroupElement(::std::string::String);
impl ::std::ops::Deref for GroupElement {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<GroupElement> for ::std::string::String {
fn from(value: GroupElement) -> Self {
value.0
}
}
impl ::std::str::FromStr for GroupElement {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 2usize {
return Err("shorter than 2 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^z[1-9A-HJ-NP-Za-km-z]+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^z[1-9A-HJ-NP-Za-km-z]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for GroupElement {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for GroupElement {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for GroupElement {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for GroupElement {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A scalar mod the Ristretto group order: 32 canonical little-endian bytes, multibase base58btc (CONVENTIONS §9.1).
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct GroupScalar(::std::string::String);
impl ::std::ops::Deref for GroupScalar {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<GroupScalar> for ::std::string::String {
fn from(value: GroupScalar) -> Self {
value.0
}
}
impl ::std::str::FromStr for GroupScalar {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 2usize {
return Err("shorter than 2 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^z[1-9A-HJ-NP-Za-km-z]+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^z[1-9A-HJ-NP-Za-km-z]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for GroupScalar {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for GroupScalar {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for GroupScalar {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for GroupScalar {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A question or option key, unique within its manifest or question.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Key(::std::string::String);
impl ::std::ops::Deref for Key {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Key> for ::std::string::String {
fn from(value: Key) -> Self {
value.0
}
}
impl ::std::str::FromStr for Key {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z0-9._-]{1,64}$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9._-]{1,64}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Key {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for Key {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for Key {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for Key {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`LifecycleEntryKind`
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum LifecycleEntryKind {
#[serde(rename = "opened")]
Opened,
#[serde(rename = "closed")]
Closed,
#[serde(rename = "closedEarly")]
ClosedEarly,
#[serde(rename = "cancelled")]
Cancelled,
}
impl ::std::fmt::Display for LifecycleEntryKind {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Opened => f.write_str("opened"),
Self::Closed => f.write_str("closed"),
Self::ClosedEarly => f.write_str("closedEarly"),
Self::Cancelled => f.write_str("cancelled"),
}
}
}
impl ::std::str::FromStr for LifecycleEntryKind {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"opened" => Ok(Self::Opened),
"closed" => Ok(Self::Closed),
"closedEarly" => Ok(Self::ClosedEarly),
"cancelled" => Ok(Self::Cancelled),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for LifecycleEntryKind {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for LifecycleEntryKind {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for LifecycleEntryKind {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A binary value, multibase base58btc over the suite's canonical (compressed) encoding.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Multibase(::std::string::String);
impl ::std::ops::Deref for Multibase {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Multibase> for ::std::string::String {
fn from(value: Multibase) -> Self {
value.0
}
}
impl ::std::str::FromStr for Multibase {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 16384usize {
return Err("longer than 16384 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^z[1-9A-HJ-NP-Za-km-z]+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^z[1-9A-HJ-NP-Za-km-z]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Multibase {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for Multibase {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for Multibase {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for Multibase {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Trustee `trustee`'s share of one decryption, `d = x_j·a`, with a Chaum–Pedersen proof against its verification key (CONVENTIONS §9.7).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PartialDecryption {
pub d: GroupElement,
pub proof: SigmaProof,
pub target: DecryptionTarget,
}
impl PartialDecryption {
pub fn builder() -> builder::PartialDecryption {
Default::default()
}
}
///Reads a range of an election board's entries, against the current head or against an earlier tree size.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///The community's DID.
pub community: PayloadCommunity,
#[serde(rename = "electionId")]
pub election_id: ElectionId,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The index of the first entry to return.
pub from: u64,
///The most entries to return.
pub limit: ::std::num::NonZeroU64,
///Read against the board as it stood at this size — the size of a head the reader holds. At most the current size. Absent: the current size.
#[serde(
rename = "treeSize",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub tree_size: ::std::option::Option<u64>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The community's DID.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadCommunity(::std::string::String);
impl ::std::ops::Deref for PayloadCommunity {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadCommunity> for ::std::string::String {
fn from(value: PayloadCommunity) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadCommunity {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadCommunity {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PayloadCommunity {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PayloadCommunity {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PayloadCommunity {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///One question's totals. `choice`: selections per option. `ranking`: per option, how many ballots placed it at each position (index 0 = first). `score`: per option, the sum and the number of ballots that scored it. `text`: the answers, in board order, withheld (`withheld: true`) below the manifest's `textReleaseThreshold`. `abstained` counts ballots that left the question unanswered.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct QuestionResult {
pub abstained: u64,
#[serde(
default,
skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
)]
pub choice: ::std::collections::HashMap<Key, u64>,
pub question: Key,
#[serde(
default,
skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
)]
pub ranking: ::std::collections::HashMap<Key, ::std::vec::Vec<u64>>,
#[serde(
default,
skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
)]
pub score: ::std::collections::HashMap<Key, QuestionResultScoreValue>,
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub text: ::std::vec::Vec<QuestionResultTextItem>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub withheld: ::std::option::Option<bool>,
}
impl QuestionResult {
pub fn builder() -> builder::QuestionResult {
Default::default()
}
}
///`QuestionResultScoreValue`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct QuestionResultScoreValue {
pub count: u64,
pub sum: i64,
}
impl QuestionResultScoreValue {
pub fn builder() -> builder::QuestionResultScoreValue {
Default::default()
}
}
///`QuestionResultTextItem`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct QuestionResultTextItem(::std::string::String);
impl ::std::ops::Deref for QuestionResultTextItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<QuestionResultTextItem> for ::std::string::String {
fn from(value: QuestionResultTextItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for QuestionResultTextItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for QuestionResultTextItem {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for QuestionResultTextItem {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for QuestionResultTextItem {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for QuestionResultTextItem {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`Response`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
///Consecutive entries from `from`, in board order.
pub entries: ::std::vec::Vec<ResponseEntriesItem>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The `from` of the next page. Absent when the page reaches `treeSize`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub next: ::std::option::Option<::std::num::NonZeroU64>,
///The tree size the page was read against. No entry at or beyond it is returned.
#[serde(rename = "treeSize")]
pub tree_size: u64,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseEntriesItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseEntriesItem {
pub entry: BoardEntry,
pub index: u64,
}
impl ResponseEntriesItem {
pub fn builder() -> builder::ResponseEntriesItem {
Default::default()
}
}
///Bytes sealed to a key: a random group element encrypted as `kem`, and the bytes under ChaCha20-Poly1305 with a key derived from it, multibase base58btc (CONVENTIONS §9.4).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct SealedPayload {
pub body: SealedPayloadBody,
pub kem: ElGamalCiphertext,
}
impl SealedPayload {
pub fn builder() -> builder::SealedPayload {
Default::default()
}
}
///`SealedPayloadBody`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct SealedPayloadBody(::std::string::String);
impl ::std::ops::Deref for SealedPayloadBody {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<SealedPayloadBody> for ::std::string::String {
fn from(value: SealedPayloadBody) -> Self {
value.0
}
}
impl ::std::str::FromStr for SealedPayloadBody {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 131072usize {
return Err("longer than 131072 characters".into());
}
if value.chars().count() < 2usize {
return Err("shorter than 2 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^z[1-9A-HJ-NP-Za-km-z]+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^z[1-9A-HJ-NP-Za-km-z]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for SealedPayloadBody {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for SealedPayloadBody {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for SealedPayloadBody {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for SealedPayloadBody {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`SealedShare`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct SealedShare {
pub recipient: TrusteeIndex,
pub share: SealedPayload,
}
impl SealedShare {
pub fn builder() -> builder::SealedShare {
Default::default()
}
}
///A non-interactive sigma proof as its challenge and response `(c, z)` (Schnorr or Chaum–Pedersen; CONVENTIONS §9.3).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct SigmaProof {
pub c: GroupScalar,
pub z: GroupScalar,
}
impl SigmaProof {
pub fn builder() -> builder::SigmaProof {
Default::default()
}
}
///A whole Trust Task request document — `id`, `type`, `issuer`, `payload` and every other member, `proof` included — exactly as the ballot box received it, never re-serialised: its proof is taken over its members, and a re-serialised copy does not reliably reproduce them. Typed as an open object so every member survives; CONVENTIONS §9.6 gives the checks that make it a trustee's step.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct SignedRequest(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
impl ::std::ops::Deref for SignedRequest {
type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<SignedRequest>
for ::serde_json::Map<::std::string::String, ::serde_json::Value>
{
fn from(value: SignedRequest) -> Self {
value.0
}
}
impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
for SignedRequest
{
fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
Self(value)
}
}
///The group element a trustee's shares are sealed to, with a Schnorr proof of knowledge of its discrete log (CONVENTIONS §9.6).
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct TransportKey {
pub key: GroupElement,
pub pok: SigmaProof,
pub trustee: TrusteeIndex,
}
impl TransportKey {
pub fn builder() -> builder::TransportKey {
Default::default()
}
}
///A trustee's index: its position in the manifest's `trustees.dids`, counting from 1.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct TrusteeIndex(pub ::std::num::NonZeroU64);
impl ::std::ops::Deref for TrusteeIndex {
type Target = ::std::num::NonZeroU64;
fn deref(&self) -> &::std::num::NonZeroU64 {
&self.0
}
}
impl ::std::convert::From<TrusteeIndex> for ::std::num::NonZeroU64 {
fn from(value: TrusteeIndex) -> Self {
value.0
}
}
impl ::std::convert::From<::std::num::NonZeroU64> for TrusteeIndex {
fn from(value: ::std::num::NonZeroU64) -> Self {
Self(value)
}
}
impl ::std::str::FromStr for TrusteeIndex {
type Err = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
Ok(Self(value.parse()?))
}
}
impl ::std::convert::TryFrom<&str> for TrusteeIndex {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: &str) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::convert::TryFrom<String> for TrusteeIndex {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::fmt::Display for TrusteeIndex {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Answer {
abstain: ::std::result::Result<
::std::option::Option<::serde_json::Value>,
::std::string::String,
>,
choice:
::std::result::Result<::std::option::Option<Vec<super::Key>>, ::std::string::String>,
question: ::std::result::Result<super::Key, ::std::string::String>,
ranking:
::std::result::Result<::std::option::Option<Vec<super::Key>>, ::std::string::String>,
scores: ::std::result::Result<
::std::collections::HashMap<super::Key, i64>,
::std::string::String,
>,
text:
::std::result::Result<::std::option::Option<super::AnswerText>, ::std::string::String>,
}
impl ::std::default::Default for Answer {
fn default() -> Self {
Self {
abstain: Ok(Default::default()),
choice: Ok(Default::default()),
question: Err("no value supplied for question".to_string()),
ranking: Ok(Default::default()),
scores: Ok(Default::default()),
text: Ok(Default::default()),
}
}
}
impl Answer {
pub fn abstain<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::serde_json::Value>>,
T::Error: ::std::fmt::Display,
{
self.abstain = value
.try_into()
.map_err(|e| format!("error converting supplied value for abstain: {e}"));
self
}
pub fn choice<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::Key>>>,
T::Error: ::std::fmt::Display,
{
self.choice = value
.try_into()
.map_err(|e| format!("error converting supplied value for choice: {e}"));
self
}
pub fn question<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Key>,
T::Error: ::std::fmt::Display,
{
self.question = value
.try_into()
.map_err(|e| format!("error converting supplied value for question: {e}"));
self
}
pub fn ranking<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::Key>>>,
T::Error: ::std::fmt::Display,
{
self.ranking = value
.try_into()
.map_err(|e| format!("error converting supplied value for ranking: {e}"));
self
}
pub fn scores<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::collections::HashMap<super::Key, i64>>,
T::Error: ::std::fmt::Display,
{
self.scores = value
.try_into()
.map_err(|e| format!("error converting supplied value for scores: {e}"));
self
}
pub fn text<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::AnswerText>>,
T::Error: ::std::fmt::Display,
{
self.text = value
.try_into()
.map_err(|e| format!("error converting supplied value for text: {e}"));
self
}
}
impl ::std::convert::TryFrom<Answer> for super::Answer {
type Error = super::error::ConversionError;
fn try_from(value: Answer) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
abstain: value.abstain?,
choice: value.choice?,
question: value.question?,
ranking: value.ranking?,
scores: value.scores?,
text: value.text?,
})
}
}
impl ::std::convert::From<super::Answer> for Answer {
fn from(value: super::Answer) -> Self {
Self {
abstain: Ok(value.abstain),
choice: Ok(value.choice),
question: Ok(value.question),
ranking: Ok(value.ranking),
scores: Ok(value.scores),
text: Ok(value.text),
}
}
}
#[derive(Clone, Debug)]
pub struct Ballot {
answers: ::std::result::Result<::std::vec::Vec<super::Answer>, ::std::string::String>,
election_id: ::std::result::Result<super::ElectionId, ::std::string::String>,
manifest_digest: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
}
impl ::std::default::Default for Ballot {
fn default() -> Self {
Self {
answers: Err("no value supplied for answers".to_string()),
election_id: Err("no value supplied for election_id".to_string()),
manifest_digest: Err("no value supplied for manifest_digest".to_string()),
}
}
}
impl Ballot {
pub fn answers<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::Answer>>,
T::Error: ::std::fmt::Display,
{
self.answers = value
.try_into()
.map_err(|e| format!("error converting supplied value for answers: {e}"));
self
}
pub fn election_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElectionId>,
T::Error: ::std::fmt::Display,
{
self.election_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for election_id: {e}"));
self
}
pub fn manifest_digest<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.manifest_digest = value
.try_into()
.map_err(|e| format!("error converting supplied value for manifest_digest: {e}"));
self
}
}
impl ::std::convert::TryFrom<Ballot> for super::Ballot {
type Error = super::error::ConversionError;
fn try_from(value: Ballot) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
answers: value.answers?,
election_id: value.election_id?,
manifest_digest: value.manifest_digest?,
})
}
}
impl ::std::convert::From<super::Ballot> for Ballot {
fn from(value: super::Ballot) -> Self {
Self {
answers: Ok(value.answers),
election_id: Ok(value.election_id),
manifest_digest: Ok(value.manifest_digest),
}
}
}
#[derive(Clone, Debug)]
pub struct BoardHead {
election_id: ::std::result::Result<super::ElectionId, ::std::string::String>,
issued_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
root_hash: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
tree_size: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for BoardHead {
fn default() -> Self {
Self {
election_id: Err("no value supplied for election_id".to_string()),
issued_at: Err("no value supplied for issued_at".to_string()),
root_hash: Err("no value supplied for root_hash".to_string()),
tree_size: Err("no value supplied for tree_size".to_string()),
}
}
}
impl BoardHead {
pub fn election_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElectionId>,
T::Error: ::std::fmt::Display,
{
self.election_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for election_id: {e}"));
self
}
pub fn issued_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.issued_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for issued_at: {e}"));
self
}
pub fn root_hash<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.root_hash = value
.try_into()
.map_err(|e| format!("error converting supplied value for root_hash: {e}"));
self
}
pub fn tree_size<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.tree_size = value
.try_into()
.map_err(|e| format!("error converting supplied value for tree_size: {e}"));
self
}
}
impl ::std::convert::TryFrom<BoardHead> for super::BoardHead {
type Error = super::error::ConversionError;
fn try_from(
value: BoardHead,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
election_id: value.election_id?,
issued_at: value.issued_at?,
root_hash: value.root_hash?,
tree_size: value.tree_size?,
})
}
}
impl ::std::convert::From<super::BoardHead> for BoardHead {
fn from(value: super::BoardHead) -> Self {
Self {
election_id: Ok(value.election_id),
issued_at: Ok(value.issued_at),
root_hash: Ok(value.root_hash),
tree_size: Ok(value.tree_size),
}
}
}
#[derive(Clone, Debug)]
pub struct Cast {
attestation: ::std::result::Result<super::Multibase, ::std::string::String>,
ballot: ::std::result::Result<super::Ballot, ::std::string::String>,
tag: ::std::result::Result<super::Multibase, ::std::string::String>,
}
impl ::std::default::Default for Cast {
fn default() -> Self {
Self {
attestation: Err("no value supplied for attestation".to_string()),
ballot: Err("no value supplied for ballot".to_string()),
tag: Err("no value supplied for tag".to_string()),
}
}
}
impl Cast {
pub fn attestation<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Multibase>,
T::Error: ::std::fmt::Display,
{
self.attestation = value
.try_into()
.map_err(|e| format!("error converting supplied value for attestation: {e}"));
self
}
pub fn ballot<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ballot>,
T::Error: ::std::fmt::Display,
{
self.ballot = value
.try_into()
.map_err(|e| format!("error converting supplied value for ballot: {e}"));
self
}
pub fn tag<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Multibase>,
T::Error: ::std::fmt::Display,
{
self.tag = value
.try_into()
.map_err(|e| format!("error converting supplied value for tag: {e}"));
self
}
}
impl ::std::convert::TryFrom<Cast> for super::Cast {
type Error = super::error::ConversionError;
fn try_from(value: Cast) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attestation: value.attestation?,
ballot: value.ballot?,
tag: value.tag?,
})
}
}
impl ::std::convert::From<super::Cast> for Cast {
fn from(value: super::Cast) -> Self {
Self {
attestation: Ok(value.attestation),
ballot: Ok(value.ballot),
tag: Ok(value.tag),
}
}
}
#[derive(Clone, Debug)]
pub struct Dealing {
commitments:
::std::result::Result<::std::vec::Vec<super::GroupElement>, ::std::string::String>,
dealer: ::std::result::Result<super::TrusteeIndex, ::std::string::String>,
pok: ::std::result::Result<super::SigmaProof, ::std::string::String>,
shares: ::std::result::Result<::std::vec::Vec<super::SealedShare>, ::std::string::String>,
}
impl ::std::default::Default for Dealing {
fn default() -> Self {
Self {
commitments: Err("no value supplied for commitments".to_string()),
dealer: Err("no value supplied for dealer".to_string()),
pok: Err("no value supplied for pok".to_string()),
shares: Err("no value supplied for shares".to_string()),
}
}
}
impl Dealing {
pub fn commitments<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::GroupElement>>,
T::Error: ::std::fmt::Display,
{
self.commitments = value
.try_into()
.map_err(|e| format!("error converting supplied value for commitments: {e}"));
self
}
pub fn dealer<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TrusteeIndex>,
T::Error: ::std::fmt::Display,
{
self.dealer = value
.try_into()
.map_err(|e| format!("error converting supplied value for dealer: {e}"));
self
}
pub fn pok<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::SigmaProof>,
T::Error: ::std::fmt::Display,
{
self.pok = value
.try_into()
.map_err(|e| format!("error converting supplied value for pok: {e}"));
self
}
pub fn shares<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::SealedShare>>,
T::Error: ::std::fmt::Display,
{
self.shares = value
.try_into()
.map_err(|e| format!("error converting supplied value for shares: {e}"));
self
}
}
impl ::std::convert::TryFrom<Dealing> for super::Dealing {
type Error = super::error::ConversionError;
fn try_from(value: Dealing) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
commitments: value.commitments?,
dealer: value.dealer?,
pok: value.pok?,
shares: value.shares?,
})
}
}
impl ::std::convert::From<super::Dealing> for Dealing {
fn from(value: super::Dealing) -> Self {
Self {
commitments: Ok(value.commitments),
dealer: Ok(value.dealer),
pok: Ok(value.pok),
shares: Ok(value.shares),
}
}
}
#[derive(Clone, Debug)]
pub struct ElGamalCiphertext {
a: ::std::result::Result<super::GroupElement, ::std::string::String>,
b: ::std::result::Result<super::GroupElement, ::std::string::String>,
}
impl ::std::default::Default for ElGamalCiphertext {
fn default() -> Self {
Self {
a: Err("no value supplied for a".to_string()),
b: Err("no value supplied for b".to_string()),
}
}
}
impl ElGamalCiphertext {
pub fn a<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.a = value
.try_into()
.map_err(|e| format!("error converting supplied value for a: {e}"));
self
}
pub fn b<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.b = value
.try_into()
.map_err(|e| format!("error converting supplied value for b: {e}"));
self
}
}
impl ::std::convert::TryFrom<ElGamalCiphertext> for super::ElGamalCiphertext {
type Error = super::error::ConversionError;
fn try_from(
value: ElGamalCiphertext,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
a: value.a?,
b: value.b?,
})
}
}
impl ::std::convert::From<super::ElGamalCiphertext> for ElGamalCiphertext {
fn from(value: super::ElGamalCiphertext) -> Self {
Self {
a: Ok(value.a),
b: Ok(value.b),
}
}
}
#[derive(Clone, Debug)]
pub struct ElectionKey {
key: ::std::result::Result<super::GroupElement, ::std::string::String>,
qualified:
::std::result::Result<::std::vec::Vec<super::TrusteeIndex>, ::std::string::String>,
verification: ::std::result::Result<
::std::vec::Vec<super::ElectionKeyVerificationItem>,
::std::string::String,
>,
}
impl ::std::default::Default for ElectionKey {
fn default() -> Self {
Self {
key: Err("no value supplied for key".to_string()),
qualified: Err("no value supplied for qualified".to_string()),
verification: Err("no value supplied for verification".to_string()),
}
}
}
impl ElectionKey {
pub fn key<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.key = value
.try_into()
.map_err(|e| format!("error converting supplied value for key: {e}"));
self
}
pub fn qualified<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::TrusteeIndex>>,
T::Error: ::std::fmt::Display,
{
self.qualified = value
.try_into()
.map_err(|e| format!("error converting supplied value for qualified: {e}"));
self
}
pub fn verification<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ElectionKeyVerificationItem>>,
T::Error: ::std::fmt::Display,
{
self.verification = value
.try_into()
.map_err(|e| format!("error converting supplied value for verification: {e}"));
self
}
}
impl ::std::convert::TryFrom<ElectionKey> for super::ElectionKey {
type Error = super::error::ConversionError;
fn try_from(
value: ElectionKey,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
key: value.key?,
qualified: value.qualified?,
verification: value.verification?,
})
}
}
impl ::std::convert::From<super::ElectionKey> for ElectionKey {
fn from(value: super::ElectionKey) -> Self {
Self {
key: Ok(value.key),
qualified: Ok(value.qualified),
verification: Ok(value.verification),
}
}
}
#[derive(Clone, Debug)]
pub struct ElectionKeyVerificationItem {
key: ::std::result::Result<super::GroupElement, ::std::string::String>,
trustee: ::std::result::Result<super::TrusteeIndex, ::std::string::String>,
}
impl ::std::default::Default for ElectionKeyVerificationItem {
fn default() -> Self {
Self {
key: Err("no value supplied for key".to_string()),
trustee: Err("no value supplied for trustee".to_string()),
}
}
}
impl ElectionKeyVerificationItem {
pub fn key<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.key = value
.try_into()
.map_err(|e| format!("error converting supplied value for key: {e}"));
self
}
pub fn trustee<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TrusteeIndex>,
T::Error: ::std::fmt::Display,
{
self.trustee = value
.try_into()
.map_err(|e| format!("error converting supplied value for trustee: {e}"));
self
}
}
impl ::std::convert::TryFrom<ElectionKeyVerificationItem> for super::ElectionKeyVerificationItem {
type Error = super::error::ConversionError;
fn try_from(
value: ElectionKeyVerificationItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
key: value.key?,
trustee: value.trustee?,
})
}
}
impl ::std::convert::From<super::ElectionKeyVerificationItem> for ElectionKeyVerificationItem {
fn from(value: super::ElectionKeyVerificationItem) -> Self {
Self {
key: Ok(value.key),
trustee: Ok(value.trustee),
}
}
}
#[derive(Clone, Debug)]
pub struct ElectionResult {
ballots_counted: ::std::result::Result<u64, ::std::string::String>,
election_id: ::std::result::Result<super::ElectionId, ::std::string::String>,
head: ::std::result::Result<super::BoardHead, ::std::string::String>,
manifest_digest: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
questions:
::std::result::Result<::std::vec::Vec<super::QuestionResult>, ::std::string::String>,
}
impl ::std::default::Default for ElectionResult {
fn default() -> Self {
Self {
ballots_counted: Err("no value supplied for ballots_counted".to_string()),
election_id: Err("no value supplied for election_id".to_string()),
head: Err("no value supplied for head".to_string()),
manifest_digest: Err("no value supplied for manifest_digest".to_string()),
questions: Err("no value supplied for questions".to_string()),
}
}
}
impl ElectionResult {
pub fn ballots_counted<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.ballots_counted = value
.try_into()
.map_err(|e| format!("error converting supplied value for ballots_counted: {e}"));
self
}
pub fn election_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElectionId>,
T::Error: ::std::fmt::Display,
{
self.election_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for election_id: {e}"));
self
}
pub fn head<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::BoardHead>,
T::Error: ::std::fmt::Display,
{
self.head = value
.try_into()
.map_err(|e| format!("error converting supplied value for head: {e}"));
self
}
pub fn manifest_digest<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.manifest_digest = value
.try_into()
.map_err(|e| format!("error converting supplied value for manifest_digest: {e}"));
self
}
pub fn questions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::QuestionResult>>,
T::Error: ::std::fmt::Display,
{
self.questions = value
.try_into()
.map_err(|e| format!("error converting supplied value for questions: {e}"));
self
}
}
impl ::std::convert::TryFrom<ElectionResult> for super::ElectionResult {
type Error = super::error::ConversionError;
fn try_from(
value: ElectionResult,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ballots_counted: value.ballots_counted?,
election_id: value.election_id?,
head: value.head?,
manifest_digest: value.manifest_digest?,
questions: value.questions?,
})
}
}
impl ::std::convert::From<super::ElectionResult> for ElectionResult {
fn from(value: super::ElectionResult) -> Self {
Self {
ballots_counted: Ok(value.ballots_counted),
election_id: Ok(value.election_id),
head: Ok(value.head),
manifest_digest: Ok(value.manifest_digest),
questions: Ok(value.questions),
}
}
}
#[derive(Clone, Debug)]
pub struct EncryptedBallot {
election_id: ::std::result::Result<super::ElectionId, ::std::string::String>,
manifest_digest: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
questions:
::std::result::Result<::std::vec::Vec<super::EncryptedQuestion>, ::std::string::String>,
}
impl ::std::default::Default for EncryptedBallot {
fn default() -> Self {
Self {
election_id: Err("no value supplied for election_id".to_string()),
manifest_digest: Err("no value supplied for manifest_digest".to_string()),
questions: Err("no value supplied for questions".to_string()),
}
}
}
impl EncryptedBallot {
pub fn election_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElectionId>,
T::Error: ::std::fmt::Display,
{
self.election_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for election_id: {e}"));
self
}
pub fn manifest_digest<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.manifest_digest = value
.try_into()
.map_err(|e| format!("error converting supplied value for manifest_digest: {e}"));
self
}
pub fn questions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::EncryptedQuestion>>,
T::Error: ::std::fmt::Display,
{
self.questions = value
.try_into()
.map_err(|e| format!("error converting supplied value for questions: {e}"));
self
}
}
impl ::std::convert::TryFrom<EncryptedBallot> for super::EncryptedBallot {
type Error = super::error::ConversionError;
fn try_from(
value: EncryptedBallot,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
election_id: value.election_id?,
manifest_digest: value.manifest_digest?,
questions: value.questions?,
})
}
}
impl ::std::convert::From<super::EncryptedBallot> for EncryptedBallot {
fn from(value: super::EncryptedBallot) -> Self {
Self {
election_id: Ok(value.election_id),
manifest_digest: Ok(value.manifest_digest),
questions: Ok(value.questions),
}
}
}
#[derive(Clone, Debug)]
pub struct EncryptedOption {
ciphertext: ::std::result::Result<super::ElGamalCiphertext, ::std::string::String>,
proof: ::std::result::Result<super::DisjunctiveProof, ::std::string::String>,
}
impl ::std::default::Default for EncryptedOption {
fn default() -> Self {
Self {
ciphertext: Err("no value supplied for ciphertext".to_string()),
proof: Err("no value supplied for proof".to_string()),
}
}
}
impl EncryptedOption {
pub fn ciphertext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElGamalCiphertext>,
T::Error: ::std::fmt::Display,
{
self.ciphertext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ciphertext: {e}"));
self
}
pub fn proof<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DisjunctiveProof>,
T::Error: ::std::fmt::Display,
{
self.proof = value
.try_into()
.map_err(|e| format!("error converting supplied value for proof: {e}"));
self
}
}
impl ::std::convert::TryFrom<EncryptedOption> for super::EncryptedOption {
type Error = super::error::ConversionError;
fn try_from(
value: EncryptedOption,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ciphertext: value.ciphertext?,
proof: value.proof?,
})
}
}
impl ::std::convert::From<super::EncryptedOption> for EncryptedOption {
fn from(value: super::EncryptedOption) -> Self {
Self {
ciphertext: Ok(value.ciphertext),
proof: Ok(value.proof),
}
}
}
#[derive(Clone, Debug)]
pub struct EncryptedQuestion {
options:
::std::result::Result<::std::vec::Vec<super::EncryptedOption>, ::std::string::String>,
question: ::std::result::Result<super::Key, ::std::string::String>,
sum_proof: ::std::result::Result<super::DisjunctiveProof, ::std::string::String>,
}
impl ::std::default::Default for EncryptedQuestion {
fn default() -> Self {
Self {
options: Err("no value supplied for options".to_string()),
question: Err("no value supplied for question".to_string()),
sum_proof: Err("no value supplied for sum_proof".to_string()),
}
}
}
impl EncryptedQuestion {
pub fn options<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::EncryptedOption>>,
T::Error: ::std::fmt::Display,
{
self.options = value
.try_into()
.map_err(|e| format!("error converting supplied value for options: {e}"));
self
}
pub fn question<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Key>,
T::Error: ::std::fmt::Display,
{
self.question = value
.try_into()
.map_err(|e| format!("error converting supplied value for question: {e}"));
self
}
pub fn sum_proof<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DisjunctiveProof>,
T::Error: ::std::fmt::Display,
{
self.sum_proof = value
.try_into()
.map_err(|e| format!("error converting supplied value for sum_proof: {e}"));
self
}
}
impl ::std::convert::TryFrom<EncryptedQuestion> for super::EncryptedQuestion {
type Error = super::error::ConversionError;
fn try_from(
value: EncryptedQuestion,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
options: value.options?,
question: value.question?,
sum_proof: value.sum_proof?,
})
}
}
impl ::std::convert::From<super::EncryptedQuestion> for EncryptedQuestion {
fn from(value: super::EncryptedQuestion) -> Self {
Self {
options: Ok(value.options),
question: Ok(value.question),
sum_proof: Ok(value.sum_proof),
}
}
}
#[derive(Clone, Debug)]
pub struct PartialDecryption {
d: ::std::result::Result<super::GroupElement, ::std::string::String>,
proof: ::std::result::Result<super::SigmaProof, ::std::string::String>,
target: ::std::result::Result<super::DecryptionTarget, ::std::string::String>,
}
impl ::std::default::Default for PartialDecryption {
fn default() -> Self {
Self {
d: Err("no value supplied for d".to_string()),
proof: Err("no value supplied for proof".to_string()),
target: Err("no value supplied for target".to_string()),
}
}
}
impl PartialDecryption {
pub fn d<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.d = value
.try_into()
.map_err(|e| format!("error converting supplied value for d: {e}"));
self
}
pub fn proof<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::SigmaProof>,
T::Error: ::std::fmt::Display,
{
self.proof = value
.try_into()
.map_err(|e| format!("error converting supplied value for proof: {e}"));
self
}
pub fn target<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DecryptionTarget>,
T::Error: ::std::fmt::Display,
{
self.target = value
.try_into()
.map_err(|e| format!("error converting supplied value for target: {e}"));
self
}
}
impl ::std::convert::TryFrom<PartialDecryption> for super::PartialDecryption {
type Error = super::error::ConversionError;
fn try_from(
value: PartialDecryption,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
d: value.d?,
proof: value.proof?,
target: value.target?,
})
}
}
impl ::std::convert::From<super::PartialDecryption> for PartialDecryption {
fn from(value: super::PartialDecryption) -> Self {
Self {
d: Ok(value.d),
proof: Ok(value.proof),
target: Ok(value.target),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
community: ::std::result::Result<super::PayloadCommunity, ::std::string::String>,
election_id: ::std::result::Result<super::ElectionId, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
from: ::std::result::Result<u64, ::std::string::String>,
limit: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
tree_size: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
community: Err("no value supplied for community".to_string()),
election_id: Err("no value supplied for election_id".to_string()),
ext: Ok(Default::default()),
from: Err("no value supplied for from".to_string()),
limit: Err("no value supplied for limit".to_string()),
tree_size: Ok(Default::default()),
}
}
}
impl Payload {
pub fn community<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadCommunity>,
T::Error: ::std::fmt::Display,
{
self.community = value
.try_into()
.map_err(|e| format!("error converting supplied value for community: {e}"));
self
}
pub fn election_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElectionId>,
T::Error: ::std::fmt::Display,
{
self.election_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for election_id: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn from<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.from = value
.try_into()
.map_err(|e| format!("error converting supplied value for from: {e}"));
self
}
pub fn limit<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.limit = value
.try_into()
.map_err(|e| format!("error converting supplied value for limit: {e}"));
self
}
pub fn tree_size<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.tree_size = value
.try_into()
.map_err(|e| format!("error converting supplied value for tree_size: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
community: value.community?,
election_id: value.election_id?,
ext: value.ext?,
from: value.from?,
limit: value.limit?,
tree_size: value.tree_size?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
community: Ok(value.community),
election_id: Ok(value.election_id),
ext: Ok(value.ext),
from: Ok(value.from),
limit: Ok(value.limit),
tree_size: Ok(value.tree_size),
}
}
}
#[derive(Clone, Debug)]
pub struct QuestionResult {
abstained: ::std::result::Result<u64, ::std::string::String>,
choice: ::std::result::Result<
::std::collections::HashMap<super::Key, u64>,
::std::string::String,
>,
question: ::std::result::Result<super::Key, ::std::string::String>,
ranking: ::std::result::Result<
::std::collections::HashMap<super::Key, ::std::vec::Vec<u64>>,
::std::string::String,
>,
score: ::std::result::Result<
::std::collections::HashMap<super::Key, super::QuestionResultScoreValue>,
::std::string::String,
>,
text: ::std::result::Result<
::std::vec::Vec<super::QuestionResultTextItem>,
::std::string::String,
>,
withheld: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
}
impl ::std::default::Default for QuestionResult {
fn default() -> Self {
Self {
abstained: Err("no value supplied for abstained".to_string()),
choice: Ok(Default::default()),
question: Err("no value supplied for question".to_string()),
ranking: Ok(Default::default()),
score: Ok(Default::default()),
text: Ok(Default::default()),
withheld: Ok(Default::default()),
}
}
}
impl QuestionResult {
pub fn abstained<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.abstained = value
.try_into()
.map_err(|e| format!("error converting supplied value for abstained: {e}"));
self
}
pub fn choice<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::collections::HashMap<super::Key, u64>>,
T::Error: ::std::fmt::Display,
{
self.choice = value
.try_into()
.map_err(|e| format!("error converting supplied value for choice: {e}"));
self
}
pub fn question<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Key>,
T::Error: ::std::fmt::Display,
{
self.question = value
.try_into()
.map_err(|e| format!("error converting supplied value for question: {e}"));
self
}
pub fn ranking<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::collections::HashMap<super::Key, ::std::vec::Vec<u64>>,
>,
T::Error: ::std::fmt::Display,
{
self.ranking = value
.try_into()
.map_err(|e| format!("error converting supplied value for ranking: {e}"));
self
}
pub fn score<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::collections::HashMap<super::Key, super::QuestionResultScoreValue>,
>,
T::Error: ::std::fmt::Display,
{
self.score = value
.try_into()
.map_err(|e| format!("error converting supplied value for score: {e}"));
self
}
pub fn text<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::QuestionResultTextItem>>,
T::Error: ::std::fmt::Display,
{
self.text = value
.try_into()
.map_err(|e| format!("error converting supplied value for text: {e}"));
self
}
pub fn withheld<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.withheld = value
.try_into()
.map_err(|e| format!("error converting supplied value for withheld: {e}"));
self
}
}
impl ::std::convert::TryFrom<QuestionResult> for super::QuestionResult {
type Error = super::error::ConversionError;
fn try_from(
value: QuestionResult,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
abstained: value.abstained?,
choice: value.choice?,
question: value.question?,
ranking: value.ranking?,
score: value.score?,
text: value.text?,
withheld: value.withheld?,
})
}
}
impl ::std::convert::From<super::QuestionResult> for QuestionResult {
fn from(value: super::QuestionResult) -> Self {
Self {
abstained: Ok(value.abstained),
choice: Ok(value.choice),
question: Ok(value.question),
ranking: Ok(value.ranking),
score: Ok(value.score),
text: Ok(value.text),
withheld: Ok(value.withheld),
}
}
}
#[derive(Clone, Debug)]
pub struct QuestionResultScoreValue {
count: ::std::result::Result<u64, ::std::string::String>,
sum: ::std::result::Result<i64, ::std::string::String>,
}
impl ::std::default::Default for QuestionResultScoreValue {
fn default() -> Self {
Self {
count: Err("no value supplied for count".to_string()),
sum: Err("no value supplied for sum".to_string()),
}
}
}
impl QuestionResultScoreValue {
pub fn count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.count = value
.try_into()
.map_err(|e| format!("error converting supplied value for count: {e}"));
self
}
pub fn sum<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<i64>,
T::Error: ::std::fmt::Display,
{
self.sum = value
.try_into()
.map_err(|e| format!("error converting supplied value for sum: {e}"));
self
}
}
impl ::std::convert::TryFrom<QuestionResultScoreValue> for super::QuestionResultScoreValue {
type Error = super::error::ConversionError;
fn try_from(
value: QuestionResultScoreValue,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
count: value.count?,
sum: value.sum?,
})
}
}
impl ::std::convert::From<super::QuestionResultScoreValue> for QuestionResultScoreValue {
fn from(value: super::QuestionResultScoreValue) -> Self {
Self {
count: Ok(value.count),
sum: Ok(value.sum),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
entries: ::std::result::Result<
::std::vec::Vec<super::ResponseEntriesItem>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
next: ::std::result::Result<
::std::option::Option<::std::num::NonZeroU64>,
::std::string::String,
>,
tree_size: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
entries: Err("no value supplied for entries".to_string()),
ext: Ok(Default::default()),
next: Ok(Default::default()),
tree_size: Err("no value supplied for tree_size".to_string()),
}
}
}
impl Response {
pub fn entries<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseEntriesItem>>,
T::Error: ::std::fmt::Display,
{
self.entries = value
.try_into()
.map_err(|e| format!("error converting supplied value for entries: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn next<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
T::Error: ::std::fmt::Display,
{
self.next = value
.try_into()
.map_err(|e| format!("error converting supplied value for next: {e}"));
self
}
pub fn tree_size<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.tree_size = value
.try_into()
.map_err(|e| format!("error converting supplied value for tree_size: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
entries: value.entries?,
ext: value.ext?,
next: value.next?,
tree_size: value.tree_size?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
entries: Ok(value.entries),
ext: Ok(value.ext),
next: Ok(value.next),
tree_size: Ok(value.tree_size),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseEntriesItem {
entry: ::std::result::Result<super::BoardEntry, ::std::string::String>,
index: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for ResponseEntriesItem {
fn default() -> Self {
Self {
entry: Err("no value supplied for entry".to_string()),
index: Err("no value supplied for index".to_string()),
}
}
}
impl ResponseEntriesItem {
pub fn entry<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::BoardEntry>,
T::Error: ::std::fmt::Display,
{
self.entry = value
.try_into()
.map_err(|e| format!("error converting supplied value for entry: {e}"));
self
}
pub fn index<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.index = value
.try_into()
.map_err(|e| format!("error converting supplied value for index: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseEntriesItem> for super::ResponseEntriesItem {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseEntriesItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
entry: value.entry?,
index: value.index?,
})
}
}
impl ::std::convert::From<super::ResponseEntriesItem> for ResponseEntriesItem {
fn from(value: super::ResponseEntriesItem) -> Self {
Self {
entry: Ok(value.entry),
index: Ok(value.index),
}
}
}
#[derive(Clone, Debug)]
pub struct SealedPayload {
body: ::std::result::Result<super::SealedPayloadBody, ::std::string::String>,
kem: ::std::result::Result<super::ElGamalCiphertext, ::std::string::String>,
}
impl ::std::default::Default for SealedPayload {
fn default() -> Self {
Self {
body: Err("no value supplied for body".to_string()),
kem: Err("no value supplied for kem".to_string()),
}
}
}
impl SealedPayload {
pub fn body<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::SealedPayloadBody>,
T::Error: ::std::fmt::Display,
{
self.body = value
.try_into()
.map_err(|e| format!("error converting supplied value for body: {e}"));
self
}
pub fn kem<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ElGamalCiphertext>,
T::Error: ::std::fmt::Display,
{
self.kem = value
.try_into()
.map_err(|e| format!("error converting supplied value for kem: {e}"));
self
}
}
impl ::std::convert::TryFrom<SealedPayload> for super::SealedPayload {
type Error = super::error::ConversionError;
fn try_from(
value: SealedPayload,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
body: value.body?,
kem: value.kem?,
})
}
}
impl ::std::convert::From<super::SealedPayload> for SealedPayload {
fn from(value: super::SealedPayload) -> Self {
Self {
body: Ok(value.body),
kem: Ok(value.kem),
}
}
}
#[derive(Clone, Debug)]
pub struct SealedShare {
recipient: ::std::result::Result<super::TrusteeIndex, ::std::string::String>,
share: ::std::result::Result<super::SealedPayload, ::std::string::String>,
}
impl ::std::default::Default for SealedShare {
fn default() -> Self {
Self {
recipient: Err("no value supplied for recipient".to_string()),
share: Err("no value supplied for share".to_string()),
}
}
}
impl SealedShare {
pub fn recipient<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TrusteeIndex>,
T::Error: ::std::fmt::Display,
{
self.recipient = value
.try_into()
.map_err(|e| format!("error converting supplied value for recipient: {e}"));
self
}
pub fn share<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::SealedPayload>,
T::Error: ::std::fmt::Display,
{
self.share = value
.try_into()
.map_err(|e| format!("error converting supplied value for share: {e}"));
self
}
}
impl ::std::convert::TryFrom<SealedShare> for super::SealedShare {
type Error = super::error::ConversionError;
fn try_from(
value: SealedShare,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
recipient: value.recipient?,
share: value.share?,
})
}
}
impl ::std::convert::From<super::SealedShare> for SealedShare {
fn from(value: super::SealedShare) -> Self {
Self {
recipient: Ok(value.recipient),
share: Ok(value.share),
}
}
}
#[derive(Clone, Debug)]
pub struct SigmaProof {
c: ::std::result::Result<super::GroupScalar, ::std::string::String>,
z: ::std::result::Result<super::GroupScalar, ::std::string::String>,
}
impl ::std::default::Default for SigmaProof {
fn default() -> Self {
Self {
c: Err("no value supplied for c".to_string()),
z: Err("no value supplied for z".to_string()),
}
}
}
impl SigmaProof {
pub fn c<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupScalar>,
T::Error: ::std::fmt::Display,
{
self.c = value
.try_into()
.map_err(|e| format!("error converting supplied value for c: {e}"));
self
}
pub fn z<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupScalar>,
T::Error: ::std::fmt::Display,
{
self.z = value
.try_into()
.map_err(|e| format!("error converting supplied value for z: {e}"));
self
}
}
impl ::std::convert::TryFrom<SigmaProof> for super::SigmaProof {
type Error = super::error::ConversionError;
fn try_from(
value: SigmaProof,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
c: value.c?,
z: value.z?,
})
}
}
impl ::std::convert::From<super::SigmaProof> for SigmaProof {
fn from(value: super::SigmaProof) -> Self {
Self {
c: Ok(value.c),
z: Ok(value.z),
}
}
}
#[derive(Clone, Debug)]
pub struct TransportKey {
key: ::std::result::Result<super::GroupElement, ::std::string::String>,
pok: ::std::result::Result<super::SigmaProof, ::std::string::String>,
trustee: ::std::result::Result<super::TrusteeIndex, ::std::string::String>,
}
impl ::std::default::Default for TransportKey {
fn default() -> Self {
Self {
key: Err("no value supplied for key".to_string()),
pok: Err("no value supplied for pok".to_string()),
trustee: Err("no value supplied for trustee".to_string()),
}
}
}
impl TransportKey {
pub fn key<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::GroupElement>,
T::Error: ::std::fmt::Display,
{
self.key = value
.try_into()
.map_err(|e| format!("error converting supplied value for key: {e}"));
self
}
pub fn pok<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::SigmaProof>,
T::Error: ::std::fmt::Display,
{
self.pok = value
.try_into()
.map_err(|e| format!("error converting supplied value for pok: {e}"));
self
}
pub fn trustee<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TrusteeIndex>,
T::Error: ::std::fmt::Display,
{
self.trustee = value
.try_into()
.map_err(|e| format!("error converting supplied value for trustee: {e}"));
self
}
}
impl ::std::convert::TryFrom<TransportKey> for super::TransportKey {
type Error = super::error::ConversionError;
fn try_from(
value: TransportKey,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
key: value.key?,
pok: value.pok?,
trustee: value.trustee?,
})
}
}
impl ::std::convert::From<super::TransportKey> for TransportKey {
fn from(value: super::TransportKey) -> Self {
Self {
key: Ok(value.key),
pok: Ok(value.pok),
trustee: Ok(value.trustee),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/voting/board/read/0.2";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"Answer\":{\"additionalProperties\":false,\"description\":\"The answer to one question. Exactly one member besides `question` is present, matching the question's type, or `abstain` for an optional question left unanswered.\",\"maxProperties\":2,\"minProperties\":2,\"properties\":{\"abstain\":{\"const\":true},\"choice\":{\"items\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"array\",\"uniqueItems\":true},\"question\":{\"$ref\":\"#/$defs/Key\"},\"ranking\":{\"items\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"array\",\"uniqueItems\":true},\"scores\":{\"additionalProperties\":{\"type\":\"integer\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"text\":{\"maxLength\":4096,\"type\":\"string\"}},\"required\":[\"question\"],\"title\":\"Answer\",\"type\":\"object\"},\"Ballot\":{\"additionalProperties\":false,\"description\":\"An open ballot: one answer per question of the manifest, in any order. The bytes a cast's proof binds are the RFC 8785 (JCS) canonicalization of this object as received.\",\"properties\":{\"answers\":{\"items\":{\"$ref\":\"#/$defs/Answer\"},\"maxItems\":128,\"minItems\":1,\"type\":\"array\"},\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"}},\"required\":[\"electionId\",\"manifestDigest\",\"answers\"],\"title\":\"Ballot\",\"type\":\"object\"},\"BoardEntry\":{\"description\":\"One leaf of a board. A leaf's hash is the RFC 9162 leaf hash of the JCS canonicalization of this object. Entries carry no time of arrival: the order is the board's, and a timestamp would hand anyone who reads the board the timing the registrar's log would need to pair a ticket with its cast.\",\"oneOf\":[{\"additionalProperties\":false,\"properties\":{\"cast\":{\"$ref\":\"#/$defs/Cast\"},\"kind\":{\"const\":\"cast\"}},\"required\":[\"kind\",\"cast\"],\"title\":\"CastEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"The cast at `replaces` is no longer counted: a later cast under the same tag is.\",\"properties\":{\"by\":{\"minimum\":0,\"type\":\"integer\"},\"kind\":{\"const\":\"replaced\"},\"replaces\":{\"minimum\":0,\"type\":\"integer\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"kind\",\"tag\",\"replaces\",\"by\"],\"title\":\"ReplacementEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"enum\":[\"opened\",\"closed\",\"closedEarly\",\"cancelled\"]},\"occurredAt\":{\"format\":\"date-time\",\"type\":\"string\"}},\"required\":[\"kind\",\"occurredAt\"],\"title\":\"LifecycleEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"const\":\"result\"},\"result\":{\"$ref\":\"#/$defs/ElectionResult\"}},\"required\":[\"kind\",\"result\"],\"title\":\"ResultEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"cast\":{\"$ref\":\"#/$defs/EncryptedCast\"},\"kind\":{\"const\":\"encryptedCast\"}},\"required\":[\"kind\",\"cast\"],\"title\":\"EncryptedCastEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"kind\":{\"const\":\"transportKey\"},\"transportKey\":{\"$ref\":\"#/$defs/TransportKey\"}},\"required\":[\"kind\",\"transportKey\"],\"title\":\"TransportKeyEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"dealing\":{\"$ref\":\"#/$defs/Dealing\"},\"kind\":{\"const\":\"dealing\"}},\"required\":[\"kind\",\"dealing\"],\"title\":\"DealingEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"complaints\":{\"items\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"maxItems\":64,\"type\":\"array\"},\"kind\":{\"const\":\"confirmation\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"kind\",\"trustee\",\"complaints\"],\"title\":\"ConfirmationEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"dealer\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"kind\":{\"const\":\"justification\"},\"recipient\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"share\":{\"$ref\":\"#/$defs/GroupScalar\"}},\"required\":[\"kind\",\"dealer\",\"recipient\",\"share\"],\"title\":\"JustificationEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"electionKey\":{\"$ref\":\"#/$defs/ElectionKey\"},\"kind\":{\"const\":\"electionKey\"}},\"required\":[\"kind\",\"electionKey\"],\"title\":\"ElectionKeyEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"const\":\"partials\"},\"partials\":{\"items\":{\"$ref\":\"#/$defs/PartialDecryption\"},\"maxItems\":100000,\"minItems\":1,\"type\":\"array\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"kind\",\"trustee\",\"partials\"],\"title\":\"PartialDecryptionsEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"ballot\":{\"$ref\":\"#/$defs/Ballot\"},\"kind\":{\"const\":\"unsealed\"},\"leafIndex\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"kind\",\"leafIndex\",\"ballot\"],\"title\":\"UnsealedEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"A sealed cast that did not open, or opened to no valid ballot: not counted (CONVENTIONS §9.7).\",\"properties\":{\"kind\":{\"const\":\"spoiled\"},\"leafIndex\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"kind\",\"leafIndex\"],\"title\":\"SpoiledEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"One step of the trustees' ceremony — an enrolment, a dealing, a confirmation or a justification — as the trustee's own signed request, so that anyone reading the board can tell who took it (CONVENTIONS §9.6).\",\"properties\":{\"kind\":{\"const\":\"trusteeStep\"},\"request\":{\"$ref\":\"#/$defs/SignedRequest\"}},\"required\":[\"kind\",\"request\"],\"title\":\"TrusteeStepEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"The community's voting/trustees/authorize request, exactly as the ballot box received it: the decryption targets of a closed election, pinned by digest to a head of the board (CONVENTIONS §9.7).\",\"properties\":{\"kind\":{\"const\":\"decryptionAuthorized\"},\"request\":{\"$ref\":\"#/$defs/SignedRequest\"}},\"required\":[\"kind\",\"request\"],\"title\":\"DecryptionAuthorizedEntry\",\"type\":\"object\"}],\"title\":\"BoardEntry\"},\"BoardHead\":{\"additionalProperties\":false,\"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.\",\"properties\":{\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"issuedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"rootHash\":{\"$ref\":\"#/$defs/DigestMultibase\",\"description\":\"The RFC 9162 Merkle tree hash (SHA-256) of the first `treeSize` entries, as a multihash.\"},\"treeSize\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"electionId\",\"treeSize\",\"rootHash\",\"issuedAt\"],\"title\":\"BoardHead\",\"type\":\"object\"},\"Cast\":{\"additionalProperties\":false,\"description\":\"A ballot and the PCS attestation that admits it (VTI-VOT-030). `attestation` is the suite's canonical encoding of the attestation made for the election point with the ballot context bound in (CONVENTIONS §3); `tag` repeats its tag so a ballot box can refuse a duplicate before the pairing check.\",\"properties\":{\"attestation\":{\"$ref\":\"#/$defs/Multibase\"},\"ballot\":{\"$ref\":\"#/$defs/Ballot\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"ballot\",\"tag\",\"attestation\"],\"title\":\"Cast\",\"type\":\"object\"},\"Dealing\":{\"additionalProperties\":false,\"description\":\"A trustee's contribution to the election key: Feldman commitments to its polynomial, a proof of knowledge of the constant term, and one share per trustee sealed to that trustee's transport key (CONVENTIONS §9.6).\",\"properties\":{\"commitments\":{\"items\":{\"$ref\":\"#/$defs/GroupElement\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"},\"dealer\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"pok\":{\"$ref\":\"#/$defs/SigmaProof\"},\"shares\":{\"items\":{\"$ref\":\"#/$defs/SealedShare\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"}},\"required\":[\"dealer\",\"commitments\",\"pok\",\"shares\"],\"title\":\"Dealing\",\"type\":\"object\"},\"DecryptionTarget\":{\"additionalProperties\":false,\"description\":\"What a partial decryption decrypts: the sealed cast at a board leaf, or the total of one option of one question.\",\"oneOf\":[{\"required\":[\"leafIndex\"]},{\"required\":[\"question\",\"option\"]}],\"properties\":{\"ciphertext\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"},\"leafIndex\":{\"description\":\"A sealed cast's board leaf.\",\"minimum\":0,\"type\":\"integer\"},\"option\":{\"$ref\":\"#/$defs/Key\"},\"question\":{\"$ref\":\"#/$defs/Key\"}},\"required\":[\"ciphertext\"],\"title\":\"DecryptionTarget\",\"type\":\"object\"},\"DigestMultibase\":{\"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`.\",\"examples\":[\"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"],\"minLength\":16,\"pattern\":\"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\"title\":\"DigestMultibase\",\"type\":\"string\"},\"DisjunctiveProof\":{\"description\":\"A disjunctive proof that a ciphertext encrypts one value of a public list: one `(c, z)` per value, in the list's order (CONVENTIONS §9.3).\",\"items\":{\"$ref\":\"#/$defs/SigmaProof\"},\"maxItems\":65,\"minItems\":1,\"title\":\"DisjunctiveProof\",\"type\":\"array\"},\"ElGamalCiphertext\":{\"additionalProperties\":false,\"description\":\"`(a, b) = (r·G, M + r·Y)` under the election key `Y` (CONVENTIONS §9.2).\",\"properties\":{\"a\":{\"$ref\":\"#/$defs/GroupElement\"},\"b\":{\"$ref\":\"#/$defs/GroupElement\"}},\"required\":[\"a\",\"b\"],\"title\":\"ElGamalCiphertext\",\"type\":\"object\"},\"ElectionId\":{\"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.\",\"pattern\":\"^[A-Za-z0-9._-]{1,128}$\",\"title\":\"ElectionId\",\"type\":\"string\"},\"ElectionKey\":{\"additionalProperties\":false,\"description\":\"The election key and each trustee's public verification key, computed from the qualified dealings (CONVENTIONS §9.6). Anyone can recompute it from the board.\",\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"qualified\":{\"description\":\"The dealers whose dealings the key is formed from.\",\"items\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"verification\":{\"items\":{\"additionalProperties\":false,\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"trustee\",\"key\"],\"type\":\"object\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"}},\"required\":[\"key\",\"qualified\",\"verification\"],\"title\":\"ElectionKey\",\"type\":\"object\"},\"ElectionResult\":{\"additionalProperties\":false,\"description\":\"An election's result, computable by anyone who can read its board from the board and the registration alone (VTI-VOT-070).\",\"properties\":{\"ballotsCounted\":{\"minimum\":0,\"type\":\"integer\"},\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"head\":{\"$ref\":\"#/$defs/BoardHead\",\"description\":\"The head of the board as it stood at close: the result counts exactly its entries.\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"},\"questions\":{\"items\":{\"$ref\":\"#/$defs/QuestionResult\"},\"type\":\"array\"}},\"required\":[\"electionId\",\"manifestDigest\",\"ballotsCounted\",\"questions\",\"head\"],\"title\":\"ElectionResult\",\"type\":\"object\"},\"EncryptedBallot\":{\"additionalProperties\":false,\"description\":\"A tallied-encrypted ballot: one EncryptedQuestion per manifest question, in the manifest's order. Never decrypted (VTI-VOT-064).\",\"properties\":{\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"},\"questions\":{\"items\":{\"$ref\":\"#/$defs/EncryptedQuestion\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"}},\"required\":[\"electionId\",\"manifestDigest\",\"questions\"],\"title\":\"EncryptedBallot\",\"type\":\"object\"},\"EncryptedCast\":{\"additionalProperties\":false,\"description\":\"A cast of a sealed or tallied-encrypted election: exactly one of `sealed` (the Ballot's JCS bytes sealed to the election key) or `encrypted`, with the tag and the attestation over the JCS bytes of whichever is present (CONVENTIONS §3.6, §9.5).\",\"oneOf\":[{\"required\":[\"sealed\"]},{\"required\":[\"encrypted\"]}],\"properties\":{\"attestation\":{\"$ref\":\"#/$defs/Multibase\"},\"encrypted\":{\"$ref\":\"#/$defs/EncryptedBallot\"},\"sealed\":{\"$ref\":\"#/$defs/SealedPayload\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"tag\",\"attestation\"],\"title\":\"EncryptedCast\",\"type\":\"object\"},\"EncryptedOption\":{\"additionalProperties\":false,\"properties\":{\"ciphertext\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"},\"proof\":{\"$ref\":\"#/$defs/DisjunctiveProof\"}},\"required\":[\"ciphertext\",\"proof\"],\"title\":\"EncryptedOption\",\"type\":\"object\"},\"EncryptedQuestion\":{\"additionalProperties\":false,\"description\":\"One choice question of a tallied-encrypted ballot: per option, in the manifest's order, an encryption of 0 or 1 with its proof; and a proof that the selections sum to a count the question admits (CONVENTIONS §9.5).\",\"properties\":{\"options\":{\"items\":{\"$ref\":\"#/$defs/EncryptedOption\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"question\":{\"$ref\":\"#/$defs/Key\"},\"sumProof\":{\"$ref\":\"#/$defs/DisjunctiveProof\"}},\"required\":[\"question\",\"options\",\"sumProof\"],\"title\":\"EncryptedQuestion\",\"type\":\"object\"},\"Ext\":{\"additionalProperties\":true,\"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.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"GroupElement\":{\"description\":\"A Ristretto group element: its 32-byte compression, multibase base58btc. Never the identity (CONVENTIONS §9.1).\",\"maxLength\":64,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"GroupElement\",\"type\":\"string\"},\"GroupScalar\":{\"description\":\"A scalar mod the Ristretto group order: 32 canonical little-endian bytes, multibase base58btc (CONVENTIONS §9.1).\",\"maxLength\":64,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"GroupScalar\",\"type\":\"string\"},\"Key\":{\"description\":\"A question or option key, unique within its manifest or question.\",\"pattern\":\"^[A-Za-z0-9._-]{1,64}$\",\"title\":\"Key\",\"type\":\"string\"},\"Multibase\":{\"description\":\"A binary value, multibase base58btc over the suite's canonical (compressed) encoding.\",\"maxLength\":16384,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"Multibase\",\"type\":\"string\"},\"PartialDecryption\":{\"additionalProperties\":false,\"description\":\"Trustee `trustee`'s share of one decryption, `d = x_j·a`, with a Chaum–Pedersen proof against its verification key (CONVENTIONS §9.7).\",\"properties\":{\"d\":{\"$ref\":\"#/$defs/GroupElement\"},\"proof\":{\"$ref\":\"#/$defs/SigmaProof\"},\"target\":{\"$ref\":\"#/$defs/DecryptionTarget\"}},\"required\":[\"target\",\"d\",\"proof\"],\"title\":\"PartialDecryption\",\"type\":\"object\"},\"QuestionResult\":{\"additionalProperties\":false,\"description\":\"One question's totals. `choice`: selections per option. `ranking`: per option, how many ballots placed it at each position (index 0 = first). `score`: per option, the sum and the number of ballots that scored it. `text`: the answers, in board order, withheld (`withheld: true`) below the manifest's `textReleaseThreshold`. `abstained` counts ballots that left the question unanswered.\",\"properties\":{\"abstained\":{\"minimum\":0,\"type\":\"integer\"},\"choice\":{\"additionalProperties\":{\"minimum\":0,\"type\":\"integer\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"question\":{\"$ref\":\"#/$defs/Key\"},\"ranking\":{\"additionalProperties\":{\"items\":{\"minimum\":0,\"type\":\"integer\"},\"type\":\"array\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"score\":{\"additionalProperties\":{\"additionalProperties\":false,\"properties\":{\"count\":{\"minimum\":0,\"type\":\"integer\"},\"sum\":{\"type\":\"integer\"}},\"required\":[\"sum\",\"count\"],\"type\":\"object\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"text\":{\"items\":{\"maxLength\":4096,\"type\":\"string\"},\"type\":\"array\"},\"withheld\":{\"type\":\"boolean\"}},\"required\":[\"question\",\"abstained\"],\"title\":\"QuestionResult\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"entries\":{\"description\":\"Consecutive entries from `from`, in board order.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"entry\":{\"$ref\":\"#/$defs/BoardEntry\"},\"index\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"index\",\"entry\"],\"type\":\"object\"},\"maxItems\":1000,\"type\":\"array\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"next\":{\"description\":\"The `from` of the next page. Absent when the page reaches `treeSize`.\",\"minimum\":1,\"type\":\"integer\"},\"treeSize\":{\"description\":\"The tree size the page was read against. No entry at or beyond it is returned.\",\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"treeSize\",\"entries\"],\"title\":\"Voting — Board Read — response payload\",\"type\":\"object\"},\"SealedPayload\":{\"additionalProperties\":false,\"description\":\"Bytes sealed to a key: a random group element encrypted as `kem`, and the bytes under ChaCha20-Poly1305 with a key derived from it, multibase base58btc (CONVENTIONS §9.4).\",\"properties\":{\"body\":{\"maxLength\":131072,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"type\":\"string\"},\"kem\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"}},\"required\":[\"kem\",\"body\"],\"title\":\"SealedPayload\",\"type\":\"object\"},\"SealedShare\":{\"additionalProperties\":false,\"properties\":{\"recipient\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"share\":{\"$ref\":\"#/$defs/SealedPayload\"}},\"required\":[\"recipient\",\"share\"],\"title\":\"SealedShare\",\"type\":\"object\"},\"SigmaProof\":{\"additionalProperties\":false,\"description\":\"A non-interactive sigma proof as its challenge and response `(c, z)` (Schnorr or Chaum–Pedersen; CONVENTIONS §9.3).\",\"properties\":{\"c\":{\"$ref\":\"#/$defs/GroupScalar\"},\"z\":{\"$ref\":\"#/$defs/GroupScalar\"}},\"required\":[\"c\",\"z\"],\"title\":\"SigmaProof\",\"type\":\"object\"},\"SignedRequest\":{\"description\":\"A whole Trust Task request document — `id`, `type`, `issuer`, `payload` and every other member, `proof` included — exactly as the ballot box received it, never re-serialised: its proof is taken over its members, and a re-serialised copy does not reliably reproduce them. Typed as an open object so every member survives; CONVENTIONS §9.6 gives the checks that make it a trustee's step.\",\"minProperties\":1,\"title\":\"SignedRequest\",\"type\":\"object\"},\"TransportKey\":{\"additionalProperties\":false,\"description\":\"The group element a trustee's shares are sealed to, with a Schnorr proof of knowledge of its discrete log (CONVENTIONS §9.6).\",\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"pok\":{\"$ref\":\"#/$defs/SigmaProof\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"trustee\",\"key\",\"pok\"],\"title\":\"TransportKey\",\"type\":\"object\"},\"TrusteeIndex\":{\"description\":\"A trustee's index: its position in the manifest's `trustees.dids`, counting from 1.\",\"maximum\":64,\"minimum\":1,\"title\":\"TrusteeIndex\",\"type\":\"integer\"}},\"$id\":\"https://trusttasks.org/spec/voting/board/read/0.2\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"description\":\"Reads a range of an election board's entries, against the current head or against an earlier tree size.\",\"properties\":{\"community\":{\"description\":\"The community's DID.\",\"maxLength\":2048,\"minLength\":1,\"type\":\"string\"},\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"from\":{\"description\":\"The index of the first entry to return.\",\"minimum\":0,\"type\":\"integer\"},\"limit\":{\"description\":\"The most entries to return.\",\"maximum\":1000,\"minimum\":1,\"type\":\"integer\"},\"treeSize\":{\"description\":\"Read against the board as it stood at this size — the size of a head the reader holds. At most the current size. Absent: the current size.\",\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"community\",\"electionId\",\"from\",\"limit\"],\"title\":\"Voting — Board Read — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/voting/board/read/0.2#response";
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"Answer\":{\"additionalProperties\":false,\"description\":\"The answer to one question. Exactly one member besides `question` is present, matching the question's type, or `abstain` for an optional question left unanswered.\",\"maxProperties\":2,\"minProperties\":2,\"properties\":{\"abstain\":{\"const\":true},\"choice\":{\"items\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"array\",\"uniqueItems\":true},\"question\":{\"$ref\":\"#/$defs/Key\"},\"ranking\":{\"items\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"array\",\"uniqueItems\":true},\"scores\":{\"additionalProperties\":{\"type\":\"integer\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"text\":{\"maxLength\":4096,\"type\":\"string\"}},\"required\":[\"question\"],\"title\":\"Answer\",\"type\":\"object\"},\"Ballot\":{\"additionalProperties\":false,\"description\":\"An open ballot: one answer per question of the manifest, in any order. The bytes a cast's proof binds are the RFC 8785 (JCS) canonicalization of this object as received.\",\"properties\":{\"answers\":{\"items\":{\"$ref\":\"#/$defs/Answer\"},\"maxItems\":128,\"minItems\":1,\"type\":\"array\"},\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"}},\"required\":[\"electionId\",\"manifestDigest\",\"answers\"],\"title\":\"Ballot\",\"type\":\"object\"},\"BoardEntry\":{\"description\":\"One leaf of a board. A leaf's hash is the RFC 9162 leaf hash of the JCS canonicalization of this object. Entries carry no time of arrival: the order is the board's, and a timestamp would hand anyone who reads the board the timing the registrar's log would need to pair a ticket with its cast.\",\"oneOf\":[{\"additionalProperties\":false,\"properties\":{\"cast\":{\"$ref\":\"#/$defs/Cast\"},\"kind\":{\"const\":\"cast\"}},\"required\":[\"kind\",\"cast\"],\"title\":\"CastEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"The cast at `replaces` is no longer counted: a later cast under the same tag is.\",\"properties\":{\"by\":{\"minimum\":0,\"type\":\"integer\"},\"kind\":{\"const\":\"replaced\"},\"replaces\":{\"minimum\":0,\"type\":\"integer\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"kind\",\"tag\",\"replaces\",\"by\"],\"title\":\"ReplacementEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"enum\":[\"opened\",\"closed\",\"closedEarly\",\"cancelled\"]},\"occurredAt\":{\"format\":\"date-time\",\"type\":\"string\"}},\"required\":[\"kind\",\"occurredAt\"],\"title\":\"LifecycleEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"const\":\"result\"},\"result\":{\"$ref\":\"#/$defs/ElectionResult\"}},\"required\":[\"kind\",\"result\"],\"title\":\"ResultEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"cast\":{\"$ref\":\"#/$defs/EncryptedCast\"},\"kind\":{\"const\":\"encryptedCast\"}},\"required\":[\"kind\",\"cast\"],\"title\":\"EncryptedCastEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"kind\":{\"const\":\"transportKey\"},\"transportKey\":{\"$ref\":\"#/$defs/TransportKey\"}},\"required\":[\"kind\",\"transportKey\"],\"title\":\"TransportKeyEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"dealing\":{\"$ref\":\"#/$defs/Dealing\"},\"kind\":{\"const\":\"dealing\"}},\"required\":[\"kind\",\"dealing\"],\"title\":\"DealingEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"complaints\":{\"items\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"maxItems\":64,\"type\":\"array\"},\"kind\":{\"const\":\"confirmation\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"kind\",\"trustee\",\"complaints\"],\"title\":\"ConfirmationEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"Not appended: each enrolment, dealing, confirmation and justification is a `trusteeStep` entry carrying the trustee's signed request (CONVENTIONS §9.6). A consumer MUST refuse a board holding this kind.\",\"properties\":{\"dealer\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"kind\":{\"const\":\"justification\"},\"recipient\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"share\":{\"$ref\":\"#/$defs/GroupScalar\"}},\"required\":[\"kind\",\"dealer\",\"recipient\",\"share\"],\"title\":\"JustificationEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"electionKey\":{\"$ref\":\"#/$defs/ElectionKey\"},\"kind\":{\"const\":\"electionKey\"}},\"required\":[\"kind\",\"electionKey\"],\"title\":\"ElectionKeyEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"kind\":{\"const\":\"partials\"},\"partials\":{\"items\":{\"$ref\":\"#/$defs/PartialDecryption\"},\"maxItems\":100000,\"minItems\":1,\"type\":\"array\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"kind\",\"trustee\",\"partials\"],\"title\":\"PartialDecryptionsEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"properties\":{\"ballot\":{\"$ref\":\"#/$defs/Ballot\"},\"kind\":{\"const\":\"unsealed\"},\"leafIndex\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"kind\",\"leafIndex\",\"ballot\"],\"title\":\"UnsealedEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"A sealed cast that did not open, or opened to no valid ballot: not counted (CONVENTIONS §9.7).\",\"properties\":{\"kind\":{\"const\":\"spoiled\"},\"leafIndex\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"kind\",\"leafIndex\"],\"title\":\"SpoiledEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"One step of the trustees' ceremony — an enrolment, a dealing, a confirmation or a justification — as the trustee's own signed request, so that anyone reading the board can tell who took it (CONVENTIONS §9.6).\",\"properties\":{\"kind\":{\"const\":\"trusteeStep\"},\"request\":{\"$ref\":\"#/$defs/SignedRequest\"}},\"required\":[\"kind\",\"request\"],\"title\":\"TrusteeStepEntry\",\"type\":\"object\"},{\"additionalProperties\":false,\"description\":\"The community's voting/trustees/authorize request, exactly as the ballot box received it: the decryption targets of a closed election, pinned by digest to a head of the board (CONVENTIONS §9.7).\",\"properties\":{\"kind\":{\"const\":\"decryptionAuthorized\"},\"request\":{\"$ref\":\"#/$defs/SignedRequest\"}},\"required\":[\"kind\",\"request\"],\"title\":\"DecryptionAuthorizedEntry\",\"type\":\"object\"}],\"title\":\"BoardEntry\"},\"BoardHead\":{\"additionalProperties\":false,\"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.\",\"properties\":{\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"issuedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"rootHash\":{\"$ref\":\"#/$defs/DigestMultibase\",\"description\":\"The RFC 9162 Merkle tree hash (SHA-256) of the first `treeSize` entries, as a multihash.\"},\"treeSize\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"electionId\",\"treeSize\",\"rootHash\",\"issuedAt\"],\"title\":\"BoardHead\",\"type\":\"object\"},\"Cast\":{\"additionalProperties\":false,\"description\":\"A ballot and the PCS attestation that admits it (VTI-VOT-030). `attestation` is the suite's canonical encoding of the attestation made for the election point with the ballot context bound in (CONVENTIONS §3); `tag` repeats its tag so a ballot box can refuse a duplicate before the pairing check.\",\"properties\":{\"attestation\":{\"$ref\":\"#/$defs/Multibase\"},\"ballot\":{\"$ref\":\"#/$defs/Ballot\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"ballot\",\"tag\",\"attestation\"],\"title\":\"Cast\",\"type\":\"object\"},\"Dealing\":{\"additionalProperties\":false,\"description\":\"A trustee's contribution to the election key: Feldman commitments to its polynomial, a proof of knowledge of the constant term, and one share per trustee sealed to that trustee's transport key (CONVENTIONS §9.6).\",\"properties\":{\"commitments\":{\"items\":{\"$ref\":\"#/$defs/GroupElement\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"},\"dealer\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"pok\":{\"$ref\":\"#/$defs/SigmaProof\"},\"shares\":{\"items\":{\"$ref\":\"#/$defs/SealedShare\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"}},\"required\":[\"dealer\",\"commitments\",\"pok\",\"shares\"],\"title\":\"Dealing\",\"type\":\"object\"},\"DecryptionTarget\":{\"additionalProperties\":false,\"description\":\"What a partial decryption decrypts: the sealed cast at a board leaf, or the total of one option of one question.\",\"oneOf\":[{\"required\":[\"leafIndex\"]},{\"required\":[\"question\",\"option\"]}],\"properties\":{\"ciphertext\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"},\"leafIndex\":{\"description\":\"A sealed cast's board leaf.\",\"minimum\":0,\"type\":\"integer\"},\"option\":{\"$ref\":\"#/$defs/Key\"},\"question\":{\"$ref\":\"#/$defs/Key\"}},\"required\":[\"ciphertext\"],\"title\":\"DecryptionTarget\",\"type\":\"object\"},\"DigestMultibase\":{\"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`.\",\"examples\":[\"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"],\"minLength\":16,\"pattern\":\"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\"title\":\"DigestMultibase\",\"type\":\"string\"},\"DisjunctiveProof\":{\"description\":\"A disjunctive proof that a ciphertext encrypts one value of a public list: one `(c, z)` per value, in the list's order (CONVENTIONS §9.3).\",\"items\":{\"$ref\":\"#/$defs/SigmaProof\"},\"maxItems\":65,\"minItems\":1,\"title\":\"DisjunctiveProof\",\"type\":\"array\"},\"ElGamalCiphertext\":{\"additionalProperties\":false,\"description\":\"`(a, b) = (r·G, M + r·Y)` under the election key `Y` (CONVENTIONS §9.2).\",\"properties\":{\"a\":{\"$ref\":\"#/$defs/GroupElement\"},\"b\":{\"$ref\":\"#/$defs/GroupElement\"}},\"required\":[\"a\",\"b\"],\"title\":\"ElGamalCiphertext\",\"type\":\"object\"},\"ElectionId\":{\"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.\",\"pattern\":\"^[A-Za-z0-9._-]{1,128}$\",\"title\":\"ElectionId\",\"type\":\"string\"},\"ElectionKey\":{\"additionalProperties\":false,\"description\":\"The election key and each trustee's public verification key, computed from the qualified dealings (CONVENTIONS §9.6). Anyone can recompute it from the board.\",\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"qualified\":{\"description\":\"The dealers whose dealings the key is formed from.\",\"items\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"verification\":{\"items\":{\"additionalProperties\":false,\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"trustee\",\"key\"],\"type\":\"object\"},\"maxItems\":64,\"minItems\":2,\"type\":\"array\"}},\"required\":[\"key\",\"qualified\",\"verification\"],\"title\":\"ElectionKey\",\"type\":\"object\"},\"ElectionResult\":{\"additionalProperties\":false,\"description\":\"An election's result, computable by anyone who can read its board from the board and the registration alone (VTI-VOT-070).\",\"properties\":{\"ballotsCounted\":{\"minimum\":0,\"type\":\"integer\"},\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"head\":{\"$ref\":\"#/$defs/BoardHead\",\"description\":\"The head of the board as it stood at close: the result counts exactly its entries.\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"},\"questions\":{\"items\":{\"$ref\":\"#/$defs/QuestionResult\"},\"type\":\"array\"}},\"required\":[\"electionId\",\"manifestDigest\",\"ballotsCounted\",\"questions\",\"head\"],\"title\":\"ElectionResult\",\"type\":\"object\"},\"EncryptedBallot\":{\"additionalProperties\":false,\"description\":\"A tallied-encrypted ballot: one EncryptedQuestion per manifest question, in the manifest's order. Never decrypted (VTI-VOT-064).\",\"properties\":{\"electionId\":{\"$ref\":\"#/$defs/ElectionId\"},\"manifestDigest\":{\"$ref\":\"#/$defs/DigestMultibase\"},\"questions\":{\"items\":{\"$ref\":\"#/$defs/EncryptedQuestion\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"}},\"required\":[\"electionId\",\"manifestDigest\",\"questions\"],\"title\":\"EncryptedBallot\",\"type\":\"object\"},\"EncryptedCast\":{\"additionalProperties\":false,\"description\":\"A cast of a sealed or tallied-encrypted election: exactly one of `sealed` (the Ballot's JCS bytes sealed to the election key) or `encrypted`, with the tag and the attestation over the JCS bytes of whichever is present (CONVENTIONS §3.6, §9.5).\",\"oneOf\":[{\"required\":[\"sealed\"]},{\"required\":[\"encrypted\"]}],\"properties\":{\"attestation\":{\"$ref\":\"#/$defs/Multibase\"},\"encrypted\":{\"$ref\":\"#/$defs/EncryptedBallot\"},\"sealed\":{\"$ref\":\"#/$defs/SealedPayload\"},\"tag\":{\"$ref\":\"#/$defs/Multibase\"}},\"required\":[\"tag\",\"attestation\"],\"title\":\"EncryptedCast\",\"type\":\"object\"},\"EncryptedOption\":{\"additionalProperties\":false,\"properties\":{\"ciphertext\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"},\"proof\":{\"$ref\":\"#/$defs/DisjunctiveProof\"}},\"required\":[\"ciphertext\",\"proof\"],\"title\":\"EncryptedOption\",\"type\":\"object\"},\"EncryptedQuestion\":{\"additionalProperties\":false,\"description\":\"One choice question of a tallied-encrypted ballot: per option, in the manifest's order, an encryption of 0 or 1 with its proof; and a proof that the selections sum to a count the question admits (CONVENTIONS §9.5).\",\"properties\":{\"options\":{\"items\":{\"$ref\":\"#/$defs/EncryptedOption\"},\"maxItems\":64,\"minItems\":1,\"type\":\"array\"},\"question\":{\"$ref\":\"#/$defs/Key\"},\"sumProof\":{\"$ref\":\"#/$defs/DisjunctiveProof\"}},\"required\":[\"question\",\"options\",\"sumProof\"],\"title\":\"EncryptedQuestion\",\"type\":\"object\"},\"Ext\":{\"additionalProperties\":true,\"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.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"GroupElement\":{\"description\":\"A Ristretto group element: its 32-byte compression, multibase base58btc. Never the identity (CONVENTIONS §9.1).\",\"maxLength\":64,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"GroupElement\",\"type\":\"string\"},\"GroupScalar\":{\"description\":\"A scalar mod the Ristretto group order: 32 canonical little-endian bytes, multibase base58btc (CONVENTIONS §9.1).\",\"maxLength\":64,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"GroupScalar\",\"type\":\"string\"},\"Key\":{\"description\":\"A question or option key, unique within its manifest or question.\",\"pattern\":\"^[A-Za-z0-9._-]{1,64}$\",\"title\":\"Key\",\"type\":\"string\"},\"Multibase\":{\"description\":\"A binary value, multibase base58btc over the suite's canonical (compressed) encoding.\",\"maxLength\":16384,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"title\":\"Multibase\",\"type\":\"string\"},\"PartialDecryption\":{\"additionalProperties\":false,\"description\":\"Trustee `trustee`'s share of one decryption, `d = x_j·a`, with a Chaum–Pedersen proof against its verification key (CONVENTIONS §9.7).\",\"properties\":{\"d\":{\"$ref\":\"#/$defs/GroupElement\"},\"proof\":{\"$ref\":\"#/$defs/SigmaProof\"},\"target\":{\"$ref\":\"#/$defs/DecryptionTarget\"}},\"required\":[\"target\",\"d\",\"proof\"],\"title\":\"PartialDecryption\",\"type\":\"object\"},\"QuestionResult\":{\"additionalProperties\":false,\"description\":\"One question's totals. `choice`: selections per option. `ranking`: per option, how many ballots placed it at each position (index 0 = first). `score`: per option, the sum and the number of ballots that scored it. `text`: the answers, in board order, withheld (`withheld: true`) below the manifest's `textReleaseThreshold`. `abstained` counts ballots that left the question unanswered.\",\"properties\":{\"abstained\":{\"minimum\":0,\"type\":\"integer\"},\"choice\":{\"additionalProperties\":{\"minimum\":0,\"type\":\"integer\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"question\":{\"$ref\":\"#/$defs/Key\"},\"ranking\":{\"additionalProperties\":{\"items\":{\"minimum\":0,\"type\":\"integer\"},\"type\":\"array\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"score\":{\"additionalProperties\":{\"additionalProperties\":false,\"properties\":{\"count\":{\"minimum\":0,\"type\":\"integer\"},\"sum\":{\"type\":\"integer\"}},\"required\":[\"sum\",\"count\"],\"type\":\"object\"},\"propertyNames\":{\"$ref\":\"#/$defs/Key\"},\"type\":\"object\"},\"text\":{\"items\":{\"maxLength\":4096,\"type\":\"string\"},\"type\":\"array\"},\"withheld\":{\"type\":\"boolean\"}},\"required\":[\"question\",\"abstained\"],\"title\":\"QuestionResult\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"entries\":{\"description\":\"Consecutive entries from `from`, in board order.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"entry\":{\"$ref\":\"#/$defs/BoardEntry\"},\"index\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"index\",\"entry\"],\"type\":\"object\"},\"maxItems\":1000,\"type\":\"array\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"next\":{\"description\":\"The `from` of the next page. Absent when the page reaches `treeSize`.\",\"minimum\":1,\"type\":\"integer\"},\"treeSize\":{\"description\":\"The tree size the page was read against. No entry at or beyond it is returned.\",\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"treeSize\",\"entries\"],\"title\":\"Voting — Board Read — response payload\",\"type\":\"object\"},\"SealedPayload\":{\"additionalProperties\":false,\"description\":\"Bytes sealed to a key: a random group element encrypted as `kem`, and the bytes under ChaCha20-Poly1305 with a key derived from it, multibase base58btc (CONVENTIONS §9.4).\",\"properties\":{\"body\":{\"maxLength\":131072,\"minLength\":2,\"pattern\":\"^z[1-9A-HJ-NP-Za-km-z]+$\",\"type\":\"string\"},\"kem\":{\"$ref\":\"#/$defs/ElGamalCiphertext\"}},\"required\":[\"kem\",\"body\"],\"title\":\"SealedPayload\",\"type\":\"object\"},\"SealedShare\":{\"additionalProperties\":false,\"properties\":{\"recipient\":{\"$ref\":\"#/$defs/TrusteeIndex\"},\"share\":{\"$ref\":\"#/$defs/SealedPayload\"}},\"required\":[\"recipient\",\"share\"],\"title\":\"SealedShare\",\"type\":\"object\"},\"SigmaProof\":{\"additionalProperties\":false,\"description\":\"A non-interactive sigma proof as its challenge and response `(c, z)` (Schnorr or Chaum–Pedersen; CONVENTIONS §9.3).\",\"properties\":{\"c\":{\"$ref\":\"#/$defs/GroupScalar\"},\"z\":{\"$ref\":\"#/$defs/GroupScalar\"}},\"required\":[\"c\",\"z\"],\"title\":\"SigmaProof\",\"type\":\"object\"},\"SignedRequest\":{\"description\":\"A whole Trust Task request document — `id`, `type`, `issuer`, `payload` and every other member, `proof` included — exactly as the ballot box received it, never re-serialised: its proof is taken over its members, and a re-serialised copy does not reliably reproduce them. Typed as an open object so every member survives; CONVENTIONS §9.6 gives the checks that make it a trustee's step.\",\"minProperties\":1,\"title\":\"SignedRequest\",\"type\":\"object\"},\"TransportKey\":{\"additionalProperties\":false,\"description\":\"The group element a trustee's shares are sealed to, with a Schnorr proof of knowledge of its discrete log (CONVENTIONS §9.6).\",\"properties\":{\"key\":{\"$ref\":\"#/$defs/GroupElement\"},\"pok\":{\"$ref\":\"#/$defs/SigmaProof\"},\"trustee\":{\"$ref\":\"#/$defs/TrusteeIndex\"}},\"required\":[\"trustee\",\"key\",\"pok\"],\"title\":\"TransportKey\",\"type\":\"object\"},\"TrusteeIndex\":{\"description\":\"A trustee's index: its position in the manifest's `trustees.dids`, counting from 1.\",\"maximum\":64,\"minimum\":1,\"title\":\"TrusteeIndex\",\"type\":\"integer\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] =
&[error_codes::ELECTION_UNKNOWN, error_codes::OUT_OF_RANGE];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `voting/board/read:electionUnknown`
///
/// No election with this identifier exists for this community, or the caller may not see it.
///
/// Declared `retryable: false`.
pub const ELECTION_UNKNOWN: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "voting/board/read:electionUnknown",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `voting/board/read:outOfRange`
///
/// `treeSize` is greater than the board's current size, or `from` is greater than the tree size read against.
///
/// Declared `retryable: false`.
pub const OUT_OF_RANGE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "voting/board/read:outOfRange",
retryable: false,
details_schema: ::core::option::Option::None,
};
}