nostrDecryptMessage
使用要求
- 固件版本要求
- UKey Lite 24 / UKey Lite 25: 1.1.0
- UKey Core 26: 1.1.0
Nostr:解密消息
使用指定 BIP32 路径派生的私钥解密消息,用户需要在 Ukey Wallet 上确认操作。
const result = await HardwareSDK.nostrDecryptMessage(
connectId,
deviceId,
params,
);
参数
path- 必需string | Array<number>,字符串数组最小长度限制为3。更多信息pubkey- 必需string,公钥。ciphertext- 必需string,加密后的消息内容。showOnUKey- 可选boolean,决定是否在设备上显示地址;默认值为true。
示例
const response = await HardwareSDK.nostrDecryptMessage(connectId, deviceId, {
path: "m/44'/1237'/1'/0/0",
pubkey: "9f3c72b4a8d1e67f20cb59d4ef1836aa74d05bc98e1a43f26b7d9c4e5fa8123d",
ciphertext: "QmVzdF9Ob3N0cl9NZXNzYWdl?iv=Y3VzdG9tX2luaXRfdmVjdG9y",
showOnUKey: true,
});
返回结果
{
success: true,
payload: {
path: string, // 使用的 BIP32 路径
pubkey: string, // 对方公钥
ciphertext: string, // 加密后的消息
decryptedMessage: string, // 解密后的消息
}
}
错误
{
success: false,
payload: {
error: string, // 错误消息
code: number // 错误码
}
}