friendica / friendica

Friendica Communications Platform
https://friendi.ca
GNU Affero General Public License v3.0
1.44k stars 340 forks source link

Add support for Nostr protocol #13260

Open lapo-luchini opened 1 year ago

lapo-luchini commented 1 year ago

I've recently read about a Nostr-ActivityPub bridge called Mostr. I was wondering if it would make any sense for Friendica to implement directly a Nostr client (or maybe even a relay?) in order to take advantage of the (supposedly) "better" protocol instead of using a single-point-of-failure bridge.

tek-aevl commented 1 year ago

hmm...

Introducing Mostr: a Fediverse Nostr bridge When I first saw Nostr, I didn't think people would actually do it. The last few months have told a different story. Nostr has been exploding with developer activity! I looked closer.

Nostr solves my most basic frustration with ActivityPub, which is that some of my followers on different servers can't see me because their admin said so. I'm tired of it.

We've been investing in the ActivityPub ecosystem for years. Nostr is a better protocol, but it lacks the years of work that went into making the Fediverse usable. However, things are moving fast. This is partly because of the protocol, which is easy to implement and gives clients a lot of control. It seems like only a matter of time until it overtakes the Fediverse, and I'd rather be a part of it than get left behind.

So the first thing I've decided to do is build a bridge. This bridge connects ActivityPub and Nostr together, so we can communicate across the pond. Everyone wins.

We hope you enjoy getting to know each other, and that this opens new doors for collaboration.

Source code: https://gitlab.com/soapbox-pub/mostr

Usage To interact with ActivityPub users on Nostr, please subscribe to our relay:

wss://relay.mostr.pub You can then find a user by their NIP-05 identifier, eg: alex_at_gleasonator.com@mostr.pub

To see Nostr users on the Fediverse, search for them by their hexadecimal public key:

https://mostr.pub/users/ As your network interacts with Nostr users, you'll start seeing more of them over time.

Implementation The bridge acts as an ActivityPub server and a Nostr client.

It has an ActivityPub inbox which converts data into Nostr events which it pushes to a relay. It listens on the relay and federates ActivityPub data for relevant Nostr events.

Tech stack TypeScript + Deno Web Cache API SQLite What's next? Mostr is a work in progress. We plan to fix bugs, add support for emoji reactions, and more.

Next, we are going to make Mastodon clients work on Nostr. Not just Soapbox, all of them. This will require a middleware service that acts like a Mastodon "instance" and talks to Nostr relays behind the scenes.

Support us If you like what we do, please support us!

BTC bc1q9cx35adpm73aq2fw40ye6ts8hfxqzjr5unwg0n

MrPetovan commented 1 year ago

@lapo-luchini The way protocol suport works in Friendica is either we’re able to make Friendica as a protocol server like we do for ActivityPub and Diaspora, either we implement a client as a connector addon like we do for several platforms. This is mostly the realm of @annando so I would wait on his advice to figure out which one it would be.

annando commented 1 year ago

I hadn't yet had any look at Nostr, so I really cannot tell anything about the possibility or impossibility working with it.

MrPetovan commented 1 year ago

I just learned Mostr is made by Alex Gleason to mirror ActivityPub profiles on Nostr without the owner's consent. The general libertarian vibe of Nostr (cryptocurrencies, lack of moderation tools) makes me want to push back against any protocol support in Friendica.

tobiasd commented 1 year ago

If the protocol was implemented I would expect the moderation tools of Friendica to work in the same way then before. So if a account was blocked by a user or an admin, then the communication would still have to be blocked.

MrPetovan commented 1 year ago

I hear you, it would be more of a principle rejection than a technical one. Which means I will go along if @annando ends up working on Nostr support but I will have expressed my reluctance.

lapo-luchini commented 1 year ago

Mostr is made by Alex Gleason to mirror ActivityPub profiles on Nostr without the owner's consent

Ouch.

I guess Mostr as a node could be "defederated" in the usual ways? (I'm not a big fan of de-federation myself, but then again I run a single user node myself; I agree bigger nodes have vastly different requirements)

BTW: I'm not even sure I want to use that network myself so far, I mainly created the issue to track a potential feature. 😇 (maybe it was a bit impulsive, but at the very least future people thinking about it will find this link)

MrPetovan commented 1 year ago

I'm not sure how Mostr advertises itself when it fetches ActivityPub content, so it's possible a domain block wouldn't work.

shiribailem commented 1 year ago

At a glance it looks like the "resistant to censorship" angle is that it doesn't allow admin moderation tools (ie. you can't really defederate with Nostr).

It's basically "what if bitcoin was a social network": users don't have accounts on servers, and servers exist only as relays. They just spam out posts to a bunch of relays and the other users query those relays for posts/updates. No sign up, just create a key and go.

As mentioned, it's definitely one of those libertarian ideals kinda things.

I'm for supporting it on a basic principle level (though that doesn't mean much since I'm not doing any dev contribution), just because the selling point to me of Friendica is connecting pretty much everywhere and I wouldn't want to see the decision of support as a judgement call on the project's part. That said... definitely wouldn't be installing/enabling support on my system.

The federation behavior of Mostr is probably fine in ActivityPub space since the base Nostr protocol is keys and not user accounts and doesn't include servers, so any posts/subscriptions would certainly be coming from Mostr. From the activitypub side we would see an account by following @mostr.pub

Frankly though, with Mostr I don't think support is practical to implement in Friendica at this time. It's de-facto supported via Mostr instances with absolutely no work required. And if it did become big enough for proper support, then Mostr (or similar) will have worked out many of the design kinks in advance.

informapirata commented 10 months ago

