verifyFromAddress method
Verify that this message was signed by the owner of corresponding Address in address
address
- The Address we want to use for signature verification. NOTE :
this is the address derived from the public key, which belongs to the private key used to sign this message.
sigBuffer
- The base64-encoded Signature
Returns true if the signature was successfully verified using the address, false otherwise.
Implementation
bool verifyFromAddress(Address address, String sigBuffer) {
SVSignature signature = SVSignature.fromCompact(base64Decode(sigBuffer), this.magicHash());
SVPublicKey recoveredPubKey = signature.publicKey;
Address recoveredAddress = recoveredPubKey.toAddress(address.networkType);
//sanity check on address
if (address.toBase58() != recoveredAddress.toBase58()) {
return false;
}
return this._verify(signature);
}