dkg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ShareMsgSize = 36

ShareMsgSize = 4 byte ID + 32 byte secret share

Variables

This section is empty.

Functions

func Eval

func Eval(index *ristretto255.Scalar, commits []*ristretto255.Element) *ristretto255.Element

Eval a set of commitments at a given index

func PeerShare

func PeerShare(id peer.ID, commits Commitments) (*ristretto255.Element, error)

PeerShare reconstructs a peer's public key share from the set of all commitments

Types

type CommitMsg

type CommitMsg struct {
	ID     peer.ID // Peer ID
	Public         // Public commitments to the coefficients of F
}

CommitMsg is used to broadcast commitments to the coefficients of F

func (*CommitMsg) Decode

func (m *CommitMsg) Decode(payload []byte) (err error)

Decode a commit message

func (CommitMsg) Encode

func (m CommitMsg) Encode() []byte

Encode a commit message

type Commitments

type Commitments map[peer.ID]CommitMsg

Commitments holds peer commitments to the coefficents of F

type ContextString

type ContextString []byte

ContextString is used to prevent replay attacks

type DKG

type DKG struct {
	ID     peer.ID                          // this peer's ID
	T      uint32                           // threshold
	N      uint32                           // number of peers
	F      polynomial.Polynomial            // (t - 1) degree polynomial over Z_q
	Shares map[peer.ID]*ristretto255.Scalar // secret shares
	Public                                  // public portion of the scheme
	K      Keys                             // generated keys
}

DKG contains information used for distributed key generation

func (*DKG) Commit

func (v *DKG) Commit(ctx []byte) (err error)

Commit samples a random polynomial and commits to the coefficients

func (DKG) CommitMsg

func (v DKG) CommitMsg() *CommitMsg

CommitMsg extracts commitments from a DKG run

func (*DKG) GroupKey

func (v *DKG) GroupKey(c *Commitments)

GroupKey derives the group public key

func (*DKG) KeyGen

func (v *DKG) KeyGen(s Shares, c Commitments)

KeyGen uses the output of a DKG run to generate a key share and a group pubkey

func (*DKG) KeyShare

func (v *DKG) KeyShare(s *Shares)

KeyShare derives the signing key pair

func (*DKG) SecretShare

func (v *DKG) SecretShare() error

SecretShare generates n-1 secret shares by evaluating F at each index Note: index 0 is invalid to avoid leaking the secret

func (DKG) ShareMessage

func (v DKG) ShareMessage(id peer.ID) *ShareMsg

ShareMessage extracts secret shares from a DKG run

func (DKG) Verify

func (v DKG) Verify(s *ristretto255.Scalar, commits []*ristretto255.Element) error

Verify a secret share against a set of commitments

type KeyPair

type KeyPair struct {
	Priv ristretto255.Scalar  // private signing share
	Pub  ristretto255.Element // public verification share
}

KeyPair is a signing key share

type Keys

type Keys struct {
	GroupPubKey ristretto255.Element
	KeyPair
}

Keys holds a signing share

type Messages

type Messages struct {
	Commitments  map[peer.ID]CommitMsg
	SecretShares map[peer.ID]ShareMsg
}

Messages holds peer messages

func InitMessages

func InitMessages(n uint32) *Messages

InitMessages initializes message buffers

type Public

type Public struct {
	C   []*ristretto255.Element // public commitments to the coefficients of F mod q
	Sig *nizk.NIZK              // Schnorr signature of the constant term
}

Public is the public portion of the DKG scheme

type ShareMsg

type ShareMsg struct {
	ID    peer.ID              // Peer ID
	Share *ristretto255.Scalar // Secret Share
}

ShareMsg is used to broadcast a secret share

func (*ShareMsg) Decode

func (s *ShareMsg) Decode(buf []byte) error

Decode a secret share message

func (ShareMsg) Encode

func (s ShareMsg) Encode() []byte

Encode a secret share message

type Shares

type Shares map[peer.ID]ShareMsg

Shares holds peer secret shares

Jump to

Keyboard shortcuts

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