Webfinger
Most AP services, including Mastodon, require all actors to have a webfinger handle,
whose user part corresponds to the Actor's preferredUsername
property.
The webfinger response must contain a link with rel: "self"
,
type: "application/activity+json"
and an href pointing to the
URL of the actor endpoint.
Other optional webfinger data provided by Mastodon include:
- "rel": "http://webfinger.net/rel/profile-page"
- For ther user's HTML profile page
- "rel": "http://ostatus.org/schema/1.0/subscribe"
- To enable remote interactions. Hugh Rundle has a good blog post on this.
- "rel": "http://webfinger.net/rel/avatar"
- For the user's avatar
Actor
The ActivityPub sepecification requires
all Objects to have an ID and a type, and
Actors to have an inbox
and an outbox. The ActivityStreams spec provides a small number of
Actor types,
at least one of which should be used as your Actor's type.
Furthermore, due to the reliance on webfinger Mastodon and other platforms require
a preferredUsername.
Serialization
According to the ActivityStreams spec, you must
serialize your JSON output
using the standard JSON-LD Compaction Alorithm using the default ActivityStreams context
(as well as any other contexts you wish to use).
This is actually quite convenient from a practical standpoint, since you don't need to run
the JSON-LD expansion process on a document if you're only reading the base vocabulary (if you're using
extensions you still _should_ expand the document, especially if it's a vocabulary that's less well-used
in the fediverse in general).