dkg

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategorizeGroupSigners

func CategorizeGroupSigners(initialMessage []byte, masterPublicKey [4]*big.Int, publishedPublicKeys [][4]*big.Int, publishedSignatures [][2]*big.Int, participants ParticipantList, threshold int) ([]int, []int, error)

CategorizeGroupSigners returns 0 based indicies of honest participants, 0 based indicies of dishonest participants or an error

func GenerateGroupKeys

func GenerateGroupKeys(initialMessage []byte, transportPrivateKey *big.Int, transportPublicKey [2]*big.Int, privateCoefficients []*big.Int, encryptedShares [][]*big.Int, index int, participants ParticipantList, threshold int) (*big.Int, [4]*big.Int, [2]*big.Int, error)

GenerateGroupKeys returns the group private key, group public key, a signature and potentially an error

func GenerateKeyShare

func GenerateKeyShare(firstPrivateCoefficients *big.Int) ([2]*big.Int, [2]*big.Int, [4]*big.Int, error)

GenerateKeyShare returns G1 key share, G1 proof, G2 key share and potentially an error

func GenerateKeys

func GenerateKeys() (*big.Int, [2]*big.Int, error)

GenerateKeys returns a private key, a public key and potentially an error

func GenerateMasterPublicKey

func GenerateMasterPublicKey(keyShare1s [][2]*big.Int, keyShare2s [][4]*big.Int) ([4]*big.Int, error)

GenerateMasterPublicKey returns the master public key

func GenerateShares

func GenerateShares(transportPrivateKey *big.Int, transportPublicKey [2]*big.Int, participants ParticipantList, threshold int) ([]*big.Int, []*big.Int, [][2]*big.Int, error)

GenerateShares returns encrypted shares, private coefficients, commitments and potentially an error

func InverseArrayForUserCount

func InverseArrayForUserCount(n int) ([]*big.Int, error)

InverseArrayForUserCount pre-calculates an inverse array for use by ethereum contracts

func ThresholdForUserCount

func ThresholdForUserCount(n int) (int, int)

ThresholdForUserCount returns the threshold user count and k for successful key generation

func VerifyGroupSigners

func VerifyGroupSigners(initialMessage []byte, masterPublicKey [4]*big.Int, publishedPublicKeys [][4]*big.Int, publishedSignatures [][2]*big.Int, participants ParticipantList, threshold int) (bool, error)

VerifyGroupSigners returns whether the participants are valid or potentially an error

Types

type Participant

type Participant struct {
	Address   common.Address
	Index     int
	PublicKey [2]*big.Int
}

Participant contains what we know about other participants, i.e. public information

func (*Participant) String

func (p *Participant) String() string

Simplify logging

type ParticipantList

type ParticipantList []*Participant

ParticipantList is a required type alias since the Sort interface is awful

func (ParticipantList) Len

func (pl ParticipantList) Len() int

Len returns the len of the collection

func (ParticipantList) Less

func (pl ParticipantList) Less(i, j int) bool

Less decides if element i is 'Less' than element j -- less ~= before

func (ParticipantList) Swap

func (pl ParticipantList) Swap(i, j int)

Swap swaps elements i and j within the collection

Jump to

Keyboard shortcuts

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