Documentation ¶
Index ¶
- func PublicKeyToAddress(pubKey *btcec.PublicKey) *ethtypes.Address0xHex
- type KeyPair
- type SignatureData
- func (s *SignatureData) CompactRSV() []byte
- func (s *SignatureData) Recover(message []byte, chainID int64) (a *ethtypes.Address0xHex, err error)
- func (s *SignatureData) RecoverDirect(message []byte, chainID int64) (a *ethtypes.Address0xHex, err error)
- func (s *SignatureData) UpdateEIP155(chainID int64)
- func (s *SignatureData) UpdateEIP2930()
- type Signer
- type SignerDirect
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublicKeyToAddress ¶
func PublicKeyToAddress(pubKey *btcec.PublicKey) *ethtypes.Address0xHex
Types ¶
type KeyPair ¶
type KeyPair struct { PrivateKey *btcec.PrivateKey PublicKey *btcec.PublicKey Address ethtypes.Address0xHex }
func KeyPairFromBytes ¶ added in v1.1.14
func NewSecp256k1KeyPair
deprecated
func (*KeyPair) PrivateKeyBytes ¶
func (*KeyPair) PublicKeyBytes ¶
func (*KeyPair) Sign ¶
func (k *KeyPair) Sign(message []byte) (ethSig *SignatureData, err error)
Sign hashes the input then signs it
func (*KeyPair) SignDirect ¶ added in v1.1.11
func (k *KeyPair) SignDirect(message []byte) (ethSig *SignatureData, err error)
SignDirect performs raw signing - give legacy 27/28 V values
type SignatureData ¶
func DecodeCompactRSV ¶ added in v1.1.14
func DecodeCompactRSV(ctx context.Context, compactRSV []byte) (*SignatureData, error)
func (*SignatureData) CompactRSV ¶ added in v1.1.14
func (s *SignatureData) CompactRSV() []byte
We use the ethereum convention of R,S,V for compact packing (mentioned because Golang tends to prefer V,R,S)
func (*SignatureData) Recover ¶
func (s *SignatureData) Recover(message []byte, chainID int64) (a *ethtypes.Address0xHex, err error)
Recover obtains the original signer from the hash of the message
func (*SignatureData) RecoverDirect ¶ added in v1.1.11
func (s *SignatureData) RecoverDirect(message []byte, chainID int64) (a *ethtypes.Address0xHex, err error)
Recover obtains the original signer
func (*SignatureData) UpdateEIP155 ¶
func (s *SignatureData) UpdateEIP155(chainID int64)
EIP-155 rules - 2xChainID + 35 - starting point must be legacy 27/28
func (*SignatureData) UpdateEIP2930 ¶
func (s *SignatureData) UpdateEIP2930()
EIP-2930 (/ EIP-1559) rules - 0 or 1 V value for raw Y-parity value (chainID goes into the payload)
type Signer ¶ added in v0.9.14
type Signer interface {
Sign(msgToHashAndSign []byte) (*SignatureData, error)
}
Signer is the low level common interface that can be implemented by any module which provides signature capability
type SignerDirect ¶ added in v1.1.11
type SignerDirect interface { Signer SignDirect(message []byte) (*SignatureData, error) }
Click to show internal directories.
Click to hide internal directories.