Closed HRK44 closed 1 year ago
Signature.fromCompact(signatureHex).addRecoveryBit(rec).recoverPublicKey(msg)
Ok thanks @paulmillr,
Could I just do:
const msgHash = bip0322Hash(message);
const signature = secp.etc.hexToBytes(signatureStr);
const publicKey = secp.etc.hexToBytes(publicKeyStr);
const msgHash2 = secp.etc.hexToBytes(msgHash);
const isValid = secp.verify(signature, msgHash2, publicKey);
console.log(isValid);
?
There is no need to convert from hex to bytes, you can just pass hex.
I have a signature without having the private key - and I want to verify that it was signed by the public key that claims the signature. I used to do :
recoverPublicKey(msg, sig, rec)
but now it has changed tosig.recoverPublicKey(msg)
.How do I initialize the
Signature
since it seems that constructor only takes 2 big ints as params (and not a buffer/string).