fix: emit EIP-55 checksummed addresses in SIWE messages - #413
Open
o-mid wants to merge 5 commits into
Open
Conversation
toEIP55() was a no-op, so formatAuthMessage sent lowercase addresses and SIWE libraries that enforce EIP-55 rejected them. Checksum EVM addresses and leave Solana/Bitcoin accounts unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes SIWE message formatting in reown_sign by ensuring EVM addresses are emitted using EIP-55 checksum casing (instead of lowercase), improving interoperability with strict SIWE parsers.
Changes:
- Implement
String.toEIP55()to checksum EVM addresses usingEthereumAddress.fromHex(...).eip55With0x, while leaving non-EVM addresses unchanged. - Add unit tests covering lowercased EVM input, already-checksummed input, and non-EVM (e.g., Solana) input.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/reown_sign/lib/utils/address_utils.dart | Implements EIP-55 checksumming for EVM addresses (with a guard to avoid mutating non-EVM formats). |
| packages/reown_sign/test/utils/address_utils_test.dart | Adds coverage to validate correct checksumming behavior and non-EVM passthrough. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2 tasks
EthereumAddress.fromHex allows 0X, so the SIWE guard must too; otherwise those addresses were left unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
@ignaciosantise your 0X prefix note is in, and I merged latest develop. Ready for you to approve/apply. |
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.
Summary
String.toEIP55()was a no-op (return this), soformatAuthMessageput lowercase addresses in SIWE messages.siwe) reject those withAddress not conformant to EIP-55.EthereumAddress.fromHex(...).eip55With0x. Leave Solana / Bitcoin accounts unchanged.Fixes #45
Test plan
cd packages/reown_sign && flutter test test/utils/address_utils_test.dartcreateMessage/SIWEUtils.formatMessage: address line is checksummed (e.g.0x958C...not0x958c...)siwenew SiweMessage(message)accepts the formatted message without rewriting the address