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

Support eip55 #176

Merged
merged 3 commits into from
Dec 19, 2023
Merged

Support eip55 #176

merged 3 commits into from
Dec 19, 2023

Conversation

oed
Copy link
Member

@oed oed commented Dec 13, 2023

This PR enables the pkh-ethereum CACAO verifier to verify SIWE messages that have the ethereum address in the iss field encoded using EIP-55, while retaining support for lower case addresses.

In addition it would be desirable to change the default behavior of generated SIWE messages for CACAO to use eip55 by default since the spec says the address "Must" be encoded using eip55. However, since the did-session package uses @ceramicnetwork packages that depend on a released version of @didtools it's not possible to make this change now before the verification support has been rolled out.

This PR fixes #173

@oed oed requested review from ukstv and PaulLeCam December 13, 2023 19:41
@oed oed self-assigned this Dec 13, 2023
@@ -48,7 +48,8 @@
"@ipld/dag-cbor": "^9.0.6",
"caip": "^1.1.0",
"multiformats": "^12.1.3",
"uint8arrays": "^4.0.9"
"uint8arrays": "^4.0.9",
"viem": "^1.19.13"
Copy link
Contributor

Choose a reason for hiding this comment

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

Any way to avoid importing this full library for just one utility function please? Maybe there are alternative packages that would be lighter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Viem is very likely going to be a dependency for the upcoming Varsig implementation, which means it's pretty much always going to be a requirement everywhere.

I think viem is pretty tree-shakable, so it shouldn't have much of an impact on actual build sizes?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK thanks, sounds good if tree-shaking works well 👍

Copy link
Member Author

@oed oed Dec 14, 2023

Choose a reason for hiding this comment

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

Well that's what I see on https://bundlephobia.com/package/viem

Can we trust the badge shown there?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know how reliable it is, I guess it depends on our own build process as well?
Would be good to figure out though, the lib is 200kB+ so a pretty big addition to a low-level library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any thoughts on this @ukstv

packages/cacao/src/siwx/siwe.ts Outdated Show resolved Hide resolved
packages/cacao/src/siwx/siwe.ts Outdated Show resolved Hide resolved
@oed oed merged commit 22e0576 into main Dec 19, 2023
13 checks passed
@oed oed deleted the feat/support-eip55 branch December 19, 2023 09:09
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.

The signature problem on Integrating with Lit
3 participants