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

Add message signing and verifying #97

Merged
merged 5 commits into from
Oct 3, 2024
Merged

Conversation

brusherru
Copy link
Member

@brusherru brusherru commented Sep 23, 2024

It closes #85.

  • adds "Sign message" button next to the every local key in the "Manage Keys & Accounts" pane,
  • adds "Verify message" button in the settings dropdown.

This PR does not add support of signing messages by Ledger devices, because it requires some tweaks on Ledger App side.

Note for third-party developers:

Signature for the message calculated with a hard-coded prefix Message: which is encoded as Uint8Array [77, 101, 115, 115, 97, 103, 101, 58] to avoid possible vector of attack. So the verify function should add this prefix to the message to be able to validate correct signature.

Example:

// Message: "Hello, world"
// Signed message: "Message:Hellow, world"
// Signature length is 64 bytes

const te = new TextEncoder();
ed25519.verify(signature, te.encode("Hello, world"), pubKey) // invalid
ed25519.verify(signature, te.encode("Message:Hello, world"), pubKey) // valid

@brusherru brusherru self-assigned this Sep 23, 2024
Copy link

You can preview the changes at : https://fb880be8.smapp-lite-prod.pages.dev

Copy link
Collaborator

@monikasmolarek monikasmolarek left a comment

Choose a reason for hiding this comment

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

In general OK but the error/success msgs should be fixed.

The success message once appears, stays sticked forever.

Screen.Recording.2024-09-24.at.14.06.20.mov

In the end of the recording I tried to put different kinds of incorrect signature content and the button [Verify] seemed like doing nothing/not working at all. Checked again with a new obviously incorrect input, and the button doesn’t respond with "check ->throw error", acts as if there was no onClick implemented.
Screenshot 2024-09-24 at 14 08 09

Copy link
Collaborator

@monikasmolarek monikasmolarek left a comment

Choose a reason for hiding this comment

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

noticed the typo

src/components/SignMessageModal.tsx Outdated Show resolved Hide resolved
src/components/VerifyMessageModal.tsx Outdated Show resolved Hide resolved
Copy link

You can preview the changes at : https://43e9f596.smapp-lite-prod.pages.dev

Copy link
Collaborator

@monikasmolarek monikasmolarek left a comment

Choose a reason for hiding this comment

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

👌

Copy link

You can preview the changes at : https://132177e9.smapp-lite-prod.pages.dev

Copy link

github-actions bot commented Oct 1, 2024

You can preview the changes at : https://077f1ca5.smapp-lite-prod.pages.dev

@brusherru brusherru merged commit 7cb0ad9 into main Oct 3, 2024
1 check passed
@brusherru brusherru deleted the feat-85-message-signing branch October 3, 2024 13:32
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.

Add Sign/Verify message feature
2 participants