votingconfig

package
v0.5.49 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigVersionV1 = 1
	AuthVersionV1   = 1
	AlgEd25519      = "ed25519"
)

Variables

This section is empty.

Functions

func CanonicalPayloadV1

func CanonicalPayloadV1(eaPK [32]byte) []byte

func DecodeBase64Fixed

func DecodeBase64Fixed(s string, expectedLen int, field string) ([]byte, error)

func DecodeHexFixed

func DecodeHexFixed(s string, expectedLen int, field string) ([]byte, error)

func SignV1

func SignV1(priv ed25519.PrivateKey, eaPK [32]byte) []byte

func SignedPayloadHash

func SignedPayloadHash(payload []byte) [32]byte

func ValidateRoundID

func ValidateRoundID(roundID string) error

func ValidateWrapper

func ValidateWrapper(cfg *SignedConfig) error

func VerifyEntrySignatures

func VerifyEntrySignatures(entry RoundEntry, trusted []TrustedKey) bool

func VerifyV1

func VerifyV1(pub ed25519.PublicKey, eaPK [32]byte, sig []byte) bool

Types

type AuthStatus

type AuthStatus string
const (
	AuthAuthenticated     AuthStatus = "authenticated"
	AuthMissingRound      AuthStatus = "missing_round"
	AuthUnknownVersion    AuthStatus = "unknown_auth_version"
	AuthInvalidSignatures AuthStatus = "invalid_signatures"
	AuthEaPKMismatch      AuthStatus = "ea_pk_mismatch"
)

func Authenticate

func Authenticate(cfg *SignedConfig, trusted []TrustedKey, roundID string, eaPKFromChain [32]byte) AuthStatus

type Endpoint

type Endpoint struct {
	URL   string `json:"url"`
	Label string `json:"label"`
}

type RoundEntry

type RoundEntry struct {
	AuthVersion int         `json:"auth_version"`
	EaPK        string      `json:"ea_pk"`
	Signatures  []Signature `json:"signatures"`
}

type Signature

type Signature struct {
	KeyID string `json:"key_id"`
	Alg   string `json:"alg"`
	Sig   string `json:"sig"`
}

type SignedConfig

type SignedConfig struct {
	ConfigVersion     int                   `json:"config_version"`
	VoteServers       []Endpoint            `json:"vote_servers"`
	PIREndpoints      []Endpoint            `json:"pir_endpoints"`
	SupportedVersions SupportedVersions     `json:"supported_versions"`
	Rounds            map[string]RoundEntry `json:"rounds"`
}

type SupportedVersions

type SupportedVersions struct {
	PIR          []string `json:"pir"`
	VoteProtocol string   `json:"vote_protocol"`
	Tally        string   `json:"tally"`
	VoteServer   string   `json:"vote_server"`
}

type TrustedKey

type TrustedKey struct {
	KeyID  string `json:"key_id"`
	Alg    string `json:"alg"`
	Pubkey string `json:"pubkey"`
	Notes  string `json:"notes,omitempty"`
}

type TrustedKeysFile

type TrustedKeysFile struct {
	TrustedKeys []TrustedKey `json:"trusted_keys"`
}

Jump to

Keyboard shortcuts

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