Documentation
¶
Index ¶
- func DeserializeECDSASecp256k1Signature(sigStr []byte) (*crypto.MPCECDSASignature, error)
- func Keygen(current crypto.PartyID, option ...KeygenOption) ([]*cmp.Config, error)
- func SerializeECDSASecp256k1Signature(sig *crypto.MPCECDSASignature) ([]byte, error)
- func SignCMP(configs []*cmp.Config, m []byte) ([]byte, error)
- func VerifyCMP(config *cmp.Config, m []byte, sig []byte) (bool, error)
- type KeygenOption
- type KeygenOpts
- type OnConfigGenerated
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 SerializeECDSASecp256k1Signature ¶
func SerializeECDSASecp256k1Signature(sig *crypto.MPCECDSASignature) ([]byte, error)
SerializeECDSASecp256k1Signature marshals an ECDSA signature to DER format for use with 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 ¶
OnConfigGenerated is a callback function that is called when a new account is generated.