verify
Checks a signature from sign().
Parameter | Description |
|---|---|
| The object returned by |
| A pair object with the signer's |
| Optional function that receives the result. Leave it out to |
Returns the original message if the signature is valid, or null if it isn't.
Examples
// With await. Only the public key is needed to verify.
const pair = await holster.SEA.pair()
const signed = await holster.SEA.sign("hello self", pair)
const verified = await holster.SEA.verify(signed, {pub: pair.pub})
console.log(verified) // "hello self"
// With a callback.
holster.SEA.verify(signed, {pub: pair.pub}, verified => {
if (verified === null) console.error("invalid signature")
})