-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
accounts: eip-712 signing for ledger #22378
Conversation
a830a23
to
e173a5d
Compare
I don't know if another API-method is really needed. Clef already supports this, by using the |
e173a5d
to
dd86f82
Compare
The problem is that ledgers won't sign arbitrary data, it will only take the two 32-byte strings |
Isn't that more or less what clef does too: go-ethereum/signer/core/signed_data.go Line 335 in 7a3c890
|
right, only it would be deconstructing that information, rather than building it.
|
a2c4368
to
cf90d37
Compare
somthing like this @holiman , what do you think? |
cf90d37
to
033cf25
Compare
return nil, err | ||
} | ||
return signature, nil | ||
} |
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.
This whole clause is more or less a copy-paste of SignTx
. Is there any way it can be refactored so they both reuse the whole dance around commsLock
and account-lookup and stuff, and not have the same code duplicated?
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.
Hmm, I'm not sure exactly how to do this, since the defer
ed functions are relative to the scope of the surrounding function. Do you have an idea?
Thank you @holiman for the review. Besides the refactoring of the |
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.
LGTM
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
* accounts: eip-712 signing for ledger * address review comments
Adds a new method
SignTypedMessage
to theaccounts.Wallet
type which enables EIP-712 signing with ledgers. For other wallet types it simply falls back to signHash.Support for 712 style signatures was introduced in v1.5.0 of the ledger firmware, and is specified at https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.asc#sign-eth-eip-712.
This PR does not expose the
SignTypedMessage
to clef or anywhere else, I mainly wanted it in ethsign which is really just a cli wrapper around these parts of the geth code.I don't really know golang so bare with me here... At least I'm able to successfully perform EIP-712 signatures with a ledger with this PR.