signMessageWithoutSaltV2

Signs a provided messaged with an account selected by user. It is encased in a non-executable transaction before signed. This ensures compatibility with Ledger devices. For the complete signing process, please go to Testbed.

Input Arguments

ParameterDescription

message: string

The message to sign

isJsonObject?: boolean

Whether message is a json object

Success Response

ParameterDescription

publicKey: string

Public key of account that signed message

data: string

Original message signed

message: string

Signed message

Error Response

ParameterDescription

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.signMessageWithoutSaltV2({
  message: 'Hello world'
})
.then(signedMessage => {
  const {
    publicKey,
    message,
    data
  } = signedMessage;

  console.log('Public key used to sign:', publicKey);
  console.log('Original message:', message);
  console.log('Signed data:', data);
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'UNKNOWN_ERROR':
        console.log(description);
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

{
  publicKey: '023e72b8b5a20c00dac7ac01ecd72354a2d7d64620d6615524bb18b9f5a6ca8ef4',
  data: '1e810cc032025011df057e99245eece3b7697c27e9b482400130bab576c09f30d9f3bb4414de9ffa623241b231e81d1f089522d1520fb1fdf6c6f34cf9aac7d9',
  message: 'Hello world'
}

最后更新于