signature

package
v0.0.0-...-297edb8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package signature handles all lower level support for signing transactions.

Index

Constants

View Source
const QID = 29

QID is an arbitrary value added to the v component of the signature similar to Ethereum and Bitcoin.

View Source
const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"

ZeroHash is the hash of an empty string.

Variables

This section is empty.

Functions

func FromAddress

func FromAddress(value any, v, r, s *big.Int) (string, error)

FromAddress extracts the address from the signature that signed the data.

func Hash

func Hash(value any) string

Hash returns a unique hash for the data.

func Sign

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

Sign uses the specified private key to sign the data.

func SignatureString

func SignatureString(v, r, s *big.Int) string

SignatureString returns the signature in the [R|S|V] format.

func ToSignatureBytes

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

ToSignatureBytes converts the v, r, s components into the original 65 bytes signature without QID.

func ToSignatureBytesWithQID

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

ToSignatureBytesWithQID converts the v, r, s components into the original 65 bytes signature with QID.

func VerifySignature

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

VerifySignature verifies the signature conforms to the standards.

Types

This section is empty.

Jump to

Keyboard shortcuts

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