Validate signed message

Example

validateSignedMessage function can take multiple input parameters, first parameter is JSON object, which is required, second parameter is wallet address (optional) used for signing and third parameter is signed message (optional).

const { signMessage, validateSignedMessage } = require('obyte/lib/utils');
const address_wif = '';
const wallet_address = 'TMWNLXR42CKIP4A774BQGNVBZAPHY7GH';
const message = 'Hello world';

const objSignedMessage = signMessage(message, address_wif);

console.log(validateSignedMessage(objSignedMessage, wallet_address, message));
console.log(validateSignedMessage(objSignedMessage, null, message));
console.log(validateSignedMessage(objSignedMessage));

Returns

Returns boolean true if signed message is valid, otherwise boolean false.

Last updated