Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Latest commit

 

History

History
71 lines (62 loc) · 1.61 KB

signMessage.md

File metadata and controls

71 lines (62 loc) · 1.61 KB

Sign message

Asks device to sign a message using the private key derived by given BIP32 path.

ES6

const result = await TrezorConnect.signMessage(params);

CommonJS

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

});

Params

Optional common params

  • pathrequired string | Array<number> minimum length is 3. read more
  • message - required string
  • coin - optional string Determines network definition specified in coins.json file. Coin shortcut, name or label can be used. If coin is not set API will try to get network definition from path.
  • hex - optional boolean convert message from hex

Example

TrezorConnect.signMessage({
    path: "m/44'/0'/0'",
    message: "example message"
});

Result

{
    success: true,
    payload: {
        address: string,   // signer address
        signature: string, // signature in base64 format
    }
}

Error

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

Migration from older version

version 4 and below

TrezorConnect.signMessage("m/44'/0'/0'", "example message", function(result) {
    ...
}, "bitcoin");

version 5

// params are key-value pairs inside Object
TrezorConnect.signMessage({ 
    path: "m/44'/0'/0'",
    message: "example message"
}).then(function(result) {
    ...
})