Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new component that implements Typed Data V4 signing with an added salt parameter to mitigate a known bug. Key changes include:
- The addition of the signTypedDataV4WithSaltComponent in src/index.js.
- A new UI component in src/components/signatures/signTypedDataV4-sign-with-salt.js that provides signing and verification controls.
- Exporting the new component in src/components/signatures/index.js.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/index.js | Imported and invoked the new signTypedDataV4WithSaltComponent. |
| src/components/signatures/signTypedDataV4-sign-with-salt.js | Added a new component for signing/verification with salt. |
| src/components/signatures/index.js | Exported the new component. |
| signTypedDataV4WithSalt.onclick = async () => { | ||
| const msgParams = { | ||
| domain: { | ||
| chainId: globalContext.chainIdInt.toString(), |
There was a problem hiding this comment.
The chainId is converted to a string during signing, but in verification it is used as a number (line 163). Consider using the same data type for chainId in both places to prevent potential verification issues.
Suggested change
| chainId: globalContext.chainIdInt.toString(), | |
| chainId: globalContext.chainIdInt, |
| name: 'Ether Mail', | ||
| verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', | ||
| version: '1', | ||
| salt: 'test', |
There was a problem hiding this comment.
The salt parameter is hard-coded as 'test'. If this is only intended for development, consider adding a clear comment or mechanism to supply a proper salt value for production use.
scutuatua-crypto
approved these changes
Dec 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR has added sign Typed data v4 signature with domain salt to prevent bug MetaMask/metamask-extension#30473 happen in metamask extension and mobile.