ecdsa – After signing a message, the right way to confirm the signature with JavaScript/TypeScript? – CoinNewsTrend

ecdsa – After signing a message, the right way to confirm the signature with JavaScript/TypeScript?


On the frontend, consumer indicators an arbitrary message (e.g., “Signal this message to show that you simply personal this pockets”). We are able to do that by way of, for instance, UniSat’s signMessage perform (see right here).

I wish to confirm this message on the backend. I would like one thing like this:

perform verifySignature(message: string, deal with: string, signature: string): boolean

Methods to obtain this? Be aware that it is deal with as a substitute of publicKey that’s within the perform parameter record.

I do know Bitcoin pockets Apps or browser extensions use ECDSA to signal a message (or extra exactly, the SHA256 digest of the message), however the signing processes differ amongst varied sorts of Bitcoin deal with (P2PKH, P2SH, P2WPKH, P2WSH, P2TR). So I would like some JavaScript/TypeScript packages that may do that robustly as a substitute of implementing alone.



Supply hyperlink