signer

package
v0.0.83 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERC1271MagicValue = "0x1626ba7e"
)

Variables

This section is empty.

Functions

func ComputeEthereumSignedMessageHash

func ComputeEthereumSignedMessageHash(message []byte) []byte

computeEthereumSignedMessageHash accepts an arbitrary message, prepends a known message, and hashes the result using keccak256. The known message added to the input before hashing is "\x19Ethereum Signed Message:\n" + len(message).

func RecoverEthMessageSigner

func RecoverEthMessageSigner(signature Signature, message []byte) (*ecdsa.PublicKey, error)

func RecoverEthMessageSignerAddress

func RecoverEthMessageSignerAddress(signature Signature, message []byte) (common.Address, error)

func SignerFnFactory

func SignerFnFactory(signer Signer, chainID *big.Int) func(common.Address, *types.Transaction) (*types.Transaction, error)

Types

type LocalSigner

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

func NewLocalSigner

func NewLocalSigner(privateKey *ecdsa.PrivateKey) LocalSigner

func (LocalSigner) CommonAddress

func (s LocalSigner) CommonAddress() common.Address

func (LocalSigner) PublicKey

func (s LocalSigner) PublicKey() *ecdsa.PublicKey

func (LocalSigner) Sign

func (s LocalSigner) Sign(msg []byte) (Signature, error)

type Signature

type Signature struct {
	R []byte
	S []byte
	V byte
}

func NewSignature

func NewSignature(R, S []byte, V byte) Signature

func NewSignatureFromBytes

func NewSignatureFromBytes(sig []byte) Signature

func SignEthMessage

func SignEthMessage(signer Signer, msg []byte) (Signature, error)

func (Signature) Equal added in v0.0.42

func (s1 Signature) Equal(s2 Signature) bool

func (Signature) MarshalJSON added in v0.0.42

func (s Signature) MarshalJSON() ([]byte, error)

func (Signature) Raw

func (sig Signature) Raw() (concatenatedSignature []byte)

func (Signature) RecoverPublicKey

func (sig Signature) RecoverPublicKey(msg []byte) (*ecdsa.PublicKey, error)

func (Signature) String

func (sig Signature) String() string

func (*Signature) UnmarshalJSON added in v0.0.42

func (s *Signature) UnmarshalJSON(b []byte) error

type Signer

type Signer interface {
	Sign(msg []byte) (Signature, error)

	PublicKey() *ecdsa.PublicKey
	CommonAddress() common.Address
}

Jump to

Keyboard shortcuts

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