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
path- requiredstring | Array<number>minimum length is3. read moremessageHex- requiredstringmessage to sign in hex textchainId- optionalnumberidentifies 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
}
}