Skip to content
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

New message signing API #58

Closed
carver opened this issue Mar 22, 2019 · 0 comments · Fixed by #61
Closed

New message signing API #58

carver opened this issue Mar 22, 2019 · 0 comments · Fixed by #61
Assignees

Comments

@carver
Copy link
Contributor

carver commented Mar 22, 2019

What was wrong?

Message signing should be very pluggable according to EIP191. Message encoding is all built-in to the (now confusingly named) defunct_hash_message().

How can it be fixed?

New message signing API that captures this concept:

class SignableMessage(NamedTuple):  # as defined by EIP-191
  version: HexBytes  # must be length 1
  header: HexBytes  # aka "version specific data"
  body: HexBytes  # aka "data to sign"

signable_message = encode_structured_data_message(json_str)
account.sign_message(signable_message)

The encoding method could have arbitrary inputs without changing the message signing API, like:

signable_message = encode_intended_validator(message, validator_address)
account.sign_message(signable_message)

It abstracts away the EIP-191 encoding process and message hashing inside sign_message(). A new recover_message() could work similarly.

The solution should make it trivial to experiment with or produce your own (sub)version of EIP-191, without any change to the eth-account library. (This is already possible by signing and recovering hashes of your own making, but it's not as accessible).

@carver carver self-assigned this Mar 22, 2019
@carver carver mentioned this issue Apr 26, 2019
4 tasks
@carver carver closed this as completed in #61 May 3, 2019
pacrob pushed a commit to pacrob/eth-account that referenced this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant