Static
Private
bitcoinWraps the Bitcoin message verification process to avoid throwing exceptions. This method attempts to verify a BIP-137 message using the provided address and signature. It encapsulates the verification process within a try-catch block, catching any errors that occur during verification and returning false instead of allowing the exception to propagate.
The process is as follows:
bitcoinjs-message.verify
function is called with the message, address,
and signature provided in Base64 encoding.The Bitcoin message to be verified.
The Bitcoin address to which the message is allegedly signed.
The Base64 encoded signature corresponding to the message.
boolean Returns true if the message is successfully verified, otherwise false.
Static
Private
getCompute the hash to be signed for a given P2SH-P2WPKH BIP-322 toSign transaction.
PSBT instance of the toSign transaction
Hashed public key of the signing address
Computed transaction hash that requires signing
Static
Private
getCompute the hash to be signed for a given P2TR BIP-322 toSign transaction.
PSBT instance of the toSign transaction
Hash type used to sign the toSign transaction, must be either 0x00 or 0x01
Computed transaction hash that requires signing
Error if hashType is anything other than 0x00 or 0x01
Static
Private
getStatic
Private
verifyBIP137Verify a legacy BIP-137 signature. Note that a signature is considered valid for all types of addresses that can be derived from the recovered public key.
Address of the signing address
message_challenge signed by the address
Signature produced by the signing address
If true, apply strict BIP-137 verification and enforce address flag verification; otherwise, address flag is ignored during verification
True if the provided signature is a valid BIP-137 signature for the given message and address, false if otherwise
If the provided signature fails basic validation, or if unsupported address and signature are provided
Static
verifyVerify a BIP-322 signature from P2WPKH, P2SH-P2WPKH, and single-key-spend P2TR address.
Address of the signing address
message_challenge signed by the address
Signature produced by the signing address
If true, apply strict BIP-137 verification and enforce address flag verification; otherwise, address flag is ignored during verification
True if the provided signature is a valid BIP-322 signature for the given message and address, false if otherwise
If the provided signature fails basic validation, or if unsupported address and signature are provided
Class that handles BIP-322 signature verification. Reference: https://github.com/LegReq/bip0322-signatures/blob/master/BIP0322_verification.ipynb