Documentation ¶
Index ¶
- Constants
- func AllFlags() []int
- func CompressedFlags() []int
- func CreateMagicMessage(message string) string
- func CreateMagicMessageBIP322(message []byte) [32]byte
- func ElectrumP2SHAndP2WPKHFlags() []int
- func ElectrumP2WPKHFlags() []int
- func GetKeyID(recoveryFlag int) int
- func ParsePublicKey(pubKeyHex string) (*secp2561k1.PublicKey, error)
- func ParseSignature(signature string) ([]byte, error)
- func ParseWitnessSignatureBIP322(sigBytes []byte) ([][]byte, error)
- func RecoverPublicKey(message string, signatureDecoded []byte) (*secp2561k1.PublicKey, error)
- func SHA256(data []byte) (hash []byte)
- func ShouldBeCompressed(recoveryFlag int) bool
- func TrezorFlags() []int
- func TrezorP2SHAndP2WPKHFlags() []int
- func TrezorP2WPKHFlags() []int
- func UncompressedFlags() []int
Constants ¶
const BIP322Tag = "BIP0322-signed-message"
Signed message via BIP-322 are prepended with this bip322Tag Taken from https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki#full
const ECDSASignatureLen = 65
const MagicMessage = "\x18Bitcoin Signed Message:\n"
Signed message are prepended with this magicMessage Taken from https://bitcoin.stackexchange.com/a/77325
Variables ¶
This section is empty.
Functions ¶
func AllFlags ¶
func AllFlags() []int
All returns every possible recovery flag, taken from https://github.com/btclib-org/btclib/blob/v2022.7.20/btclib/ecc/bms.py#L83
func CompressedFlags ¶
func CompressedFlags() []int
Compressed returns all compressed recovery flags.
func CreateMagicMessage ¶
CreateMagicMessage builds a properly signed message.
func CreateMagicMessageBIP322 ¶
CreateMagicMessageBIP322 builds a properly signed message (in BIP-322 format).
func ElectrumP2SHAndP2WPKHFlags ¶
func ElectrumP2SHAndP2WPKHFlags() []int
ElectrumP2SHAndP2WPKH returns all P2SH-P2WPKH recovery flags related to Electrum.
func ElectrumP2WPKHFlags ¶
func ElectrumP2WPKHFlags() []int
ElectrumP2WPKH returns all P2WPKH recovery flags related to Electrum.
func GetKeyID ¶
GetKeyID returns the Key ID for a specified recovery flag Taken from https://github.com/btclib-org/btclib/blob/v2023.7.12/btclib/ecc/bms.py#L302
func ParsePublicKey ¶
func ParsePublicKey(pubKeyHex string) (*secp2561k1.PublicKey, error)
ParsePublicKey parses a public key from a hex string
func ParseSignature ¶
ParseSignature is a convenience function to parse a signature from a hex or base64 string
func RecoverPublicKey ¶
func RecoverPublicKey(message string, signatureDecoded []byte) (*secp2561k1.PublicKey, error)
Based on https://github.com/BitonicNL/verify-signed-message/blob/main/internal/generic/verify.go
func ShouldBeCompressed ¶
ShouldBeCompressed returns if a recovery flag signals a compressed key Taken from https://github.com/btclib-org/btclib/blob/v2023.7.12/btclib/ecc/bms.py#L305
func TrezorP2SHAndP2WPKHFlags ¶
func TrezorP2SHAndP2WPKHFlags() []int
TrezorP2SHAndP2WPKH returns all P2SH-P2WPKH recovery flags related to Trezor.
func TrezorP2WPKHFlags ¶
func TrezorP2WPKHFlags() []int
TrezorP2WPKH returns all P2WPKH recovery flags related to Trezor.
func UncompressedFlags ¶
func UncompressedFlags() []int
Uncompressed returns all uncompressed recovery flags.
Types ¶
This section is empty.