-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to web3.eth.sign
(and web3.personal.sign
)
#289
Comments
Another option to consider is following the web3.js v1 beta model with several signature options:
|
Since The docs seem to disagree that it expects the hash:
Some people have taken to hashing their message before signing it (resulting in being hashed twice, with the prefix the second time). It's pretty surprising to me that there's no |
Hah, yeah, Opened #301 for option # 1 above. I'm still on the fence about the other super-non-standard methods. |
IMO, there's too much disagreement about the
If I'm missing something, please reopen. |
👍 |
What was wrong?
The current implementation of
web3.eth.sign
is confusing and very difficult to use, as well as being very easy to use wronglyHow can it be fixed?
I propose the following options for fixing this. Given the broken-ness of this API, a breaking change should be fine but we should strive to provide some level of deprecation warnings if possible.
1. Change API to accept the full message.
The
web3.*.sign
methods should be changed to expect the full unhashed message.2. Change to use
bytes
as the default encoding.The
web3.*.sign
methods should expect the message to be encoded asbytes
by default. This should be validated.The method should take an optional second parameter which allows for alternately encoded messages. We should support the
bytes
,utf8
andhex
encodings.The text was updated successfully, but these errors were encountered: