Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Crypto-Project-ENSTA/back-end/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint completes the voting flow. You send your second credential (N2) and your ballot choice, and the server retrieves N1 from the session that was established by /voters/check_n1. The ballot is passed through the RSA blind signature pipeline before being forwarded to the anonymizer service, ensuring your vote cannot be linked back to your identity. Once the vote is accepted, N1 is removed from the session so it cannot be reused.
The submitted vote passes through the RSA blind signature pipeline before it is stored. This ensures votes are unlinkable to individual voters even if the storage layer is compromised.

Prerequisites

You must call /voters/check_n1 in the same session before calling this endpoint. The server reads N1 from the session automatically. If N1 is not in the session the endpoint returns 403.

Request

POST /voters/submit_vote

Body

n2
string
required
The second credential nonce from the voter’s credential email. Used together with N1 (retrieved from the session) to authenticate the ballot submission.
vote
string
required
The voter’s ballot choice. Must be a recognised vote option string as defined by the active election configuration.

Response

status
string
required
"success" when the ballot was accepted and forwarded to the anonymizer.
message
string
required
Human-readable confirmation, for example "Vote submitted successfully and sent to anonymizer".

HTTP status codes

CodeMeaning
200Ballot accepted and forwarded to the anonymizer.
403N1 not found in the session — call /voters/check_n1 first, or re-call it if the session expired.
400Invalid n2 format, unrecognised vote choice, or other validation failure.
500Unexpected server-side error during ballot processing.
N1 is cleared from the session as soon as the vote is accepted. This prevents double voting — if you call /voters/submit_vote a second time in the same session it will return 403 until you go through /voters/check_n1 again.

Example

curl -X POST https://your-api/voters/submit_vote \
  -H "Content-Type: application/json" \
  -c cookies.txt -b cookies.txt \
  -d '{"n2": "f7e8d9c0b1a2...", "vote": "candidate_a"}'
{
  "status": "success",
  "message": "Vote submitted successfully and sent to anonymizer"
}

Build docs developers (and LLMs) love