local

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 7 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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