MetaMask / MetaMask/eth-sig-util
Update sign-typed-data.js file to support signTypedData_v4
- Dominant language
- TypeScript
- Stars
- 583
- Forks
- 228
- Avg merge
- 11h 22m
- Merged PRs (30d)
- 7
Description
Update the sanitizeData function to parse data properly using **JSON.parse** and avoid error: **TypeError: Cannot read properties of undefined (reading 'EIP712Domain')**
```
function sanitizeData(unparsedData) {
const data=JSON.parse(unparsedData)
const sanitizedData = {};
for (const key in exports.TYPED_MESSAGE_SCHEMA.properties) {
if (data[key]) {
sanitizedData[key] = data[key];
}
}
if ('types' in sanitizedData) {
sanitizedData.types = Object.assign({ EIP712Domain: [] }, sanitizedData.types);
}
return sanitizedData;
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in sign-typed-data.js at sanitizeData and trace how signTypedData_v4 input reaches it. Confirm the data is parsed before schema filtering and that the EIP712Domain error is avoided; done means v4 data is sanitized without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cryptography
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100