signer

package
v6.1.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECSignature

type ECSignature struct {
	V byte
	R common.Hash
	S common.Hash
}

ECSignature contains the parameters of an elliptic curve signature

type EthRPCSigner

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

EthRPCSigner is a signer that uses a call to Ethereum JSON-RPC method `eth_call` to produce a signature

func (*EthRPCSigner) EthSign

func (e *EthRPCSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)

EthSign signs a message via the `eth_sign` Ethereum JSON-RPC call

type LocalSigner

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

LocalSigner is a signer that produces an `eth_sign`-compatible signature locally using a private key

func (*LocalSigner) EthSign

func (l *LocalSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)

EthSign mimicks the signing of `eth_sign` locally its supplied private key

func (*LocalSigner) GetSignerAddress

func (l *LocalSigner) GetSignerAddress() common.Address

GetSignerAddress returns the signerAddress corresponding to LocalSigner's private key

type Signer

type Signer interface {
	EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
}

Signer defines the methods needed to act as a elliptic curve signer

func NewEthRPCSigner

func NewEthRPCSigner(rpcClient *rpc.Client) Signer

NewEthRPCSigner instantiates a new EthRPCSigner

func NewLocalSigner

func NewLocalSigner(privateKey *ecdsa.PrivateKey) Signer

NewLocalSigner instantiates a new LocalSigner

func NewTestSigner

func NewTestSigner() Signer

NewTestSigner instantiates a new LocalSigner

type TestSigner

type TestSigner struct{}

TestSigner generates `eth_sign` signatures for test accounts available on the test Ethereum node Ganache

func (*TestSigner) EthSign

func (t *TestSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)

EthSign generates an `eth_sign` equivalent signature using an public/private key pair hard-coded in the constants package.

func (*TestSigner) SignTx

func (t *TestSigner) SignTx(message []byte, signerAddress common.Address) ([]byte, error)

SignTx signs an Ethereum transaction with a public/private key pair hard-coded in the constants package. It returns the transaction signature.

Jump to

Keyboard shortcuts

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