Skip to content

Override signMessage for SmartWallet class #1953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 18, 2023

Conversation

nkrishang
Copy link
Contributor

@nkrishang nkrishang commented Nov 15, 2023

Problem solved

Uses EIP-712 signature in signMessage for the updated EIP-1271 signature verification in smart wallet contracts (thirdweb-dev/contracts#572)

Changes made

  • Public API changes: list the public API changes made if any
  • Internal API changes: explain the internal logic changes
    • Before: SmartWallet.signMessage directly uses ethers-js signer.signMessage to sign the message hash of the data to sign (i.e. signMessage(ethers.utils.hashMessage(data)))
    • Now: SmartWallet.signMessage signes EIP-712 typed data of the data to sign mixed with the smart wallet's domain separator. If this yields in invalid signature, the function falls back to the legacy method of signing.

How to test

@nkrishang nkrishang self-assigned this Nov 15, 2023
@nkrishang nkrishang requested a review from a team November 15, 2023 13:35
Copy link

changeset-bot bot commented Nov 15, 2023

🦋 Changeset detected

Latest commit: 6295cf7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@thirdweb-dev/wallets Patch
@thirdweb-dev/auth Patch
thirdweb Patch
@thirdweb-dev/react-core Patch
@thirdweb-dev/react-native Patch
@thirdweb-dev/react Patch
@thirdweb-dev/unity-js-bridge Patch
@thirdweb-dev/react-native-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nkrishang
Copy link
Contributor Author

/release-pr

throw new Error("Failed to sign message");
}

const isValid = await checkContractWalletSignature(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it makes sense to validate the signature here, will also slow down the process quite a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there's another way to check whether to fallback to legacy method of signing.

So this seems necessary to maintain backward compatibility with existing smart wallets out there.

@nkrishang
Copy link
Contributor Author

/release-pr

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (61760a1) 67.94% compared to head (6295cf7) 67.94%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1953      +/-   ##
==========================================
- Coverage   67.94%   67.94%   -0.01%     
==========================================
  Files         291      291              
  Lines       10928    10927       -1     
  Branches     1495     1495              
==========================================
- Hits         7425     7424       -1     
  Misses       2882     2882              
  Partials      621      621              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nkrishang nkrishang added this pull request to the merge queue Nov 18, 2023
Merged via the queue into main with commit 1c4cbed Nov 18, 2023
@nkrishang nkrishang deleted the nkrishang/update-eip1271-auth branch November 18, 2023 06:16
@github-actions github-actions bot mentioned this pull request Nov 18, 2023
jnsdls pushed a commit that referenced this pull request Jun 19, 2024
* add label view/edit support for admins and access tokens

* add labels for backend wallets
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.

2 participants