pkg

package
v0.0.0-...-a9dced0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseVerifyTxt

func ParseVerifyTxt(fn string) (string, string, string, error)

ParseVerifyTxt takes the opendime verify.txt format and returns address, signature, message based on https://github.com/richardkiss/pycoin/blob/main/pycoin/contrib/msg_signing.py

func ToWif

func ToWif(prefixHex string, secretHex string, compress bool) string

ToWif encode a WIF given the prefix, secret exponent hex and compression flag

func ValidateSignature

func ValidateSignature(signature string) ([]byte, error)

ValidateSignature takes a Bitcoin/Litecoin encoded signature and returns the 65 byte DER encoded bytes

func ValidateWif

func ValidateWif(key string) (string, string, bool, error)

ValidateWif validate WIF is valid and return decoded mode (Bitcoin/Litecoin) secret exponent hex and isCompressed (and error)

Types

type Addresses

type Addresses struct {
	Original                string
	BitcoinP2PKH            string
	BitcoinP2PKHCompressed  string
	BitcoinP2WPKH           string
	Ethereum                string
	LitecoinP2PKH           string
	LitecoinP2PKHCompressed string
	LitecoinP2WPKH          string
	DogecoinP2PKH           string
	UncompressedHex         string
	CompressedHex           string
}

Addresses struct for GetAddresses response

func GetAddresses

func GetAddresses(message VerifiedMessage) (Addresses, error)

GetAddresses get addresses from a verified message (only public key is needed)

type VerifiedMessage

type VerifiedMessage struct {
	Address      string
	Signature    []byte
	Message      []byte
	IsValid      bool
	PublicKeyHex string
}

VerifiedMessage struct holds response from ValidateSignature

func VerifyMessage

func VerifyMessage(address string, signature string, message string) (VerifiedMessage, error)

VerifyMessage wrapper for VerifySignature that accepts strings for signature and message signature will be in Bitcoin base58 format and message as string

func VerifySignature

func VerifySignature(address string, signature []byte, message []byte) (VerifiedMessage, error)

VerifySignature takes an address, signature and message and returns VerifiedMessage

Jump to

Keyboard shortcuts

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