Skip to content

fix: emit EIP-55 checksummed addresses in SIWE messages - #413

Open
o-mid wants to merge 5 commits into
reown-com:developfrom
o-mid:fix/siwe-eip55-address
Open

fix: emit EIP-55 checksummed addresses in SIWE messages#413
o-mid wants to merge 5 commits into
reown-com:developfrom
o-mid:fix/siwe-eip55-address

Conversation

@o-mid

@o-mid o-mid commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • String.toEIP55() was a no-op (return this), so formatAuthMessage put lowercase addresses in SIWE messages.
  • SIWE libraries that enforce EIP-55 (e.g. spruceid siwe) reject those with Address not conformant to EIP-55.
  • Checksum EVM addresses via EthereumAddress.fromHex(...).eip55With0x. Leave Solana / Bitcoin accounts unchanged.

Fixes #45

Test plan

  • cd packages/reown_sign && flutter test test/utils/address_utils_test.dart
  • AppKit SIWE createMessage / SIWEUtils.formatMessage: address line is checksummed (e.g. 0x958C... not 0x958c...)
  • Connect a Solana account: address is unchanged
  • spruceid siwe new SiweMessage(message) accepts the formatted message without rewriting the address

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>
Copilot AI lite review requested due to automatic review settings August 15, 2026 07:22
@o-mid o-mid mentioned this pull request Aug 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 using EthereumAddress.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.

Comment thread packages/reown_sign/lib/utils/address_utils.dart Outdated
o-mid and others added 4 commits September 5, 2026 10:23
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>
@o-mid

o-mid commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@ignaciosantise your 0X prefix note is in, and I merged latest develop. Ready for you to approve/apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address is not EIP-55

3 participants