mpc

package
v0.6.29-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeECDSASecp256k1Signature

func DeserializeECDSASecp256k1Signature(sigStr []byte) (*crypto.MPCECDSASignature, error)

- The R and S values must be in the valid range for secp256k1 scalars:

  • Negative values are rejected
  • Zero is rejected
  • Values greater than or equal to the secp256k1 group order are rejected

func Keygen

func Keygen(current crypto.PartyID, option ...KeygenOption) ([]*cmp.Config, error)

Keygen Generates a new ECDSA private key shared among all the given participants.

func SerializeECDSASecp256k1Signature

func SerializeECDSASecp256k1Signature(sig *crypto.MPCECDSASignature) ([]byte, error)

SerializeECDSASecp256k1Signature marshals an ECDSA signature to DER format for use with the CMP protocol

func SignCMP

func SignCMP(configs []*cmp.Config, m []byte) ([]byte, error)

SignCMP signs a message with the given private key using the CMP protocol.

func VerifyCMP

func VerifyCMP(config *cmp.Config, m []byte, sig []byte) (bool, error)

VerifyCMP verifies a message with the given public key using the CMP protocol.

Types

type KeygenOption

type KeygenOption func(*KeygenOpts)

KeygenOption is a function that configures an account.

func WithErrorChan

func WithErrorChan(errorsChan chan error) KeygenOption

WithErrorChan sets the channel that is used to send errors.

func WithHandlers

func WithHandlers(handlers ...OnConfigGenerated) KeygenOption

WithHandlers sets the list of handlers that are called when a new account is generated.

func WithPeers

func WithPeers(peers ...string) KeygenOption

WithPeers sets the list of all parties that can sign transactions.

func WithSelfID

func WithSelfID(selfID string) KeygenOption

WithSelfID sets the ID of the account that is used to sign transactions.

func WithThreshold

func WithThreshold(threshold int) KeygenOption

WithThreshold sets the number of required signatures to authorize a transaction.

type KeygenOpts

type KeygenOpts struct {
	// Network is the network that is used to communicate with other parties.
	Network crypto.Network

	// Threshold is the number of required signatures to authorize a transaction.
	Threshold int

	// Self SelfID is the SelfID of the account that is used to sign transactions.
	SelfID crypto.PartyID

	// Group is the list of all parties that can sign transactions.
	Peers []crypto.PartyID

	// Handlers is the list of handlers that are called when a new account is generated.
	Handlers []OnConfigGenerated
	// contains filtered or unexported fields
}

KeygenOpts is the configuration of an account.

func (*KeygenOpts) Apply

func (o *KeygenOpts) Apply(opts ...KeygenOption)

type OnConfigGenerated

type OnConfigGenerated func(*cmp.Config) error

OnConfigGenerated is a callback function that is called when a new account is generated.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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