signature

package
v0.0.0-...-a1dc72b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: AGPL-3.0 Imports: 11 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 GetPublicKeyFromSignature

func GetPublicKeyFromSignature(value any, v, r, s *big.Int) (*ecdsa.PublicKey, error)

GetPublicKeyFromSignature extracts the public key for the account that signed the data.

func Hash

func Hash(value any) string

Hash returns a unique string for the value.

func HashWithComicCoinStamp

func HashWithComicCoinStamp(value any) ([]byte, error)

stamp returns a hash of 32 bytes that represents this data. HashWithComicCoinStamp returns the hash of the value with the ComicCoin stamp.

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 comicCoinID.

func ToSignatureBytesWithComicCoinID

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

ToSignatureBytesWithComicCoinID converts the r, s, v values into a slice of bytes keeping the ComicCoin 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