getAlby / lightning-browser-extension

The Bitcoin Lightning Browser Extension that brings deep Lightning & Nostr integration to the web. Wallet interface to multiple lightning nodes and key signer for Nostr, Liquid and onchain use.
https://getalby.com/#extension
MIT License
529 stars 193 forks source link

WebLN: VerifyMessage #1345

Closed reneaaron closed 1 year ago

reneaaron commented 2 years ago

Describe the bug

Signing and verifying a message isn't creating valid signatures, currently they are { valid: false }.

await webln.enable();
var result =  await webln.signMessage(message);
console.log(result);
console.log(await webln.verifyMessage(result.signature, message));

➡️ Demo (see console output)

Expected behavior

bumi commented 2 years ago

somehow I think verifyMessage should be deprecated. I don't really know what the use case for this is and nobody uses it it seems.

reneaaron commented 2 years ago

I had the same thought. If we can't come up with a valid use case I'd rather throw a NotImplementedException() than confusing users with API methods that don't work / make no sense.

https://youtu.be/fTzW9iJhiNg?t=1586

escapedcat commented 2 years ago

Should we remove that code?

reneaaron commented 2 years ago

I would say so. I think the right way to remove this code is to to throw an exception in webln.verifyMessage() and tell developers that this method is not supported by Alby. (there are also other WebLN providers that don't support all methods)