logic

package
v0.0.0-...-f3fa3d8 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2016 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Id         string
	PasswdHash string
}

type BoardMember

type BoardMember struct {
	Name, Email  string
	PublicKeyDer []byte
}

* the most secure way would be : 1. send an email with confirmation 2. after clicking the link in the email, he would received PrivateKey in base64 format 3. after sending private key, public key is saved in a structure

the simplest solution : define board member, in response receive private key

type Election

type Election struct {
	Id, Title   string
	Options     []string
	Voters      []Voter
	BoardMember []BoardMember
}

type Organizer

type Organizer struct {
	Id               string
	PasswdHash       string
	HoldingElections map[string]Election
}

func (*Organizer) CreateElections

func (u *Organizer) CreateElections(organizerId, title string) (Election, error)

type SecureVoting

type SecureVoting struct {
	Admins          map[string]Admin
	ActiveElections map[string]Election
	Organizers      map[string]Organizer
}

func NewSecureVoting

func NewSecureVoting() *SecureVoting

func (*SecureVoting) CheckAdmin

func (sv *SecureVoting) CheckAdmin(adminId, adminPasswd string) (Admin, error)

func (*SecureVoting) CreateElections

func (sv *SecureVoting) CreateElections(organizerId, organizerPasswd, electionId string, initElectionConfig Election)

func (*SecureVoting) CreateOrganizer

func (sv *SecureVoting) CreateOrganizer(id string, passwd string) (Organizer, error)

func (*SecureVoting) GetElectionInfo

func (sv *SecureVoting) GetElectionInfo(electionId string) (Election, error)

func (*SecureVoting) ListElections

func (sv *SecureVoting) ListElections() []string

type Voter

type Voter struct {
	Name, Email string
}

Jump to

Keyboard shortcuts

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