v6/site/posts/2019-09-22-activity-pub-res...

47 lines
4.2 KiB
Markdown
Raw Normal View History

2022-12-10 18:15:32 +00:00
```
title = "ActivityPub Resources"
tags = ["activitypub"]
date = "2019-09-22 17:50:42 -0400"
short_desc = "A compilation of resources I found useful in learning/implementing ActivityPub."
old_permalink = "/activitypub/2019/activity-pub-resources/"
use_old_permalink_for_comments = true
slug = "activity-pub-resources"
```
This isn't really going to be a blog most, but more of a collection of tidbits and resources I found helpful in implenting the [ActivityPub integration](/meta/2019/reincarnation/#activity-pub) for the new version of my blog.
2023-03-08 01:57:10 +00:00
This post was last updated on Mar 7, 2023.
2022-12-10 18:15:32 +00:00
<!-- excerpt-end -->
### Specs
- The [ActivityStreams 2.0 spec](https://www.w3.org/TR/activitystreams-core/) is important, as it's what ActivityPub is built on top of.
- Similarly, the [AS 2.0 Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/) defines all the objects and activities that AP actually uses in practice (and many more that it doesn't).
- The [ActivityPub spec](https://www.w3.org/TR/activitypub/) itself is quite useful, despite its many omissions.
- There's also [LitePub](https://litepub.social/litepub/), which has some extensions to AP.
2023-03-08 01:57:10 +00:00
- The least useful by far spec is [JSON-LD](https://www.w3.org/TR/json-ld/) which defines how to use JSON to represent linked data and object graphs. AS2 and AP are both built on this, but if you're going for a simple implementation (or even a complex one), you can entirely ignore this and treat JSON-LD as plain old JSON objects.
2022-12-10 18:15:32 +00:00
[This](https://tinysubversions.com/notes/reading-activitypub/) is also a helpful resource about how to go about reading the AP specification.
### Actually Federating
- Gargron's blog posts on [implementing a basic AP server](https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/) and [implementing HTTP signatures](https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/) are good guides for how to actually get federating with other servers in the wild.
- [Lain's blog post](https://blog.soykaf.com/post/activity-pub-in-pleroma/) on some of the weird quirks of how ActivityPub actually gets used.
- [Kaniini's blog post](https://blog.dereferenced.org/federation-what-flows-where-and-why) about how data actually moves through the fediverse.
### Reference Material
- Darius Kazemi has a [simple reference implementation](https://github.com/dariusk/express-activitypub/) of an ActivityPub server written using Node.js.
- I used the [Pleroma source code](https://git.pleroma.social/pleroma/pleroma/) a great deal when working on my implementation, mainly just because I'm familiar with Elixir.
- I'd also like to think [my own implementation](https://git.shadowfacts.net/shadowfacts/shadowfacts.net/src/branch/master/lib/activitypub) is fairly approachable (it's about 700 lines of not-too-complicated TypeScript).
- Ted Unangst has a collection of [sample data](https://jawn.tedunangst.com/a/R526ZQ49MbYt5J4KpR) which is useful for comparing how different implementations represent things in AP.
2023-03-08 01:57:10 +00:00
### Libraries
- [activitystreams](https://lib.rs/crates/activitystreams) for serializing/deserializing AS2 types in Rust
- [http-signature-normalization](https://lib.rs/crates/http-signature-normalization) for dealing with part of HTTP signatures in Rust
2022-12-10 18:15:32 +00:00
### Other
- For actually testing federation, [ngrok](https://ngrok.com/) is very useful for testing your implementations against others. It creates a tunnel from your local machine to a public domain with HTTPS already setup. Because your code is still running locally, you have access to all your usual debugging tools and can iterate rapidly.
- Testing against other implementations running locally (be it on your machine or inside a VM/container) lets you access debug logs and see what the other server is actually receiving, which can be quite useful.
- Darius Kazemi also wrote [an application](https://tinysubversions.com/notes/activitypub-tool/) that lets you send ActivityPub objects directly to other servers, which is useful for testing your application against outside data without polluting other people's instances.
- Ted Unangst also has his own [compilation of AP-related links](https://flak.tedunangst.com/post/ActivityPub-as-it-has-been-understood).