Mostr is made by Alex Gleason to mirror ActivityPub profiles on Nostr without the owner's consent

"Nostr" is a very interesting protocol and it would be wrong to evaluate the opportunity to integrate it only on the basis of the terrible political beliefs of its author. It would remind me too much of feditips' absurd crusade against Lemmy's developers, based on the fact that "they never expressed their disappointment towards the Uighur issue"... 🙄

the most important question for me is just to evaluate whether an integration of "Nostr" could lead to unnecessary burdens for Friendica. And I fear that managing a 100% decentralized system could actually be a problem.

shiribailem commented 10 months ago

You can't be free of politics, citing libertarianism is an entirely relevant topic because they generally believe in free-speech-absolutism: ie. How dare an admin block hate speech and ban users for death threats and harassment.

I can guarantee you that Nostr support will not be a thing with Friendica. The devs fully support banning Nazis and Nostr is built to explicitly prevent the banning of Nazis.

On top of that Mostr provides de-facto support, and most of us admins with block Mostr of anything similar without a second thought.

informapirata commented 10 months ago

How dare an admin block hate speech and ban users for death threats and harassment.

With one click... 😅

But I understand your doubts...

shiribailem commented 10 months ago

How dare an admin block hate speech and ban users for death threats and harassment.

With one click... 😅

But I understand your doubts...

Doesn't work with Nostr, they click a button and your ban dissappears. It's explicitly designed to prevent any and all moderation.

It's not doubts, it's an explicit design feature.

theerror commented 9 months ago

Yeah, this is so philosophic topic. Is moderation == censorship? Well, not always, but definitely could be. And some time it indeed is, as it's admin decision and problem is, that sometime, you just even don't know, that something is blacklisted. I have no idea if it's better or not to have moderation tools. And definitely not so easy to decide. But I do like freedom of nostr. If there is some decentralised social network, it is nostr. What is however killing feature of nostr is zaping.

shiribailem commented 9 months ago

This really isn't a place for philosophical conversation, the debate on whether "moderation is censorship" is unrelated, Friendica supports moderation adopting Nostr as a first party tool beyond puppet accounts is abandoning moderation.

And to answer you "philosophical" question, since it's not remotely complicated and since I imagine people are going to keep coming back to this thread over and over again to beat a dead horse:

Moderation is when you're talking about no one being obligated to do work for or otherwise host your speech, ie. if I block a user on my server it's moderation because there's no obligation that I grant them access to my server.

Censorship is when you're limiting someone's ability to speak in the first place (for example the FCC censors profanity in broadcasts, it's censorship because the FCC isn't doing the transmitting or otherwise involved in the actual sending of it, rather they're just saying what the broadcaster can and can't say with their own equipment).

This comes up in the political discussions and why libertarianism is a relevant mention because of the belief in "free speech absolutism" which is based on the idea that all moderation is censorship. Not because of some deep philosophical take, but just that they feel that no matter how abhorrent their views might be others should be obligated to host and spread them on their behalf.

The only grounds in which Friendica as a project could be involved in censorship is if they built restrictions into the platform itself to prevent certain speech (ie. if the code explicitly blocked a work from ever being used on the platform, regardless of the server you're on, then that would be censorship).

shiribailem commented 9 months ago

Plain summary: if someone wants to build a Nostr puppet addon, nobody is stopping them and it might even be officially supported. But it's very unlikely that anyone is going to be interested in putting forth that much effort when something like Mostr exists and does a better job than an add-on can reasonably do.

As far as native Nostr functionality: it's too fundamentally at odds with how Friendica works to incorporate native support. Again it comes back to Mostr fulfilling that need anyways as accessing Nostr through it gives you the best of what you could hope for with a native support.

And before anyone thinks about the ability of admins to block Mostr: native support would also include an on-off switch and any admin who blocks Mostr would also be an admin who would flat turn off Nostr support anyways.

theerror commented 9 months ago

It wasn't any attack to anybody. Totally understand, that as developers just have to decide somehow. In user numbers, nostr is not so big deal too and when moderation is important (what is totally fine point of view) your/devs decision makes totally sense.

I just had urge to say it. :) It was not about disagreeing about decision itself. Time will show how things will go. Definitely there will be hard times in general.

0n4t3 commented 9 months ago

I have few different ideas that could offer a way to implement Nostr without making moderation problematic that I thought I would share, though take them with a grain of salt as I’m not a developer or an instance host.

First, if there was a fear of barrage of unfiltered content the easiest way to solve that could be to add support, but only for outgoing messages. When making a post the user could get prompted to also share the signed message to relays of their (or their admin’s) choosing, the browser or server could sign the messages (preferably with a Nostr signing plugin), and the message could be uploaded to said relays. If anybody wanted to see replies or follow Nostr users they could use a bridge or a Nostr client, but pulling data in from Nostr wouldn’t happen on the server meaning no moderation concerns.

Another potential way would be to have the Friendica server be the relay itself. Anybody could read from the relay, but nobody could post to the relay without having a Friendica account. Posts could be made by adding the relay to a Nostr client or by using Friendica on the web interface/fedi apps, but no content would be pushed to Nostr or pulled from Nostr without first going through a Friendica account with all the same moderation and tools as would be applicable for any other post on Friendica.

Last, it could also be possible to allow full Nostr integration but give the admins the ability to allow/disallow both specific relays and/or specific remote accounts. Relays can have rules, registration requirements, or require payment just like an Activity Pub/Diaspora/Zot server. Nostr is “censorship resistant” in the same way GPG keys or software signing certificates are: I can use my GPG keys to sign emails sent from any provider to verify I’m me, but that doesn’t let me use Gmail if they ban me, go offline, or get their domain seized by the Taliban.