跳到主要内容

confluxSignMessage

使用要求

  • 固件版本要求
    • UKey Lite 24 / UKey Lite 25: 1.1.0
    • UKey Core 26: 1.1.0

Conflux:签名消息

使用指定 BIP32 路径派生的私钥对消息进行签名。签名前请确保消息内容和业务场景清晰可验证。

const result = await HardwareSDK.confluxSignMessage(
connectId,
deviceId,
params,
);

参数

可选通用参数

  • path - 必需 string | Array<number>,字符串数组最小长度限制为 3更多信息
  • messageHex - 必需 string,以十六进制文本表示的待签名消息。

示例

// 原始消息内容
const message = "Hello Conflux";

// 转换为十六进制消息
const messageHex = Buffer.from(message).toString("hex");

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

返回结果

{
success: true,
payload: {
signature: string; // 签名结果
address: string; // 返回的地址
}
}

错误

{
success: false,
payload: {
error: string, // 错误消息
code: number // 错误码
}
}