Add party layer scaffolding: PKI bootstrap + signed handshake
pkg/party models each endpoint of the system as a separate object holding only
its own private state, wired together through the transport bus.
- ceremony.go: NewCeremony bootstraps the Ed25519 root CA, enrolls all parties
(setup, 4 CCs, electoral board, voting server, verifier, N voters) with
CA-signed identity certs, registers each in the directory, and wires its
handler into the bus.
- parties.go: the six party types and a shared hello/ack handshake; Handshake()
proves the full sign -> route -> verify -> reply -> verify path for every
party before any election logic runs.
- state.go: per-party private state structs (nothing shared across parties).
- transcript.go: PublicTranscript, the append-only bulletin board a remote
verifier will consume (no secrets).
- phases.go: phase handlers reject unknown message types cleanly (the transport
boundary never panics on unexpected input) — filled in over the next commits.
Transport CA API simplified to own its serial counter (NewCA/Issue).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:07:31 +00:00
|
|
|
package party
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/user/evote/pkg/transport"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Phase message handlers. These are filled in incrementally (setup, then
|
|
|
|
|
// voting, then tally). Until a phase is implemented its handler rejects unknown
|
|
|
|
|
// message types cleanly rather than panicking — the transport boundary must
|
|
|
|
|
// never crash on an unexpected message.
|
|
|
|
|
|
|
|
|
|
func (p *SetupComponent) handleSetupMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
|
|
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *ControlComponent) handleCCMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
2026-07-06 13:11:34 +00:00
|
|
|
switch env.Type {
|
|
|
|
|
case MsgGenCCKeys:
|
|
|
|
|
return p.handleGenCCKeys(env)
|
2026-07-06 13:15:38 +00:00
|
|
|
case MsgLongCodeShareReq:
|
|
|
|
|
return p.handleLongCodeShare(env)
|
2026-07-06 13:19:07 +00:00
|
|
|
case MsgVerifyBallot:
|
|
|
|
|
return p.handleVerifyBallot(env)
|
2026-07-06 13:23:56 +00:00
|
|
|
case MsgShuffle:
|
|
|
|
|
return p.handleShuffle(env)
|
2026-07-06 13:11:34 +00:00
|
|
|
default:
|
|
|
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
|
|
|
}
|
Add party layer scaffolding: PKI bootstrap + signed handshake
pkg/party models each endpoint of the system as a separate object holding only
its own private state, wired together through the transport bus.
- ceremony.go: NewCeremony bootstraps the Ed25519 root CA, enrolls all parties
(setup, 4 CCs, electoral board, voting server, verifier, N voters) with
CA-signed identity certs, registers each in the directory, and wires its
handler into the bus.
- parties.go: the six party types and a shared hello/ack handshake; Handshake()
proves the full sign -> route -> verify -> reply -> verify path for every
party before any election logic runs.
- state.go: per-party private state structs (nothing shared across parties).
- transcript.go: PublicTranscript, the append-only bulletin board a remote
verifier will consume (no secrets).
- phases.go: phase handlers reject unknown message types cleanly (the transport
boundary never panics on unexpected input) — filled in over the next commits.
Transport CA API simplified to own its serial counter (NewCA/Issue).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *ElectoralBoard) handleEBMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
2026-07-06 13:11:34 +00:00
|
|
|
switch env.Type {
|
|
|
|
|
case MsgGenEBKey:
|
|
|
|
|
return p.handleGenEBKey(env)
|
2026-07-06 13:23:56 +00:00
|
|
|
case MsgFinalMix:
|
|
|
|
|
return p.handleFinalMix(env)
|
2026-07-06 13:11:34 +00:00
|
|
|
default:
|
|
|
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
|
|
|
}
|
Add party layer scaffolding: PKI bootstrap + signed handshake
pkg/party models each endpoint of the system as a separate object holding only
its own private state, wired together through the transport bus.
- ceremony.go: NewCeremony bootstraps the Ed25519 root CA, enrolls all parties
(setup, 4 CCs, electoral board, voting server, verifier, N voters) with
CA-signed identity certs, registers each in the directory, and wires its
handler into the bus.
- parties.go: the six party types and a shared hello/ack handshake; Handshake()
proves the full sign -> route -> verify -> reply -> verify path for every
party before any election logic runs.
- state.go: per-party private state structs (nothing shared across parties).
- transcript.go: PublicTranscript, the append-only bulletin board a remote
verifier will consume (no secrets).
- phases.go: phase handlers reject unknown message types cleanly (the transport
boundary never panics on unexpected input) — filled in over the next commits.
Transport CA API simplified to own its serial counter (NewCA/Issue).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *VotingServer) handleServerMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
2026-07-06 13:15:38 +00:00
|
|
|
switch env.Type {
|
|
|
|
|
case MsgMappingTable:
|
|
|
|
|
return p.handleMappingTable(env)
|
2026-07-06 13:19:07 +00:00
|
|
|
case MsgCastBallot:
|
|
|
|
|
return p.handleCastBallot(env)
|
2026-07-06 13:23:56 +00:00
|
|
|
case MsgStartTally:
|
|
|
|
|
return p.handleStartTally(env)
|
2026-07-06 13:15:38 +00:00
|
|
|
default:
|
|
|
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
|
|
|
}
|
Add party layer scaffolding: PKI bootstrap + signed handshake
pkg/party models each endpoint of the system as a separate object holding only
its own private state, wired together through the transport bus.
- ceremony.go: NewCeremony bootstraps the Ed25519 root CA, enrolls all parties
(setup, 4 CCs, electoral board, voting server, verifier, N voters) with
CA-signed identity certs, registers each in the directory, and wires its
handler into the bus.
- parties.go: the six party types and a shared hello/ack handshake; Handshake()
proves the full sign -> route -> verify -> reply -> verify path for every
party before any election logic runs.
- state.go: per-party private state structs (nothing shared across parties).
- transcript.go: PublicTranscript, the append-only bulletin board a remote
verifier will consume (no secrets).
- phases.go: phase handlers reject unknown message types cleanly (the transport
boundary never panics on unexpected input) — filled in over the next commits.
Transport CA API simplified to own its serial counter (NewCA/Issue).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:07:31 +00:00
|
|
|
}
|