Documentation ¶
Overview ¶
Package signature provides helper functions for handling the blockchain signature needs. Special thanks: https://raw.githubusercontent.com/ardanlabs/blockchain/refs/heads/main/foundation/blockchain/signature/signature.go
Index ¶
- Constants
- func FromAddress(value any, v, r, s *big.Int) (string, error)
- func GetPublicKeyFromSignature(value any, v, r, s *big.Int) (*ecdsa.PublicKey, error)
- func Hash(value any) string
- func HashWithComicCoinStamp(value any) ([]byte, error)
- func Sign(value any, privateKey *ecdsa.PrivateKey) (v, r, s *big.Int, err error)
- func SignatureString(v, r, s *big.Int) string
- func ToSignatureBytes(v, r, s *big.Int) []byte
- func ToSignatureBytesWithComicCoinID(v, r, s *big.Int) []byte
- func ToVRSFromHexSignature(sigStr string) (v, r, s *big.Int, err error)
- func VerifySignature(v, r, s *big.Int) error
Constants ¶
const ZeroHash string = "0x0000000000000000000000000000000000000000000000000000000000000000"
ZeroHash represents a hash code of zeros.
Variables ¶
This section is empty.
Functions ¶
func FromAddress ¶
FromAddress extracts the address for the account that signed the data.
func GetPublicKeyFromSignature ¶
GetPublicKeyFromSignature extracts the public key for the account that signed the data.
func HashWithComicCoinStamp ¶
func SignatureString ¶
SignatureString returns the signature as a string.
func ToSignatureBytes ¶
ToSignatureBytes converts the r, s, v values into a slice of bytes with the removal of the comicCoinID.
func ToSignatureBytesWithComicCoinID ¶
ToSignatureBytesWithComicCoinID converts the r, s, v values into a slice of bytes keeping the ComicCoin id.
func ToVRSFromHexSignature ¶
ToVRSFromHexSignature converts a hex representation of the signature into its R, S and V parts.
func VerifySignature ¶
VerifySignature verifies the signature conforms to our standards.
Types ¶
This section is empty.