spacemeshos / smapp-lite

The light wallet application for Spacemesh network
2 stars 1 forks source link

Add Sign/Verify message feature #85

Open brusherru opened 6 days ago

brusherru commented 6 days ago

Signing

In the signing popup there should be a dropdown that allows to select a specific key to sign with. The default key in the dropdown should be one of the keys used as spawn argument for the current account:

Also there should be a textarea to put your message in. After clicking "Sign" it will ask for the password, and afterward will display another popup with the signed message (JSON like { message: "...", signature: "..." }) and copy button.

Signing with Ledger device

It should also work with keys imported from Ledger device. Ledger lib already supports signing messages (app.signMessage method). For this case instead of asking the password there will be a popup asking to approve it on the device.

Verify

To verify the message, we may have a key selection dropdown (with the switch "Local" / "Foreign"), which is "Foreign key" by default. User supposed to specify a public key, paste the message in the textarea below, and click "Verify". Then it should tell is it valid or not. No password required.

GUI

Since we want to have default keys by default, it makes sense to have "Sign" and "Verify" buttons right on the wallet screen.

However, "Manage keys" drawer seems as another good place to put these buttons in. Especially since it's not supposed to be a very popular thing, people will use much more often "Send" and "Receive". Then probably we don't even need to choose the key in the "Sign message" popup. Let's decide on this before implementing the issue.

pigmej commented 6 days ago

I'd do it in manage keys part. Makes it simpler and less clunky imo.