visit
Currently, I'm . But, perhaps I'll join my friends at or set up my own frankel.social
in the future? In both cases, I'll need to change the suffix of my handle.
Yet, I publish my handle on many sites and don't want to forget any updates when migrating. Hence, I require that the handle must be immutable.
I mentioned above that Mastodon nodes belong to a network named Fediverse. Fediverse nodes may be connected through several different protocols. Mastodon nodes uses . Underneath, ActivityPub relies on WebFinger to find the correct location of a handle.
Mastodon needs to translate @[email protected]
to . The translation must happen on any Mastodon instance, regardless of its domain. The process is based on the , aka RFC 7033:
WebFinger as described in is a spec that defines a method for resolving links to a resource, given only a URI on a particular server. This allows anyone to look up where a resource is located without having to know its exact location beforehand; for example, by email or phone number. This lookup is directed at the endpoint
/.well-known/webfinger
, and aresource
query parameter is passed along with the lookup. The resource URI used with Mastodon is theacct:
URI as described in , with the username of a profile that is hosted on a particular domain.--
{
"subject":"acct:[email protected]",
"aliases":[
"//mastodon.top/@frankel", #1
"//mastodon.top/users/frankel" #1
],
"links":[
{
"rel":"//webfinger.net/rel/profile-page", #2
"type":"text/html",
"href":"//mastodon.top/@frankel"
},
{
"rel":"self",
"type":"application/activity+json",
"href":"//mastodon.top/users/frankel"
},
{
"rel":"//ostatus.org/schema/1.0/subscribe",
"template":"//mastodon.top/authorize_interaction?uri={uri}"
}
]
}
rel
for Mastodon
Given this, I can search on with @[email protected]
(or any handle @frankel.ch
), and it returns the expected results:
I checked on other instances, e.g., , but it doesn't work. The reason is simple. When searching on the instance you're logged in, the XHR is ; when not, it's .
The documentation confirms that if resolve
is false
, then the query doesn't try to use WebFinger:
resolve
Boolean. Attempt WebFinger lookup? Defaults to false.
--
The theory behind Mastodon and WebFinger is fascinating. I've managed to configure my immutable mastodon handle @[email protected]
. That's the handle I can communicate to potential followers: if I move to another server, I'll update the webfinger
with my new coordinates.
The trick works because I'm the only Mastodon user on my domain. If you have several, you'll need to go beyond a static page to return a different ID depending on the acct:
parameter; the rest stays the same.
To go further:
Originally published at on December 18th, 2022
Photo by on