mpc

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: GPL-3.0 Imports: 9 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, threshold int, peers []crypto.PartyID, handlers ...OnConfigGenerated) ([]*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 CustomMPC added in v0.5.0

type CustomMPC interface {
	CreateAndSignTx(from, to sdk.AccAddress, amount sdk.Coin, memo string, accountNumber, sequence uint64) (sdk.Tx, error)
	BroadcastTx(tx sdk.Tx) error
}

CustomMPC is an interface that defines the methods needed for MPC-based transactions.

type KeygenOption

type KeygenOption func(*KeygenOpts)

KeygenOption is a function that configures an account.

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 {
	// AccName is the name of the account.
	AccName string

	// 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

	// CoinType is the coin type of the account.
	CoinType crypto.CoinType

	// mtx is a mutex that is used to synchronize access to the doneConfChan.
	sync.Mutex
	// contains filtered or unexported fields
}

KeygenOpts is the configuration of an account.

type MPCClient added in v0.5.0

type MPCClient struct {
}

MPCClient is an implementation of the CustomMPC interface.

type OnConfigGenerated added in v0.4.3

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