puredkg

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package puredkg implements the DKG protocol. It's independent of any transport, but rather expects to be driven from the outside.

Index

Constants

View Source
const (
	Off = Phase(iota)
	Dealing
	Accusing
	Apologizing
	Finalized
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccusationMsg

type AccusationMsg struct {
	Eon              uint64
	Accuser, Accused KeyperIndex
}

AccusationMsg is broadcast, Accuser is the sender.

type ApologyMsg

type ApologyMsg struct {
	Eon              uint64
	Accuser, Accused KeyperIndex
	Eval             *big.Int
}

ApologyMsg is broadcast, Accused is the sender.

type KeyperIndex

type KeyperIndex = uint64

type Phase

type Phase int

func (Phase) String

func (i Phase) String() string

type PolyCommitmentMsg

type PolyCommitmentMsg struct {
	Eon    uint64
	Sender KeyperIndex
	Gammas *shcrypto.Gammas
}

PolyCommitmentMsg is broadcast to all keypers.

type PolyEvalMsg

type PolyEvalMsg struct {
	Eon      uint64
	Sender   KeyperIndex
	Receiver KeyperIndex
	Eval     *big.Int
}

PolyEvalMsg is sent over a secure channel to a single receiver.

type PureDKG

type PureDKG struct {
	Phase       Phase
	Eon         uint64
	NumKeypers  uint64
	Threshold   uint64
	Keyper      KeyperIndex
	Polynomial  *shcrypto.Polynomial
	Commitments []*shcrypto.Gammas
	Evals       []*big.Int
	Accusations map[accusationKey]struct{}
	Apologies   map[accusationKey]*big.Int
}

PureDKG implements the distributed key generation process for a single keyper.

func NewPureDKG

func NewPureDKG(eon uint64, numKeypers uint64, threshold uint64, keyper KeyperIndex) PureDKG

func (*PureDKG) ComputeResult

func (pure *PureDKG) ComputeResult() (Result, error)

ComputeResult computes the eon secret key share and public key output of the DKG process. An error is returned if this is called before finalization or if too few keypers participated.

func (*PureDKG) Finalize

func (pure *PureDKG) Finalize()

func (*PureDKG) HandleAccusationMsg

func (pure *PureDKG) HandleAccusationMsg(msg AccusationMsg) error

HandleAccusationMsg handles an AccusationMsg.

func (*PureDKG) HandleApologyMsg

func (pure *PureDKG) HandleApologyMsg(msg ApologyMsg) error

HandleApologyMsg handles an ApologyMsg.

func (*PureDKG) HandlePolyCommitmentMsg

func (pure *PureDKG) HandlePolyCommitmentMsg(msg PolyCommitmentMsg) error

HandlePolyCommitmentMsg handles a PolyCommitmentMsg.

func (*PureDKG) HandlePolyEvalMsg

func (pure *PureDKG) HandlePolyEvalMsg(msg PolyEvalMsg) error

HandlePolyEvalMsg handles a PolyEvalMsg.

func (*PureDKG) ShortInfo

func (pure *PureDKG) ShortInfo() string

ShortInfo returns a short string to be used in log output, which describes the current state of the DKG.

func (*PureDKG) StartPhase1Dealing

func (pure *PureDKG) StartPhase1Dealing() (PolyCommitmentMsg, []PolyEvalMsg, error)

func (*PureDKG) StartPhase2Accusing

func (pure *PureDKG) StartPhase2Accusing() []AccusationMsg

func (*PureDKG) StartPhase3Apologizing

func (pure *PureDKG) StartPhase3Apologizing() []ApologyMsg

type Result

type Result struct {
	Eon             uint64
	NumKeypers      uint64
	Threshold       uint64
	Keyper          KeyperIndex
	SecretKeyShare  *shcrypto.EonSecretKeyShare
	PublicKey       *shcrypto.EonPublicKey
	PublicKeyShares []*shcrypto.EonPublicKeyShare
}

Jump to

Keyboard shortcuts

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