Skip to main content

evmSignMessage

Ethereum: sign message

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

  • This method is for EIP-191 personal_sign messages
  • Do not use it for EIP-712 typed data signing
  • For EIP-712 (v3 / v4), use evmSignTypedData
const result = await HardwareSDK.evmSignMessage(connectId, deviceId, params);

Params

Optional common params

  • path - required string | Array<number> minimum length is 3. read more
  • messageHex - required string message to sign in hex text
  • chainId - optional number identifies the target Ethereum network and helps distinguish different chain configurations. Reference.

Example

// Original message
const message = "Hello Ukey Wallet";

// Convert to hex
const messageHex = Buffer.from(message).toString("hex");

HardwareSDK.evmSignMessage(connectId, deviceId, {
path: "m/44'/60'/0'/0/1",
messageHex: messageHex,
chainId: 1,
});

Result

{
success: true,
payload: {
address: string, // returned address
signature: string,
}
}

Error

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