store

package
v0.0.0-...-f135b4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store is a storrage backend for vote-decrypt that uses the file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the decrypt.Store interface by writing the data to files.

If only one instance of the decrypt service is running, this is concurrency save. If more then one process is running, it depends on the features of the filesystem.

For each poll, two files are created. `POLLID_key` that contains the private key for the poll and `POLLID_hash` the contains the hash of the first stop request.

TODO: Think about timing attacks when files do not exist or have wrong content.

func New

func New(path string) *Store

New initializes a new Store.

func (*Store) ClearPoll

func (s *Store) ClearPoll(id string) error

ClearPoll removes all data for the poll.

func (*Store) LoadKey

func (s *Store) LoadKey(id string) ([]byte, error)

LoadKey returns the private key from the store.

If the poll is unknown return (nil, nil)

func (*Store) SaveKey

func (s *Store) SaveKey(id string, key []byte) error

SaveKey stores the private key.

Has to return an error, if a key already exists.

func (*Store) ValidateSignature

func (s *Store) ValidateSignature(id string, hash []byte) error

ValidateSignature makes sure, that no other signature is saved for a poll. Saves the signature for future calls.

Has to return an error if the id is unknown in the store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL