ecosistema-social-decentral.../protocols/activitypub.md

100 lines
7.9 KiB
Markdown
Raw Normal View History

2020-02-25 09:17:09 +01:00
# ActivityPub
2020-06-08 21:29:01 +02:00
ActivityPub is a federated protocol that defines a set of interoperable social network interactions through specific APIs. Any server that implements this protocol can communicate with the rest of the network. It reached W3C recommendation status in 2018. It is one of several related specs produced by the Social Web Working Group.
2020-07-06 23:41:17 +02:00
ActivityPub consists of two layers: A server to server federation protocol, and a client to server protocol. In order to federate with the ActivityPub ecosystem, a service only has to implement the server-to-server protocol.
2020-06-08 21:29:01 +02:00
2020-07-06 23:41:17 +02:00
Mastodon is a popular federated alternative to Twitter built on ActivityPub. Other ActivityPub applications include Pleroma, PixelFed, Friendica, and PeerTube.
2020-02-25 09:17:09 +01:00
2020-05-18 01:53:01 +02:00
### Identity
2020-02-25 09:17:09 +01:00
2020-06-08 21:29:01 +02:00
User identities in ActivityPub are conceptualized as actor objects. To be spec compliant, each actor _must_ have an "inbox" and an "outbox". They also _should_ have "following" and "followers". They _may_ have "liked" collections, and many other predefined possibilities. These are endpoints, URLs which are accessible on the server.
2020-07-06 23:41:17 +02:00
Each actor has a publicly accessible JSON-LD document.
2020-02-25 09:17:09 +01:00
2020-07-06 23:41:17 +02:00
### Networking
ActivityPub is federated through a server-to-server protocol that passes messages between systems.
2020-02-25 09:17:09 +01:00
2020-07-06 23:41:17 +02:00
ActivityPub servers do not proactively network with each other, so they are unaware of each other's presence until a user finds and follows someone on another server. Servers maintain a list of remote accounts its users follow and subscribe to their posts.
2020-05-18 01:53:01 +02:00
2020-06-08 21:29:01 +02:00
ActivityPub messages are not limited to HTTP only. This allows it to potentially be extended in more [p2p directions](https://nbviewer.jupyter.org/github/WebOfTrustInfo/rebooting-the-web-of-trust-fall2017/blob/master/final-documents/activitypub-decentralized-distributed.pdf).
2020-05-18 02:17:43 +02:00
2020-07-06 23:41:17 +02:00
### Data
ActivityPub messages are objects wrapped in an "activity", indicating what it is. There is an [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/) that defines Activity, Object, and Actor types that are common to social web applications.
2020-02-25 09:17:09 +01:00
2020-06-08 21:29:01 +02:00
ActivityPub is not opinionated about how messages are persisted on the server as long as each server follows the protocol message requirements.
2020-02-25 09:17:09 +01:00
2020-07-06 23:41:17 +02:00
Server implementions may [cache](https://flak.tedunangst.com/post/what-happens-when-you-honk) frequent requests, such as follower actor objects, public keys of other servers, and images and attachments on posts.
### Moderation & Reputation
2020-05-18 01:53:01 +02:00
2020-06-08 21:29:01 +02:00
Moderation is primarily handled by server implementations. ActivityPub defines a "block" activity to help users control their experience.
2020-05-18 02:17:43 +02:00
2020-06-08 21:29:01 +02:00
The use of server-level bans to block content can lead to the isolation of an ActivityPub server instance if it is banned by many other servers, limiting its users to communication within its instance.
2020-05-18 02:17:43 +02:00
2020-07-06 23:41:17 +02:00
### Social & Discovery
2020-05-18 02:17:43 +02:00
2020-07-06 23:41:17 +02:00
Messages are addressed to a user at their home server, or published to a public inbox. Normal DNS and IP address routing are used to find the server addressed.
2020-06-08 21:29:01 +02:00
2020-07-06 23:41:17 +02:00
If posts are limited in visibility (followers only, direct message), they will be delivered to a user's inbox, such as `https://example.com/users/alice`.
2020-05-18 02:17:43 +02:00
2020-07-06 23:41:17 +02:00
Servers also may accept delivery of messages addressed as 'public' to a shared inbox available to all on the server, but are not required to. Social network implementations with public feeds may publish posts to the public inbox, such as `https://example.com/inbox`.
2020-05-18 02:30:31 +02:00
2020-07-06 23:41:17 +02:00
"Like"s and "Follow"s may be used by servers to determine which public messages to accept/retrieve.
The "outbox" is a URL where an actor's recent activities can be retrieved from.
There is no global search capability, as each server monitors a different set of messages. Searching for the same keyword on different instances yields different results. The federated timeline shows public posts that the user's server knows about. Essentially, users have access to posts of people followed by people on their instance.
2020-05-18 02:30:31 +02:00
2020-07-02 00:13:53 +02:00
### Privacy & Access Control
2020-05-18 01:53:01 +02:00
2020-07-06 23:41:17 +02:00
Server to server federation is authenticated using HTTP signatures in conjunction with the signing key from the actor's publicKey field. To verify object integrity, linked data signatures are used to sign the object with the publicKey of the actor who authored it.
2020-02-25 09:17:09 +01:00
2020-07-06 23:41:17 +02:00
When a remote server receives a POST to its inbox, it verifies the signature on the HTTP request by checking it against the sending server's publicKey.
Mastodon is currently [adding e2e encryption to ActivityPub](https://github.com/tootsuite/mastodon/pull/13820). Previously, messages were unencrypted on the server.
2020-05-18 01:53:01 +02:00
2020-07-02 00:13:53 +02:00
### Interoperability
2020-05-18 01:53:01 +02:00
2020-07-06 23:41:17 +02:00
Any service that implements the ActivityPub server-to-server protocol can interoperate with the ecosystem. A service like Twitter would need to add Webfinger and JSON-LD representations of users and tweets.
The client-to-server protocol is rarely used in practice, but defines a standard way for user client software to connect to ActivityPub servers, creating a universal client ecosystem. If it were widely used, a user application could mix and match different servers like Mastodon, Pleroma, PixelFed, and any new service that implemented the client-to-server protocol.
2020-05-18 02:17:43 +02:00
2020-06-08 21:29:01 +02:00
Diaspora, another federated social network, chose not to adopt ActivityPub. A Diaspora developer's reasoning for the decision is detailed in [this blog post](https://schub.wtf/blog/2018/02/01/activitypub-one-protocol-to-rule-them-all.html).
2020-05-18 02:17:43 +02:00
2020-05-18 01:53:01 +02:00
### Scalability
2020-06-08 21:29:01 +02:00
The ActivityPub ecosystem scales up by adding more server capacity to the network. This [study on the Mastodon ecosystem](https://emilianodc.com/PAPERS/mastodonIMC19.pdf) analyzes the emergence of points of centralization as the network scales up.
2020-05-18 01:53:01 +02:00
### Metrics
2020-06-08 21:29:01 +02:00
[fediverse.network](https://fediverse.network/) maintains statistics of the known oStatus/ActivityPub fediverse.
2020-05-18 01:53:01 +02:00
2020-06-08 21:29:01 +02:00
### Implementations
[W3C Implementation Report](https://activitypub.rocks/implementation-report/)
2020-05-18 02:17:43 +02:00
2020-07-06 23:41:17 +02:00
- [Mastodon](https://mastodon.social/about) (the largest federated network built on ActivityPub) has 2699 nodes and 2.6M users as of 5/2020 (Mastodon home page asserts 4.4M, a bit more than what the-federation.info stats provide; maybe some servers are not counted)
- [Pleroma](https://pleroma.social/) is another federated social network. According to stats at [the-federation.info](the-federation.info), Pleroma has 620 nodes with 35K users as of 5/2020.
- [PixelFed](https://pixelfed.org/) is an ActivityPub based image-sharing platform.
- [Friendica](https://friendi.ca/) is a decentralized social network with support for ActivityPub, as well as the OStatus and diaspora protocols.
- [PeerTube](https://joinpeertube.org/) is a free and decentralized video platform.
2020-06-08 21:29:01 +02:00
### Related
ActivityPub inherits from a few other protocols that will not be covered in full, but are briefly summarized here.
ActivityPub was based on pump.io and ActivityStreams. Conceptually, these were preceded by OStatus. Pump.io is an activity streams social networking server. [OStatus](https://en.wikipedia.org/wiki/OStatus) is an open standard for federated microblogging, and describes how a suite of protocols can be used together.
2020-05-18 02:17:43 +02:00
2020-06-08 21:29:01 +02:00
The IndieWeb protocols and community are also related to ActivityPub through a shared vision of social federation developed around the same time period. The IndieWeb was [inspired by the Federated Social Web Summit in 2010](https://www.manton.org/2019/07/08/interview-with-indieweb.html), and formed around the idea of interconnecting individual websites rather than federating social platforms. A co-founder described the vision as, "someone should be able to take their web site and be able to use their web site to participate in the same distributed social network — federated social network."
2020-05-18 02:17:43 +02:00
2020-05-18 01:53:01 +02:00
### Links
2020-06-08 21:29:01 +02:00
[W3C ActivityPub Spec](https://www.w3.org/TR/activitypub/)
[Social Web Working Group](https://www.w3.org/wiki/Socialwg)
[SocialHub, ActivityPub discussion forum](https://socialhub.activitypub.rocks/)
2020-07-06 23:41:17 +02:00
[Notes from an ActivityPub implementator](https://flak.tedunangst.com/post/ActivityPub-as-it-has-been-understood)
[Reading ActivityPub](https://tinysubversions.com/notes/reading-activitypub/)