Dev's NoxDev's Nox
Federation

Overview

The NOX ActivityPub actors and WebFinger discovery

NOX does not only federate accounts: a world, a mod, an avatar, a running instance and the node itself each have an ActivityPub actor. They all answer the same way, under the /ap prefix.

Federated types

EntitySegmentActivityPub typeActorREST resource
UseruPerson/ap/u/hactazia/api/users/hactazia
InstanceiGroup/ap/i/48/api/instances/48
WorldwGroup/ap/w/cozy/api/worlds/cozy
ModmApplication/ap/m/nox.ui/api/mods/nox.ui
AvataraApplication/ap/a/1/api/avatars/1
Node—Service/ap/server—

The segment is the one of the asset controllers (@AssetController): w, m and a are already the letters used everywhere in NOX, so the actor is addressable like the rest.

Actors receive nothing: NOX has a single shared inbox (/ap/inbox), published in endpoints.sharedInbox of every document.

Routes

RouteContent
GET /ap/serverThe actor of the node itself (Service)
GET /ap/u/{username}The actor of a user (Person)
GET /ap/i/{id}The actor of an instance (Group)
GET /ap/{segment}/{id}The actor of an asset, by its segment and id/slug
GET /ap/{segment}/{id}/outboxEmpty outbox of an asset actor
POST /ap/inboxThe shared inbox
POST /ap/u/{username}/inboxThe inbox of a user

An unknown target answers 404 — never an empty document.

Mount point

Both surfaces are mounted the same way, each with its own variable, and an empty value serves them at the root of a dedicated host:

VariableDefaultEffect
HTTP_PREFIXapiPrefix of the REST API — …/api/users/hactazia
AP_PREFIXapPrefix of ActivityPub — …/ap/w/cozy

With AP_PREFIX= and GATEWAY_ACTIVITYPUB=https://ap.example.org/, the same actor answers at https://ap.example.org/w/cozy. Both settings are read at boot and need a restart.

WebFinger discovery

GET /.well-known/webfinger?resource=<resource>

The resource accepts the following forms, on the local hosts (address, web base, ActivityPub base):

ResourceTarget
acct:hactazia@hactazia.fruser (bare identifier)
acct:w:cozy@hactazia.frasset, prefixed with its segment
acct:i:48@hactazia.frinstance
acct:server@hactazia.frthe node
acct:hactazia.fr@hactazia.frthe node, by its address (Mastodon's instance-actor form)
https://nox.hactazia.fr/ap/w/cozythe actor it addresses
https://nox.hactazia.fr/u/hactaziasame, through a front route

Only users answer a bare identifier: a username is unique, while cozy names both a world and a mod — the other types therefore carry their segment.

The returned JRD document contains the following links:

relhref
http://webfinger.net/rel/profile-pagethe web page of the entity
selfthe ActivityPub document (actor)
nox/1.0the equivalent REST resource
http://webfinger.net/rel/avatarthe profile image, when it exists

The nox/1.0 link (the same relation as in .well-known/nodeinfo) lets a peer that resolved an actor read the same entity through the API, with the identifier it already holds.

REST payload aliases

Every entity exposes its entrypoints in its alias, so a client never has to build a URL:

KeyValue
apithe REST resource
activitypubthe actor document
webthe front page
acctthe Nox identifier (acct:w:cozy@hactazia.fr)
webfingerthe WebFinger URL that resolves this identifier
"alias": [
  { "key": "api", "value": "https://nox.hactazia.fr/api/worlds/1" },
  { "key": "activitypub", "value": "https://nox.hactazia.fr/ap/w/cozy" },
  { "key": "web", "value": "https://nox.hactazia.fr/w/cozy" },
  { "key": "acct", "value": "acct:w:cozy@hactazia.fr" },
  { "key": "webfinger", "value": "https://nox.hactazia.fr/.well-known/webfinger?resource=acct:w:cozy@hactazia.fr" }
]

On this page