-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support signing typed data #1843
Conversation
b7da81f
to
62bb539
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #1843 +/- ##
===========================================
+ Coverage 82.38% 82.41% +0.03%
===========================================
Files 93 94 +1
Lines 3252 3292 +40
Branches 648 655 +7
===========================================
+ Hits 2679 2713 +34
- Misses 267 269 +2
- Partials 306 310 +4
☔ View full report in Codecov by Sentry. |
7e00c8b
to
39211b6
Compare
src/utils/typed-data.ts
Outdated
aci: AciValue, | ||
domain: Domain, | ||
): Buffer { | ||
return hash(concatBuffers([hashDomain(domain), hashJson(aci), hash(decode(data))])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should prefix the calculated hash with a magic number? I see that Ethereum developers care to have not overlapped signing payloads for transactions and other messages, but I don't understand the reasoning. For example,
The initial 0x19 byte is intended to ensure that the signed_data is not valid RLP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think there should be a prefix, though maybe not 0x19 since that was chosen because Ethereum Signed Message:
happens to be 0x19 bytes long...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to define 0x1a00 prefix, with the second byte as a signature type (0x00 for typed data). E.g. 0x1a61 would be a prefix of a signed message the same as in EIP-191. This won't overlap with transaction signatures because they are prefixed with network id that can't contain ASCII control characters (0x1a, substitute).
fca0d71
to
cf8365f
Compare
cf8365f
to
03e54bc
Compare
03e54bc
to
f696255
Compare
closes #1781
found issues aeternity/aepp-calldata-js#215 aeternity/aepp-calldata-js#216 aeternity/aesophia#461
This PR is supported by the Æternity Crypto Foundation