Skip to content
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

feat: siwe #2280

Merged
merged 21 commits into from
May 21, 2024
Merged

feat: siwe #2280

merged 21 commits into from
May 21, 2024

Conversation

tmm
Copy link
Member

@tmm tmm commented May 20, 2024

ERC-4361: Sign-In with Ethereum


PR-Codex overview

This PR updates the SIWE module with new functions, error types, and utilities related to EIP-4361.

Detailed summary

  • Added generateSiweNonce function for EIP-4361 nonces
  • Introduced SIWE error types
  • Updated client tests with verifySiweMessage
  • Created documentation for generateSiweNonce

The following files were skipped due to too many changes: src/clients/createPublicClient.test.ts, src/clients/decorators/public.test.ts, src/utils/siwe/utils.ts, site/pages/docs/siwe/utilities/validateSiweMessage.md, src/actions/siwe/verifySiweMessage.test.ts, src/utils/siwe/validateSiweMessage.ts, src/utils/siwe/types.ts, src/utils/siwe/validateSiweMessage.test.ts, src/utils/siwe/parseSiweMessage.ts, src/clients/decorators/public.ts, src/actions/siwe/verifySiweMessage.ts, src/utils/siwe/createSiweMessage.ts, src/utils/siwe/parseSiweMessage.test.ts, site/pages/docs/siwe/utilities/createSiweMessage.md, site/pages/docs/siwe/actions/verifySiweMessage.md, src/utils/siwe/createSiweMessage.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented May 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview May 21, 2024 9:52pm

Copy link

changeset-bot bot commented May 20, 2024

⚠️ No Changeset found

Latest commit: 1667ca3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@lochie
Copy link
Contributor

lochie commented May 20, 2024

hell yeah

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (65e34e9) to head (1667ca3).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2280      +/-   ##
==========================================
- Coverage   99.70%   99.68%   -0.02%     
==========================================
  Files         670      680      +10     
  Lines       57096    57684     +588     
  Branches     2685     2747      +62     
==========================================
+ Hits        56925    57504     +579     
- Misses        154      163       +9     
  Partials       17       17              

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

@obstropolos
Copy link

This is the way

Comment on lines 17 to 24
address?: Address | undefined
domain?: string | undefined
message: string
nonce?: string | undefined
scheme?: string | undefined
signature: Hex
// TODO: `Date` or `string`?
time?: Date | undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

those fields are required in Message type, why are they optional here?

maybe it's worth reusing Message type properties here?

Copy link
Contributor

github-actions bot commented May 20, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
viem (esm) 56.84 KB (+0.86% 🔺) 1.2 s (+0.86% 🔺) 4.5 s (+76.63% 🔺) 5.7 s
viem (cjs) 68.2 KB (+0.65% 🔺) 1.4 s (+0.65% 🔺) 16.4 s (+28.11% 🔺) 17.8 s
viem (minimal surface - tree-shaking) 3.3 KB (0%) 67 ms (0%) 165 ms (-43.88% 🔽) 231 ms
viem/accounts 73.84 KB (0%) 1.5 s (0%) 4.2 s (-34.66% 🔽) 5.7 s
viem/accounts (tree-shaking) 19.18 KB (0%) 384 ms (0%) 3.6 s (+110.49% 🔺) 4 s
viem/actions 41.94 KB (0%) 839 ms (0%) 3.8 s (+17.62% 🔺) 4.6 s
viem/actions (tree-shaking) 318 B (0%) 10 ms (0%) 447 ms (+415.4% 🔺) 457 ms
viem/chains 27.85 KB (0%) 558 ms (0%) 5.9 s (+107.3% 🔺) 6.5 s
viem/chains (tree-shaking) 324 B (0%) 10 ms (0%) 72 ms (+105% 🔺) 82 ms
viem/chains/utils 1.02 KB (0%) 21 ms (0%) 80 ms (-9.31% 🔽) 100 ms
viem/ens 41.94 KB (0%) 839 ms (0%) 2.5 s (-43.03% 🔽) 3.4 s
viem/ens (tree-shaking) 18.41 KB (0%) 369 ms (0%) 2.2 s (+12.56% 🔺) 2.6 s

@tmm tmm requested a review from jxom May 21, 2024 18:43
@tmm tmm marked this pull request as ready for review May 21, 2024 18:43
@mihoward21
Copy link
Contributor

Will this be compatible with ERC-6492?

@jxom
Copy link
Member

jxom commented May 21, 2024

@mihoward21 yep

@tmm tmm merged commit 4dc6d32 into main May 21, 2024
25 of 27 checks passed
@tmm tmm deleted the tmm/siwe branch May 21, 2024 21:54
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.

6 participants