EVM: check an EIP-712 signature and digest
Task: see what a typed-data signature commits to (domain separator, message hash, digest) and who signed it, offline. Part of the EVM contract recipes.ā¦
ā ļø DANGEROUS: use at your own risk. Code that handles keys and signs transactions should always be read and audited by you before you trust it with real funds. Used incorrectly, it can destroy your money.
Task: see what a typed-data signature commits to (domain separator, message hash, digest) and who signed it, offline. Part of the EVM contract recipes. Real dApp requests: evm-permit2-signing-request.md, evm-check-approval.md.
fixtures/evm/eip712-mail-signed.json is the Mail example from the EIP-712 specification with its published signature:
typed-data-verify recipes/fixtures/evm/eip712-mail-signed.json | jq -c '{primary_type, chain_id, recovered, status}'
A different expected signer is a mismatch (exit 1):
typed-data-verify --signer 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB recipes/fixtures/evm/eip712-mail-signed.json
An eth_signTypedData_v4 request ({"params": [address, typedData]}) can be piped in as-is with --sig; its address
becomes the expected signer. Live (UNTESTED here): capture the request a dApp sends and the signature the wallet returns,
then typed-data-verify --sig 0x⦠request.json.