verifyMessage

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.verifyMessage({
  message: '42e038cec78bed9f1e503c4b23254b23Hello world',
  data: 'be506bf7e6851960bfe45968bf5dbbf79a9dc5dc63ee5b88629acfb288c435649c2766e977d4bc76253d8590bb3ca3d9b70efd71d6f7eebdf060dfa58c6601fd',
  publicKey: '03ba9524bd7479414be713c3a4f6f3ef35f90bb4b08f0f552211bf734c24415230'
})
.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
}

最后更新于