json

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelFormJSON

type CancelFormJSON struct {
	FormID string
	UserID string
}

CancelFormJSON is the JSON representation of a CancelForm transaction

type CastVoteJSON

type CastVoteJSON struct {
	FormID     string
	UserID     string
	Ciphervote json.RawMessage
}

CastVoteJSON is the JSON representation of a CastVote transaction

type CiphervoteJSON

type CiphervoteJSON []EGPairJSON

CiphervoteJSON is the JSON representation of a ciphervote

type CloseFormJSON

type CloseFormJSON struct {
	FormID string
	UserID string
}

CloseFormJSON is the JSON representation of a CloseForm transaction

type CombineSharesJSON

type CombineSharesJSON struct {
	FormID string
	UserID string
}

CombineSharesJSON is the JSON representation of a CombineShares transaction

type CreateFormJSON

type CreateFormJSON struct {
	Configuration types.Configuration
	AdminID       string
}

CreateFormJSON is the JSON representation of a CreateForm transaction

type DeleteFormJSON

type DeleteFormJSON struct {
	FormID string
}

DeleteFormJSON is the JSON representation of a DeleteForm transaction

type EGPairJSON

type EGPairJSON struct {
	K []byte
	C []byte
}

EGPairJSON is the JSON representation of an ElGamal pair

type FormJSON

type FormJSON struct {
	Configuration types.Configuration

	// FormID is the hex-encoded SHA256 of the transaction ID that creates
	// the form
	FormID string

	AdminID string
	Status  uint16
	Pubkey  []byte `json:"Pubkey,omitempty"`

	// BallotSize represents the total size in bytes of one ballot. It is used
	// to pad smaller ballots such that all  ballots cast have the same size
	BallotSize int

	// Suffragias are the hex-encoded addresses of the Suffragia storages.
	Suffragias []string

	// BallotCount represents the total number of ballots cast.
	BallotCount uint32

	// SuffragiaHashes are the hex-encoded sha256-hashes of the ballots
	// in every Suffragia.
	SuffragiaHashes []string

	// ShuffleInstances is all the shuffles, along with their proof and identity
	// of shuffler.
	ShuffleInstances []ShuffleInstanceJSON

	// ShuffleThreshold is set based on the roster. We save it so we do not have
	// to compute it based on the roster each time we need it.
	ShuffleThreshold int

	PubsharesUnits PubsharesUnitsJSON

	DecryptedBallots []types.Ballot

	RosterBuf []byte
}

FormJSON defines the Form in the JSON format

type OpenFormJSON

type OpenFormJSON struct {
	FormID string
}

OpenFormJSON is the JSON representation of a OpenForm transaction

type PubsharesUnitJSON

type PubsharesUnitJSON [][][]byte

PubsharesUnitJSON is the JSON representation of a submission of pubShares by one node.The first dimension is the pubshares marshalled into bytes.

type PubsharesUnitsJSON

type PubsharesUnitsJSON struct {
	// PubsharesJSON contains all the pubShares submitted.
	PubsharesJSON []PubsharesUnitJSON
	PubKeys       [][]byte
	Indexes       []int
}

PubsharesUnitsJSON defines the JSON representation of the types.PubsharesUnits as used in the form.

type RegisterPubSharesJSON

type RegisterPubSharesJSON struct {
	FormID    string
	Index     int
	PubShares PubsharesUnitJSON
	Signature []byte
	PublicKey []byte
}

type ShuffleBallotsJSON

type ShuffleBallotsJSON struct {
	FormID       string
	Round        int
	Ciphervotes  []json.RawMessage
	RandomVector types.RandomVector
	Proof        []byte
	Signature    []byte
	PublicKey    []byte
}

ShuffleBallotsJSON is the JSON representation of a ShuffleBallots transaction

type ShuffleInstanceJSON

type ShuffleInstanceJSON struct {
	// ShuffledBallots contains the list of shuffled ciphertext for this round
	ShuffledBallots []json.RawMessage

	// ShuffleProofs is the proof of the shuffle for this round
	ShuffleProofs []byte

	// ShufflerPublicKey is the key of the node who made the given shuffle.
	ShufflerPublicKey []byte
}

ShuffleInstanceJSON defines the JSON representation of a shuffle instance

type SuffragiaJSON

type SuffragiaJSON struct {
	UserIDs     []string
	Ciphervotes []json.RawMessage
}

SuffragiaJSON defines the JSON representation of a suffragia.

type TransactionJSON

type TransactionJSON struct {
	CreateForm        *CreateFormJSON        `json:",omitempty"`
	OpenForm          *OpenFormJSON          `json:",omitempty"`
	CastVote          *CastVoteJSON          `json:",omitempty"`
	CloseForm         *CloseFormJSON         `json:",omitempty"`
	ShuffleBallots    *ShuffleBallotsJSON    `json:",omitempty"`
	RegisterPubShares *RegisterPubSharesJSON `json:",omitempty"`
	CombineShares     *CombineSharesJSON     `json:",omitempty"`
	CancelForm        *CancelFormJSON        `json:",omitempty"`
	DeleteForm        *DeleteFormJSON        `json:",omitempty"`
}

TransactionJSON is the JSON message that wraps the different kinds of transactions.

Jump to

Keyboard shortcuts

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