Commit graph

3 commits

Author SHA1 Message Date
a1e4ec6ce7 Cockpit UX: auto-open browser, Replay button, graceful serialization
Make the live cockpit foolproof to run:
- Auto-open the default browser on start (macOS/Linux/Windows; --no-open to
  disable). Binds the listener first, so the browser only opens once the server
  is accepting connections.
- Clear message when the port is already in use instead of a raw bind error.
- A prominent "▶ Run the election again" button appears when the ceremony
  finishes, so replaying needs no arcane page-reload knowledge.
- Second viewer now waits gracefully (mutex) instead of getting a 409.

Verified in-browser: replay button shows on completion; port-busy prints a
friendly message.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 17:13:20 +02:00
b38b990bc4 Add evote cockpit --tmux: one terminal pane per stakeholder
The terminal systems-view half of the cockpit, fed by the SAME trace stream as
the browser math view — no double-maintenance.

- cockpit_tmux.go: spawns a tmux session with one pane per stakeholder (setup,
  CC0–CC3, electoral board, voting server, verifier, and an aggregate voters
  pane), each running `evote panelview`. The ceremony runs in the background,
  appending paced NDJSON events to a shared temp file the panes tail. Guards for
  missing tmux and for being run inside an existing tmux session.
- panelview.go: a hidden subcommand each pane runs — follows the shared event
  file, filters to its stakeholder, and renders that party's operations as
  colored ASCII/Unicode math with elided live values.
- Attribute setup-phase Schnorr challenges to the generating CC and verify-phase
  challenges to the verifier (trace.SetContext), so every pane gets its ops.

Verified: panelview filters and renders correctly per role; a 9-pane tiled tmux
session builds with the real pane commands. (Interactive attach needs a TTY, so
the live attach is exercised when you run it.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 15:43:05 +02:00
1e0b286bd5 Add evote cockpit: watch the cryptography execute as live typeset math
The differentiator. A single self-contained browser page (no libraries, offline)
renders each real cryptographic operation as typeset mathematics the instant it
runs, with the actual runtime values:

- E_1 = (γ, φ) = (g^r, pk^r·m),  r ← Z_q      (ElGamal ballot encryption)
- e = H((p,q,g), y, c, h_aux) mod q            (Fiat-Shamir challenge)
- C' = { ReEnc_pk(C_π(i); ρ_i) }              (Bayer-Groth verifiable shuffle)
- σ ← Ed25519.Sign_sk(SHA256(envelope))        (transport signature)
- s = a·B = b·A ∈ X25519,  k = SHA256(…)      (X25519 key agreement)

Math is rendered via a focused LaTeX→native-MathML converter written for exactly
the notation the instrumentation emits — so it works in any modern browser with
zero dependencies and nothing to ship. Unknown tokens fall back to literal text,
never crashing the view.

`evote cockpit` starts an HTTP server; on page connect it runs one full multi-
party ceremony, streaming every crypto event over SSE with configurable pacing
(--delay) so a human can follow along. A stakeholder sidebar highlights the
acting party; a phase timeline tracks setup→cards→voting→tally→verify; each op
shows its live values as expandable, copyable chips.

Verified in a real browser: all five operation kinds render correctly (96 sign,
36 challenge, 6 keyex, 2 encrypt, 5 shuffle in a 2-voter run), no console errors,
ceremony completes and verifies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 14:19:13 +02:00