Documentation ¶
Index ¶
- Constants
- func TypeToString(keyType byte) string
- type Signer
- type SignerImplV1
- func (s *SignerImplV1) GetAddr(chainID *big.Int, contractAddr common.Address) (byte, common.Address, error)
- func (s *SignerImplV1) SetKey(chainID *big.Int, contractAddr common.Address, keyType byte, key []byte) error
- func (s *SignerImplV1) Sign(chainID *big.Int, contractAddr common.Address, msg []byte) (byte, []byte, error)
- func (s *SignerImplV1) Start() error
- func (s *SignerImplV1) Stop()
Constants ¶
View Source
const ( SECP256K1_KEY_TYPE = byte(1) SECP256K1_KEY_TYPE_REPR = "secp256k1" )
Variables ¶
This section is empty.
Functions ¶
func TypeToString ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.