signer

package
v0.0.0-...-7c2dc49 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SECP256K1_KEY_TYPE      = byte(1)
	SECP256K1_KEY_TYPE_REPR = "secp256k1"
)

Variables

This section is empty.

Functions

func TypeToString

func TypeToString(keyType byte) string

TypeToString gets the correspoding string repr of key type.

Types

type Signer

type Signer interface {
	// Start starts the signer's routine.
	Start() error

	// Stop safely stops the signer.
	Stop()

	// SetKey sets a signing key for given chain and a given contract addr.
	SetKey(chainID *big.Int, contractAddr common.Address, keyType byte, key []byte) error

	// GetAddr gets the associated address for a signing key linked with given chain and given contract addr.
	GetAddr(chainID *big.Int, contractAddr common.Address) (byte, common.Address, error)

	// Sign signs given message with internal stored key corresponding to given chainID and given contract addr.
	Sign(chainID *big.Int, contractAddr common.Address, msg []byte) (byte, []byte, error)
}

Signer is an interface for a message signer.

func NewSignerImplV1

func NewSignerImplV1(path string) Signer

NewSignerImplV1 creates a new Signer.

type SignerImplV1

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

SignerImplV1 implements the Signer interface.

func (*SignerImplV1) GetAddr

func (s *SignerImplV1) GetAddr(chainID *big.Int, contractAddr common.Address) (byte, common.Address, error)

GetAddr gets the associated address for a signing key linked with given chain and given contract addr.

func (*SignerImplV1) SetKey

func (s *SignerImplV1) SetKey(chainID *big.Int, contractAddr common.Address, keyType byte, key []byte) error

SetKey sets a signing key for given chain and a given contract addr.

func (*SignerImplV1) Sign

func (s *SignerImplV1) Sign(chainID *big.Int, contractAddr common.Address, msg []byte) (byte, []byte, error)

Sign signs given message with internal stored key correspdoing to given chainID and given contract addr.

func (*SignerImplV1) Start

func (s *SignerImplV1) Start() error

Start starts the signer's routine.

func (*SignerImplV1) Stop

func (s *SignerImplV1) Stop()

Stop stops the signer's routine.

Jump to

Keyboard shortcuts

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