Skip to content

[Bug]: personal_sign should expect a hex string instead of a plain string #170

@ly0va

Description

@ly0va

🧰 Project

SDK

📝 Description

In the passkey client, the signMessage method (aka personal_sign) expects a plain string (not a hex string) to sign. However, Metamask's API - a de-facto standard for wallet APIs - expects a hex string.

This will cause issues as the interface will deviate from that of other wallets.

🔄 Reproduction steps

const message = "Hello world";
const messageToSign = stringToHex(message);

const signature = await provider.request({
  method: "personal_sign",
  params: [messageToSign, account.address],
});

const isValidSignature = await verifyMessage({
  message,
  signature,
  address: account.address,
});

🤔 Expected behavior

isValidSignature should be true, but it is false.
However, if we instead pass the hexed version of the message into verifyMessage, it returns true.

😯 Actual behavior

No response

🖥 Environment

No response

📋 Additional context

No response

📎 Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions