Consensys / web3signer

Web3Signer is an open-source signing service capable of signing on multiple platforms (Ethereum1 and 2, Filecoin) using private keys stored in an external vault, or encrypted on a disk.
https://docs.web3signer.consensys.net/
Apache License 2.0
201 stars 78 forks source link

EIP-712: Support to sign typed data with prefix \x19\x01 #1012

Open kripa432 opened 4 months ago

kripa432 commented 4 months ago

EIP-712: https://eips.ethereum.org/EIPS/eip-712

EIP-712 add support to sign typed data. There are three format to encode the data

encode(transaction : 𝕋) = RLP_encode(transaction)
encode(message : 𝔹⁸ⁿ) = "\x19Ethereum Signed Message:\n" β€– len(message) β€– message
encode(domainSeparator : 𝔹²⁡⁢, message : π•Š) = "\x19\x01" β€– domainSeparator β€– hashStruct(message)

893 add support to sign typed data, but the documentation states it signs with prefix \x19Ethereum Signed Message:\n

Running the curl command given in documentation, gives the following error.

Command

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_signTypedData","params":["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", {"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":1,"verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","wallet":"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"},"contents":"Hello, Bob!"}}],"id":1}' http://localhost:9000

Result

{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Internal error"}}

Does the web3signer, supports 3rd format with prefix \x19\x01?

usmansaleem commented 4 months ago

@kripa432 Thank you for reporting this, let me try to reproduce and analyse it and will report back.