signature

package
v0.0.0-...-40b4526 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ZeroHash string = "0x0000000000000000000000000000000000000000000000000000000000000000"

ZeroHash represents a hash code of zeros.

Variables

This section is empty.

Functions

func FromBytes

func FromBytes(sig []byte) (r, s, v *big.Int, err error)

FromBytes takes signature in []byte format and converts it to r, s, v format.

func Hash

func Hash(value any) string

Hash returns unique representation of the value.

func RecoverAddress

func RecoverAddress(value any, r, s, v *big.Int) (common.Address, error)

RecoverAddress takes any value and r, s, v signature representation and recovers Etherium account address associated with that signature.

func Sign

func Sign(value any, pk *ecdsa.PrivateKey) (r, s, v *big.Int, err error)

Sign signs any value using given private key. Function returns r, s, v representation of the signature where:

  • r represents first coordinate of the ecdsa signature
  • s represents second coordinate of the ecdsa signature
  • v represents message signing ID, either 0 or 1 (23 or 24 with fitbitID)

func ToBytes

func ToBytes(r, s, v *big.Int) ([]byte, error)

ToBytes takes r, s, v signature format and converts it to the []byte format.

func ToBytesWithFitbitID

func ToBytesWithFitbitID(r, s, v *big.Int) ([]byte, error)

func Verify

func Verify(r, s, v *big.Int) error

Verify takes the r, s, v signature representation and verifies its correctness.

  • r represents first coordinate of the ecdsa signature
  • s represents second coordinate of the ecdsa signature
  • v represents message signing ID, either 0 or 1 (23 or 24 with fitbitID)

Types

This section is empty.

Jump to

Keyboard shortcuts

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