generic

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: ISC Imports: 14 Imported by: 0

Documentation

Overview

Package generic holds all the relevant tools to actually build and validate signed message made by older signed message implementations.

For more information, refer: https://en.bitcoin.it/wiki/Message_signing#Message_verification_method

Index

Constants

View Source
const ExpectedSignatureLength = 65

ExpectedSignatureLength contains the fixed signature length all signed messages are expected to have.

Variables

This section is empty.

Functions

func GeneratePublicKeyHash

func GeneratePublicKeyHash(recoveryFlag int, publicKey *btcec.PublicKey) []byte

GeneratePublicKeyHash returns the public key hash, either compressed or uncompressed, depending on the recovery flag.

func ValidateP2PKH

func ValidateP2PKH(recoveryFlag int, pubkeyHash []byte, addr btcutil.Address, net *chaincfg.Params) (bool, error)

ValidateP2PKH ensures that the passed P2PKH address matches the address generated from the public key hash, recovery flag and network.

func ValidateP2SH

func ValidateP2SH(recoveryFlag int, pubkeyHash []byte, addr btcutil.Address, net *chaincfg.Params) (bool, error)

ValidateP2SH ensures that the passed P2SH address matches the address generated from the public key hash, recovery flag and network.

func ValidateP2TR

func ValidateP2TR(recoveryFlag int, pubKey *btcec.PublicKey, addr btcutil.Address, net *chaincfg.Params) (bool, error)

ValidateP2TR ensures that the passed P2TR address matches the address generated from the public key hash, recovery flag and network.

Only addresses without a tapscript are allowed becausethe verification is using the internal key.

func ValidateP2WPKH

func ValidateP2WPKH(recoveryFlag int, pubkeyHash []byte, addr btcutil.Address, net *chaincfg.Params) (bool, error)

ValidateP2WPKH ensures that the passed P2WPKH address matches the address generated from the public key hash, recovery flag and network.

func Verify

func Verify(address btcutil.Address, message string, signatureDecoded []byte, net *chaincfg.Params) (bool, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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