Skip to content

Latest commit

 

History

History
80 lines (71 loc) · 2.15 KB

ethereumVerifyMessage.md

File metadata and controls

80 lines (71 loc) · 2.15 KB

Ethereum: verify message

Asks device to verify a message using the signer address and signature.

ES6

const result = await TrezorConnect.ethereumVerifyMessage(params);

CommonJS

TrezorConnect.ethereumVerifyMessage(params).then(function(result) {

});

Params

Optional common params

  • address - obligatory string signer address. "0x" prefix is optional
  • message - obligatory string signed message in plain text
  • hex - optional boolean convert message from hex
  • signature - obligatory string signature in hexadecimal format. "0x" prefix is optional

Example

TrezorConnect.ethereumVerifyMessage({
    address: "0xdA0b608bdb1a4A154325C854607c68950b4F1a34",
    message: "Example message",
    signature: "11dc86c631ef5d9388c5e245501d571b864af1a717cbbb3ca1f6dacbf330742957242aa52b36bbe7bb46dce6ff0ead0548cc5a5ce76d0aaed166fd40cb3fc6e51c",
});

Result

{
    success: true,
    payload: {
        message: "Message verified"
    }
}

Error

{
    success: false,
    payload: {
        error: string // error message
    }
}

Migration from older version

version 4 and below

var address = "dA0b608bdb1a4A154325C854607c68950b4F1a34"; 
var signature = "11dc86c631ef5d9388c5e245501d571b864af1a717cbbb3ca1f6dacbf330742957242aa52b36bbe7bb46dce6ff0ead0548cc5a5ce76d0aaed166fd40cb3fc6e51c"; 
TrezorConnect.ethereumVerifyMessage(
    address, // address without "0x" prefix
    signature, // signature without "0x" prefix
    "Example message",
    function(result) {
        // result not changed
    }
);

version 5

// params are key-value pairs inside Object
TrezorConnect.ethereumVerifyMessage({ 
    address: "0xdA0b608bdb1a4A154325C854607c68950b4F1a34",
    signature: "0x11dc86c631ef5d9388c5e245501d571b864af1a717cbbb3ca1f6dacbf330742957242aa52b36bbe7bb46dce6ff0ead0548cc5a5ce76d0aaed166fd40cb3fc6e51c",
    message: "Example message"
}).then(function(result) {
    // result not changed
})