signature

package
v0.0.0-...-ce930bf Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package signature provides helper functions for handling the blockchain signature needs.

Index

Constants

View Source
const ZeroHash string = "0x0000000000000000000000000000000000000000000000000000000000000000"

ZeroHash represents a hash code of zeros.

Variables

This section is empty.

Functions

func FromAddress

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

FromAddress extracts the address for the account that signed the data.

func Hash

func Hash(value any) string

Hash returns a unique string for the value.

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 as a string.

func ToSignatureBytes

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

ToSignatureBytes converts the r, s, v values into a slice of bytes with the removal of the ardanID.

func ToSignatureBytesWithArdanID

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

ToSignatureBytesWithArdanID converts the r, s, v values into a slice of bytes keeping the Ardan id.

func ToVRSFromHexSignature

func ToVRSFromHexSignature(sigStr string) (v, r, s *big.Int, err error)

ToVRSFromHexSignature converts a hex representation of the signature into its R, S and V parts.

func VerifySignature

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

VerifySignature verifies the signature conforms to our standards.

Types

This section is empty.

Jump to

Keyboard shortcuts

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