Error: You cannot sign hex strings using sign message #189
-
SummaryWhen passing in a Uint8Array representing a 32 byte hex string the Phantom wallet is unable to sign it as a message and throws Examplehttps://github.com/matt-user/sign_message_repro/tree/main/my-app Steps to ReproduceIf you go to my github repro in the my-app folder run: npm install, npm start, and then click sign message. I also use tweetnacl to show that is possible to sign this uint8array. Phantom Version24.3.0 Is there an existing discussion for this?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Hey @matt-user, apologies for the delayed response. Can you give me a better idea of what is encoded in this string? |
Beta Was this translation helpful? Give feedback.


Phantom's
signMessagefunction on its Solana provider will always check if the input could be decoded as a Solana transaction. If it can be, Phantom will reject with this error message. We do this to protect users from malicious Solana dapps that try and pass transactions tosignMessage, when they should be usingsignAndSendTransactioninstead.Solana does not currently support any initiatives like EIP-2612 that delegate spending with just a signed message. If you're looking for something like that, I would suggest leveraging our Ethereum provider instead.