From efe483b666c794ecdd1429845834ba80256054e8 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sun, 14 Feb 2021 19:53:59 -0500 Subject: [PATCH] Throw away our private key for an election after it's over --- cmd/tallyard/main.go | 2 ++ election/voter.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/cmd/tallyard/main.go b/cmd/tallyard/main.go index cdc9d88..b0e93a4 100644 --- a/cmd/tallyard/main.go +++ b/cmd/tallyard/main.go @@ -162,6 +162,8 @@ func main() { } el.PrintResults() + + el.Finish() } func debugEventHook(_ mautrix.EventSource, evt *event.Event) { diff --git a/election/voter.go b/election/voter.go index 3dc6459..86ba24b 100644 --- a/election/voter.go +++ b/election/voter.go @@ -218,3 +218,11 @@ func (el *Election) SendSum(client *mautrix.Client, eventStore *EventStore) erro return nil } + +func (el *Election) Finish() { + el.Lock() + defer el.Save() + defer el.Unlock() + // the election is over; throw away the keys! + el.LocalVoter = nil +} -- 2.38.4