Skip to content

fix(eip-1193): sign personal_sign payloads as raw bytes#33

Draft
danilaverbena wants to merge 1 commit into
circlefin:masterfrom
danilaverbena:agent/fix-personal-sign-raw-bytes
Draft

fix(eip-1193): sign personal_sign payloads as raw bytes#33
danilaverbena wants to merge 1 commit into
circlefin:masterfrom
danilaverbena:agent/fix-personal-sign-raw-bytes

Conversation

@danilaverbena

Copy link
Copy Markdown

Summary

Sign personal_sign challenges as raw bytes instead of UTF-8 text.

Detail

The EIP-1193 provider receives the personal_sign challenge as a hex-encoded byte string. Passing that value directly to viem's signMessage treats values such as 0xdeadbeef as the UTF-8 text "0xdeadbeef", producing a signature over different bytes than the caller requested.

This change passes the challenge through viem's { raw: challenge } form and adds a regression assertion covering the arguments sent to the smart account signer.

Testing

  • jest --runInBand src/__tests__/providers/eip-1193/provider.test.ts (19 tests passed)
  • tsc --project tsconfig.json --pretty false --noEmit
  • eslint src/providers/eip-1193/provider.ts src/__tests__/providers/eip-1193/provider.test.ts
  • git diff --check

Documentation

No documentation changes are required; this restores the expected personal_sign behavior.

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.

1 participant