verifyMessageV2

Returns whether the provided signature data matches the provided message and was signed by the account of the provided public key. For the complete verification process, please go to Testbed.

Input Arguments

Parameter
Description

message: string

Salt prefix + original message

data: string

Signed message

publicKey: string

Public key of account that signed message

Success Response

Parameter
Description

result: boolean

Whether the provided signature matches the provided message and public key

Error Response

Parameter
Description

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neolineN3.verifyMessageV2({
  message: '543e66d70a56506f0a69aff35f25f794Hello world',
  data: '4fef4abd1ced91577c89eac7909b89ec2aa3d073178c51c3074b7bc5551093b00bf274f35f8166931dc90cbd88346729e86e0bf1c3014fa3587cc167f0cafd4c',
  publicKey: '023e72b8b5a20c00dac7ac01ecd72354a2d7d64620d6615524bb18b9f5a6ca8ef4'
})
.then(result => {
  console.log('Signature data matches provided message and public key: ' + JSON.stringify(result));
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'NO_PROVIDER':
        console.log('No provider available.');
        break;
    case 'CONNECTION_DENIED':
        console.log('The user rejected the request to connect with your dApp');
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

{
  result: true
}

最后更新于