ethjwt

package
v0.0.0-...-269d6e4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrefixedHash

func PrefixedHash(data []byte) []byte

PrefixedHash is a helper function that calculates a hash for the given message that can be safely used to calculate a signature from.

The hash is calculated as

keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).

This gives context to the signed message and prevents signing of transactions.

Types

type SigningMethodEth

type SigningMethodEth struct {
	Name string
}

SigningMethodEth implements the ETH signing method. Expects *ecdsa.PrivateKey for signing and cli.Address for validation.

var SigningMethod *SigningMethodEth

SigningMethod is a specific instance of the ETH signing method.

func (*SigningMethodEth) Alg

func (m *SigningMethodEth) Alg() string

Alg returns the name of this signing method.

func (*SigningMethodEth) Sign

func (m *SigningMethodEth) Sign(signingString string, privateKey interface{}) (string, error)

Sign implements the Sign method from SigningMethod. For this signing method, must be a *ecdsa.PrivateKey structure.

func (*SigningMethodEth) Verify

func (m *SigningMethodEth) Verify(signingString, signature string, address interface{}) error

Verify implements the Verify method from SigningMethod. For this signing method, must be a cli.Address.

Jump to

Keyboard shortcuts

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