The current draft of EIP-712 says:
Specification of the
eth_signTypedDataJSON RPCThe method
eth_signTypedDatais added to the Ethereum JSON-RPC. The method parallelseth_sign.eth_signTypedData
The sign method calculates an Ethereum specific signature with:
sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).
I don’t understand the last line. Isn’t this supposed to be
sign(keccak256("\x19\x01" + domainSeparator + hashStruct(message)))
instead, as described in the “Specification” section above? The listed
definition describes eth_sign, not the new eth_signTypedData, and
does not seem consistent with Ethers’s TypedDataEncoder.encode (as
used in the Wallet implementation of Signer._signTypedData), nor
with OpenZeppelin’s ECDSA.toTypedDataHash.
Is this a copy-paste error in the spec, or am I missing something?