cmp

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSelfIDInGroup

func EnsureSelfIDInGroup(selfID party.ID, group []party.ID) []party.ID

EnsureSelfIDInGroup ensures that the given self ID is in the given group.

func HandleNetworkProtocol

func HandleNetworkProtocol(id party.ID, h pv0.Handler, network Network)

HandleNetworkProtocol is a helper function that loops over all the parties and calls the given handler.

func Keygen

func Keygen(id party.ID, ids party.IDSlice, n Network, threshold int, wg *sync.WaitGroup, pl *pool.Pool) (*cmp.Config, error)

It creates a new handler for the keygen protocol, runs the handler loop, and returns the result

func Refresh

func Refresh(c *cmp.Config, n Network, wg *sync.WaitGroup, pl *pool.Pool) (*cmp.Config, error)

It creates a new handler for the refresh protocol, runs the handler loop, and returns the result

func Sign

func Sign(c *cmp.Config, m []byte, signers party.IDSlice, n Network, wg *sync.WaitGroup, pl *pool.Pool) (*crypto.MPCECDSASignature, error)

It creates a new `protocol.MultiHandler` for the `cmp.Sign` protocol, and then runs the handler loop

func Verify

func Verify(c *cmp.Config, m []byte, sig *crypto.MPCECDSASignature) bool

Verify verifies a signature using the public key of the signer

Types

type Network

type Network interface {
	// Ls returns a list of peers that are connected to the network.
	Ls() []party.ID

	// A function that takes in a party ID and returns a channel of protocol messages.
	Next(id party.ID) <-chan *pv0.Message

	// Sending a message to the network.
	Send(msg *pv0.Message)

	// A channel that is closed when the party is done with the protocol.
	Done(id party.ID) chan struct{}

	// A function that is called when a party is done with the protocol.
	Quit(id party.ID)

	// IsOnlineNetwork returns true if the network is an online network.
	IsOnlineNetwork() bool
}

A Network is a channel that sends messages to parties and receives messages from parties.

func NewOfflineNetwork

func NewOfflineNetwork(parties ...party.ID) Network

It creates a new `OfflineNetwork` object, and initializes it with a list of parties, and a map of channels

Jump to

Keyboard shortcuts

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