MetaMask / MetaMask/eth-sig-util

`signTypedData` ambiguous input encoding

Open
#210 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
583
Forks
228
Avg merge
11h 22m
Merged PRs (30d)
7

Description

[EIP-712](https://eips.ethereum.org/EIPS/eip-712) does not currently specify how the inputs to the `eth_signTypedData` JSON-PRC method should be encoded. For example, it doesn't say whether to encode `boolean` values as `true` and `false`, or `0`, and `1`, or as the strings `"true"` and `"false"`. Different assumptions have been made about how to interpret inputs between `eth_signTypedData` implementations, leading to incompatible implementations with no clear "correct" answer for how input data should be interpreted.

It seems clear to me that EIP-712 should be amended to include guidance on the expected input encoding. But in the meantime, we should at least be clear about what our expectations are in this library, so that users don't get a different encoding than they expect. We should clearly document our expectations, eliminate any potential ambiguity about how to interpret inputs, and include validation to help users correctly format their inputs wherever possible.

These changes may not be possible with existing `signTypedData` versions, so these improvements will be made solely on `signTypedData_v5` (at least for now).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the signTypedData_v5 implementation and its existing tests. Read the EIP-712 encoding guidance and determine the library's expected input representations, then document those expectations and add validation where possible. Done means v5 behavior is unambiguous and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.