tecdsa

package
v0.0.0-...-369a1d7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Curve = tss.S256()

Curve is the curve implementation used across the tecdsa package.

IMPORTANT NOTE: The elliptic.UnmarshalCompressed function does not work as expected for this curve and always produces nil point coordinates. This is because the elliptic.UnmarshalCompressed always execute the y² = x³ - 3x + b equation to compute the y coordinate while the actual equation of the Curve (secp256k1) is y² = x³ + 7, i.e. the `a` parameter is 0 not -3.

View Source
var ErrIncompatiblePublicKey = fmt.Errorf(
	"public key is not tECDSA compatible and will cause unmarshaling error",
)

ErrIncompatiblePublicKey indicates that the given public key is not compatible with the tECDSA, i.e. uses a different elliptic curve. Such a key cannot be marshalled and unmarshalled.

Functions

This section is empty.

Types

type PrivateKeyShare

type PrivateKeyShare struct {
	// contains filtered or unexported fields
}

PrivateKeyShare represents a private key share used to produce tECDSA signatures. Private key shares are generated as result of the tECDSA distributed key generation (DKG) process.

func NewPrivateKeyShare

func NewPrivateKeyShare(data keygen.LocalPartySaveData) *PrivateKeyShare

NewPrivateKeyShare constructs a new instance of the tECDSA public key share based on the DKG result.

func (*PrivateKeyShare) Data

Data returns the internal data of the private key share.

func (*PrivateKeyShare) Marshal

func (pks *PrivateKeyShare) Marshal() ([]byte, error)

Marshal converts the PrivateKeyShare to a byte array.

func (*PrivateKeyShare) PublicKey

func (pks *PrivateKeyShare) PublicKey() *ecdsa.PublicKey

PublicKey returns the ECDSA public key corresponding to the given tECDSA private key share.

func (*PrivateKeyShare) Unmarshal

func (pks *PrivateKeyShare) Unmarshal(bytes []byte) error

Unmarshal converts a byte array back to the PrivateKeyShare.

type Signature

type Signature struct {
	R          *big.Int
	S          *big.Int
	RecoveryID int8
}

Signature holds a signature in a form of two big.Int `r` and `s` values and a recovery ID value in {0, 1, 2, 3}.

The signature is chain-agnostic. Some chains (e.g. Ethereum and BTC) require `v` to start from 27. Please consult the documentation about what the particular chain expects.

func NewSignature

func NewSignature(data *common.SignatureData) *Signature

NewSignature constructs a new instance of the tECDSA signature based on the signing result.

func (*Signature) Equals

func (s *Signature) Equals(other *Signature) bool

Equals determines the equality of two signatures.

func (*Signature) Marshal

func (s *Signature) Marshal() ([]byte, error)

Marshal converts the Signature to a byte array.

func (*Signature) String

func (s *Signature) String() string

String formats Signature to a string that contains R and S values as hexadecimals.

func (*Signature) Unmarshal

func (s *Signature) Unmarshal(bytes []byte) error

Unmarshal converts a byte array back to the Signature.

Directories

Path Synopsis
Package common holds some common tools that can be used across multiple tECDSA protocols, e.g.
Package common holds some common tools that can be used across multiple tECDSA protocols, e.g.
dkg
gen
pb

Jump to

Keyboard shortcuts

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