local

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

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

Signer provides functions to sign a message and verify a signature using the chain-specific signature format. It also provides functions for convertion of a public key to address.

func NewSigner

func NewSigner(privateKey *ecdsa.PrivateKey) *Signer

NewSigner creates a new Signer instance for the provided private key.

func (*Signer) PublicKey

func (ls *Signer) PublicKey() []byte

PublicKey returns byte representation of a public key for the private key signer was created with.

func (*Signer) PublicKeyBytesToAddress

func (ls *Signer) PublicKeyBytesToAddress(publicKey []byte) []byte

PublicKeyBytesToAddress transforms the provided ECDSA public key in a bytes format into chain address represented in bytes.

func (*Signer) PublicKeyToAddress

func (ls *Signer) PublicKeyToAddress(publicKey ecdsa.PublicKey) []byte

PublicKeyToAddress transforms the provided ECDSA public key into chain address represented in bytes.

func (*Signer) Sign

func (ls *Signer) Sign(message []byte) ([]byte, error)

Sign signs the provided message.

func (*Signer) Verify

func (ls *Signer) Verify(message []byte, signature []byte) (bool, error)

Verify verifies the provided message against a signature using the key Signer was created with.

func (*Signer) VerifyWithPublicKey

func (ls *Signer) VerifyWithPublicKey(
	message []byte,
	signature []byte,
	publicKey []byte,
) (bool, error)

VerifyWithPublicKey verifies the provided message against a signature and public key.

Jump to

Keyboard shortcuts

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