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

(Branch sync for deploy previews) #134

Merged
merged 6 commits into from
Oct 25, 2024
Merged

(Branch sync for deploy previews) #134

merged 6 commits into from
Oct 25, 2024

Conversation

jshufro
Copy link
Contributor

@jshufro jshufro commented Oct 25, 2024

No description provided.

This hook effectively just wrap's viem's `publicClient`'s `verifyMessage` call, which takes a message, signature, and address, and (asynchronously) returns a boolean indicating if the data aligns. It's async because this `verifyMessage` function supports EIP1271, which needs to make an onchain request when the given address is a smart contract.
In `SoloNodeRequestAccess`, we'll no longer verify signatures by recovering the address from the signature and message, and comparing that recovered address to the connected wallet address. Instead, we'll just pass the message, signature, and connected address to the new hook and receive the boolean result.

This commit also makes the necessary changes to our "step" determination logic (truthy response instead of recovered address === connected address), and also simply passes the connected address (instead of the recovered address, which we don't have any more) into the `SignedMessageForm`.
We are no longer using the `useRecoveredAddress` hook, so delete it.
There's another hook called `useIsValidSignedMessage` which also performs signature validation. This commit replaces the old method of signature validation (by recovering an address from signature and message, and comparing it to the given address), with the new `verifyMessage` function which supports EIP1271 smart contract signatures.

I'm not quite sure why this separate hook needs to exists (it seems a little redundant?), but that's probably just beacuse of my lack of context.
This isn't strictly necessary for the work in this PR, but since the the new `verifyMessage` function is async, there's a moment after the `SignedMessageForm` appears but before signature validation in that component is complete, which was resulting in the "Error" message on the readonly input to appear. This commit just adds a third "verifying" state, so instead of a brief "error" message appearing while validation is ongoing, we see a "validating" message instead.
Copy link

Deploying rescue-ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b870f7
Status: ✅  Deploy successful!
Preview URL: https://1bb786f6.rescue-ui.pages.dev
Branch Preview URL: https://verify-message.rescue-ui.pages.dev

View logs

@jshufro jshufro merged commit ac4d022 into master Oct 25, 2024
5 checks passed
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