-
Notifications
You must be signed in to change notification settings - Fork 59
Implement Sign & Verify #154
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
Conversation
wbobeirne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fantastic, just how I imagined it. Thanks for bringing it to life man. Your revised designs definitely get closer to what I had in mind, but let me just drop some feedback here that I had written up but hadn't posted before you made those.
Reusing the site icon <-> joule layout for signature was a good move, since it is the site asking for your signature and not a user. However, for verify, you're going to be verifying a node's signature, not necessarily a site. For instance, if there were a lightning-powered Twitter that users signed all of their tweets, you'd want it to present the signature as the user's node's signature, not the site's. So I think for verify, we should show the user's node instead.
When signing, the most important thing is to emphasize what the user is going to sign. Likewise, there will likely be a lot of content in there, potentially JSON. This should probably be much larger, the main part of the popup. I really like the reassuring text though, so keeping that in a small way would be great.
As noted in the comments for verification, this isn't really a step the site needs to be involved in beyond opening the prompt. In that case, we should immediately verify the message, and make it loud and clear whether it's valid or not.
Your new designs address 90% of what I was getting at, awesome work. If you want to go ahead and push the latest designs (I assume you did them in code) I'd be happy to riff on them to give feedback, but if you want to feel it out yourself, by all means! Let me know if any of my feedback wasn't clear.
| }; | ||
|
|
||
| verifyMessage = (params: T.VerifyMessageParams) => { | ||
| return this.request<T.VerifyMessageResponse, T.VerifyMessageParams>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify doesn't actually need a response. The purpose of it just for the user's assurance, the website should probably be doing independent verification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is actually just adding the type for the LND REST API response. The WebLN verifyMessage function in provider.ts still returns void.
| <div className="VerifyPrompt-graphic-icon"> | ||
| <img src={Logo} /> | ||
| </div> | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that signature verifications are more often than not going to be about user's content signed by their nodes, I think there should be less emphasis on the site that is doing the verification. We should present the verified signature node's icon, alias, pubkey etc. instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/app/prompts/verify.tsx
Outdated
| </div> | ||
| <h2 className="VerifyPrompt-title"> | ||
| <strong>{this.origin.name}</strong> | ||
| requests your verification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purely for the user's benefit, so I don't think we should pose this as the site asking for verification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the message in the UI to just say "Signature Verification"
src/app/prompts/verify.tsx
Outdated
|
|
||
| private handleConfirm = () => { | ||
| this.setState({ isVerifying: true }, () => { | ||
| this.props.verifyMessage(this.signature, this.msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verification should happen immediately without the user needing to consent, and we should display the results right off the bat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| font-size: 1.4rem; | ||
| opacity: 0.4; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth making a common component for this, since it's been getting used a lot (Perhaps as a suite of PromptTemplate common components?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this into a separate component. I also reused the node icon/pubkey/alias from the payment prompt, so I refactored that into a shared component as well.
|
@wbobeirne This is great feedback. I really appreciate you taking the time to review. All of your requests are clear to me. I will use the new UI as a base and make the changes you suggested. I don't think it'll take too long, so I should have it done in the next day or two. On a side note, regarding the signing data structure. I agree that we should only accept JSON as the message argument to |
|
Hmm, I actually think in the case of a verified signature, it's important to show the message without any additional clicks needed. If someone were trying to be deceptive, they might change out the message contents, and unobservant users might just see "Verified" and assume it's what they saw on the site. This is definitely a major edge-case, but I think verification from Joule should be reasonably trustable at a glance, and not require a deeper dive. I think you could still fit in the two tabs and the textareas if you just made verified / invalid message one line with the icon to the left. |
|
Ah, you’re right. Good catch. I’ll make the change later on today. |
|
That looks absolutely perfect 👍 I'll take another scan at the changes and do a testrun later today, but this looks like it's ready to go. |






Closes #146
Description
Implement Sign and Verify prompts.
Note: I'm opening this PR for early feedback. The UI can be improved and the code cleaned up a bit more.
Steps to Test
Sign
webln.enable()and click the Confirm button on the popupwebln.signMessage('hello').then(res => console.log(res))hellois displayedConfirmbuttonVerify
webln.enable()and click the Confirm button on the popupwebln.verifyMessage('<signature>', 'hello').then(res => console.log(res))replacing<signature>with the output from thesignMessagecall aboveVerifybuttonScreenshots