nostr-protocol / nips

Nostr Implementation Possibilities
2.4k stars 583 forks source link

NIP-07: Add standards for cross-extension APIs #1370

Closed Vap0r1ze closed 4 months ago

Vap0r1ze commented 4 months ago

Both Chrome and Firefox fully support cross-extension messaging (Mozilla Docs) (Chrome Developer Docs).

It would be pretty useful for Web Extensions to be able to detect the existence of an existing Nostr key-manager, and use it to provide extra Nostr functionality in background scripts without compromising security.

I'm suggesting this because I've realized how useful Nostr can be as a decentralized solution to WebRTC signalling servers. I want to make an Extension that allows people to share their tabs interactively with others, think rabb.it but Bring-Your-Own-Browser and peer-to-peer lol. It would use Nostr under the hood as a way to add friends and send each other the call/answer SDP files.

Ideally an extension that uses Nostr as a backend 'under-the-hood' could show more nostr-specfic user-facing features if it uses this to detect that the user is a Nostr user.

That specific idea would have to live in a background script, making this a necessary addition for it to provide a good experience to existing Nostr users.

Vap0r1ze commented 4 months ago

Should this be it's own NIP, or does amending NIP-07 make sense for this?

fiatjaf commented 4 months ago

NIP-07 makes sense.

fiatjaf commented 4 months ago

My feelings towards extensions are that they're kind of a waste of time except for some niche use cases, because for some weird reason most people refuse to even acknowledge their existence, even after 20 years.

Vap0r1ze commented 4 months ago

@fiatjaf Honestly it's probably best that it isn't standardized, and extensions should just individually support specific key-manager extensions. You'd need the management manifest v2 permission to list all extensions for autodetecting them anyways, which is way too permissive in practice.

I also just realized your nos2x (what I use) actually already supports the Messaging API lol.