getAlby / lightning-browser-extension

The Bitcoin Lightning Browser extension that connects to different wallet interfaces and brings deep lightning integration to the web
https://getalby.com
MIT License
530 stars 193 forks source link

[Feature] Add Nostr badge on websites list #1784

Open bitcoinuser opened 1 year ago

bitcoinuser commented 1 year ago

Feature description

I would like to see Nostr badge for websites I connected using Alby Nostr.

Describe the solution

Same thing like this https://github.com/getAlby/lightning-browser-extension/pull/1779 but for Nostr

manavdesai27 commented 1 year ago

I would like to work on this issue. Could you assign me?

manavdesai27 commented 1 year ago

I guess we need to add nostrAuth to check if we are connected using nostr, as done in lnurlauth

bumi commented 1 year ago

awesome if you want to look into it. we have recently introduced the permissions. Those permissions are similar to the lnurlAuth flag. If a website has a permission it can execute certain calls.

So I think it would be best to list the permission names as badges - and then maybe later also move lnurlAuth from a flag into a permission.

I am not super sure how that would look like but I think this is the direction we should investigate here.

(note: permissions are website AND account specific now)

manavdesai27 commented 1 year ago

Okay @bumi let me look there.

manavdesai27 commented 1 year ago

I could check if the website has any permissions in the permission array, but how would I know if it is logged in using nostr?

bumi commented 1 year ago

we would just list the permissions as badges - and don't focus on the "login".

manavdesai27 commented 1 year ago

Okay, what if there are more than one permissions? A horizontal list of badges?

bumi commented 1 year ago

I think so, at least currently - though the list could get long. maybe we can include @jakubszwedo here, do you have ideas?

stackingsaunter commented 1 year ago

@bumi with Nostr there could be max 3 badges now? Active, Login and Nostr? I think it's fine to have them in a horizontal list now. Sooner or later I see this section redesigned, but for now we have plenty of space for badges

We could use bitcoin-purple #BB6BD9 for nostr badge. I assume in the future there may be more nostr badges, like delegation, so we could color code them like this

Screenshot 2023-02-14 at 13 17 57
manavdesai27 commented 1 year ago

Okayy. Let me see how to implement this.

manavdesai27 commented 1 year ago

@bumi How do I add labels in translation for different permissions?

manavdesai27 commented 1 year ago

image Currently this is happening.

image I am thinking something like this would do the job.

bumi commented 1 year ago

@reneaaron @reneaaron what do we do here best? I guess those should be new translations, correct?

@manavdesai27 it looks good, but you need to do:

label: { 
  "nostr/getPublicKey": "your translation",
}

see your first screenshot where it loads badge.label.nostr/getPublicKey (not badge.label.nostr.getPublicKey)

manavdesai27 commented 1 year ago

see your first screenshot where it loads badge.label.nostr/getPublicKey (not badge.label.nostr.getPublicKey)

Yes I know, it loads it that way. But I have changed the code such that nostr/getPublicKey is converted to nostr.getPublicKey before being sent for translation rendering. I have done so for the cleanliness of the translation file. What do you think about that @bumi .

I will soon create a Pull Request.

reneaaron commented 1 year ago

Not sure if we want to maintain translated titles right now.

What is the translation content of nostr.getPublicKey or webln.addholdinvoice for instance?

Another thing to consider here: Those badges would only show up if you give permanent permissions to those websites. You wouldn't see where you are using nostr if you don't do that.

I would like to see Nostr badge for websites I connected using Alby Nostr.

@bitcoinuser Why would you want to see that info on this list? What job does this badge help you to get done?

manavdesai27 commented 1 year ago

@reneaaron What do you suggest instead then? Because I don't see a way to know where we are using nostr except the "permissions" way. One way could be adding a boolean flag, the same as lnurlAuth

reneaaron commented 1 year ago

@manavdesai27 Not sure, that's why I tagged @bitcoinuser to get a clear understanding about which problem we are actually trying to solve here.