As part of moving more of my attention over to ActivityPub/Mastodon, I've seen a couple posts like this one describing how you can configure your primary domain to contain information that can lead searches to find your Mastodon account.
Most often, this is useful for people who have their own blog but use one of the larger existing Mastodon instances for their social activity. I'm not quite in that circumstance, but I still wouldn't mind it if you could look up my name as "@firstname.lastname@example.org" and have it resolve to my actual account of "@email@example.com". Not a huge thing, but also seemingly not difficult to solve.
So, this morning, I set out to solve it. Before I get to the project I made, I'll make this clear: the reasonable way to do this would be to put a static JSON file up and have the "query" URL point to it. I didn't do it the reasonable way, but I didn't do it entirely unreasonably either.
How It's Done
The main mechanic in this sort of redirect lookup is WebFinger, a historically-but-disturbingly-named RFC from 2013. The idea of that is to be a HTTP-and-JSON-based equivalent for the sort of thing one used to use
finger for. As is often the case, it's generalized beyond the specific need here, and it'd be interesting to implement more of its options, but for now the useful part is to be able to lookup a "resource" like
acct:firstname.lastname@example.org to get account info.
Mastodon provides this and related services for users in its directory, but that wouldn't help for trying to alias a user that doesn't exist in there. Since I'm already using Domino for my user store, I decided to implement a simple version of this to look up this info from Domino itself.
WebFinger For Domino
Thus was born the WebFinger For Domino project, which I expect to be a minor project with few releases. This project includes a single Servlet, listening at "/.well-known/webfinger", and it only supports lookups of account resources in the format that Mastodon uses. If you visit, for example, "https://frostillic.us/.well-known/webfinger?resource=acct:email@example.com", you'll get output like this:
If you try to look up a user that doesn't exist or isn't explicitly configured to participate in this, you'll get a
404 Not Found response.
As when I added the "MastodonUsername" field to begin with, I implemented this by adding some new fields to my Person document:
These fields are included directly or used to compose the URLs above. The specifics are documented in the project README.
It seems to hold together well enough, in that I was able to successfully search for my user by "@firstname.lastname@example.org", and that's all I could ask. If you're using Mastodon and have your own Domino-backed domain, give the project a look.