web icon indicating copy to clipboard operation
web copied to clipboard

Support EIP-712 structured signing

Open gomesalexandre opened this issue 2 years ago • 1 comments

Overview

See https://github.com/shapeshift/web/issues/5138 for original issue.

We want to be able to support actual EIP-712 signing i.e eth_signTypedData_v4 scheme. We currently only support personal_sign i.e good old regular unstructured signing.

The obvious first consumer of this will be CoW swapper, for which signing requests will be able to be displayed in a structured way vs. the hashed digest currently.

References and additional details

MM signing schemes docs: https://docs.metamask.io/wallet/how-to/sign-data/ CoW reference PR with a fallback to personal_sign: https://github.com/gnosis/cowswap/pull/576

Acceptance Criteria

  • CoW swapper uses eth_signTypedData_v4 if available in the current hdwallet (note, this isn't implemented yet and the guts of this will be hdwallet implementation)
  • personal_sign is still working as before, and this is brought as a non-breaking change, with the possibility to choose a signing scheme, but no runtime change for current consumooors, except CoW swapper
  • This should be implemented in hdwallet for all wallets in which eth_signTypedData_v4 works (possibly all?), and properly have feature capabilities as off for others.
  • eth_signTypedData_v4 is not the default option, rather consumers are able to select a signing scheme. personal_sign is still the default, in case no signing scheme is selected
  • When trying to do an eth_signTypedData_v4 call, failures are properly handled with a fallback to personal_sign
    • For MetaMask, eth_signTypedData_v4 should be intented but may fail, because Ledger and Trezor through MM do not support eth_signTypedData_v4, see https://docs.metamask.io/wallet/how-to/sign-data/

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

gomesalexandre avatar Dec 20 '23 20:12 gomesalexandre

Will implement when cowswap volume goes parabolic.

twblack88 avatar May 13 '24 22:05 twblack88

@gomes to take a look at this for portals.

0xean avatar Jul 24 '24 22:07 0xean