You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Calling the personal_sign RPC method with a hex string causes the MetaMask signature confirmation popup window to display garbled text, because it interprets the string as UTF8.
Expected behavior
As far as I can tell, the message argument passed to personal_sign is interpreted by MetaMask as a UTF8-encoded string cast to hex (e.g., to sign 'test', one would pass '0x' + Buffer.from('test', 'utf8').toString('hex') i.e. 0x74657374).
My expectation is that 32-byte hex strings passed to personal_sign, e.g. 0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658 should be interpreted as such, and displayed accordingly in the signature window.
Note that despite displaying the incorrect text, the resulting signature is correct, and can be verified using Solidity's ecrecover and code like the following:
Browser details (please complete the following information):
Chrome: Version 69.0.3497.100 (Official Build) (64-bit)
OS: macOS High Sierra 10.13.6 (17G65)
MetaMask: 4.13.0
UI: New/Beta
The text was updated successfully, but these errors were encountered:
@bitpshr when you get a chance would you mind checking this out? It's an easy repro/clear bug, and is significantly affecting UX on a MetaMask site I'm working on :)
Describe the bug
Calling the
personal_sign
RPC method with a hex string causes the MetaMask signature confirmation popup window to display garbled text, because it interprets the string as UTF8.To Reproduce
Expected behavior
As far as I can tell, the
message
argument passed topersonal_sign
is interpreted by MetaMask as a UTF8-encoded string cast to hex (e.g., to sign'test'
, one would pass'0x' + Buffer.from('test', 'utf8').toString('hex')
i.e.0x74657374
).My expectation is that 32-byte hex strings passed to
personal_sign
, e.g.0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658
should be interpreted as such, and displayed accordingly in the signature window.Note that despite displaying the incorrect text, the resulting signature is correct, and can be verified using Solidity's
ecrecover
and code like the following:Screenshots
Browser details (please complete the following information):
Chrome: Version 69.0.3497.100 (Official Build) (64-bit)
OS: macOS High Sierra 10.13.6 (17G65)
MetaMask: 4.13.0
UI: New/Beta
The text was updated successfully, but these errors were encountered: