I’m the main dev of Libervia and I’m currently working on an ActivityPub <=> XMPP gateway (the one who got a grant from NLnet).
Is there a way to get user@server.tld handle from actor’s URL? The other way around it’s easy with webfinger, but I would like to retrieve the handle, and the only thing that I see in actor’s data is preferredUsername which could be coupled to the known server hostname, but that doesn’t seems right as preferredUsername has no uniqueness guaranty, and that should be something that user can modify.
Thus is there any reliable way to retrieve the short handle from actor’s URL?
The user@server.tld form is WebFinger, but AP doesn’t explain how to handle that, there’s only the global identifier. So even though the AP spec says no uniqueness guaranty, most implementations make the preferredUsername unique to make this easier.
So I would always try recomposing user@server.tld from preferredUsername, then perform a WebFinger query to check again that both AP IDs match.
@tcit and @Goffi it would be truly wonderful if you might spare a bit of time and update our crowdsourced “Implementers Guide” should it be incomplete on this subject
So that hopefully the next AP dev can find everything in one place
Update: For now I just copied/pasted in the list of resources at the webfinger section of the guide.
I can’t talk for every WebFinger implementation, although I think this aspect is always the same. In GNU social, if you use the actor URL as the webfinger resource, it will be a valid alias and therefore you are able to retrieve the acct:handle.
Note that the subject will be the requested resource, but in the aliases array you’ll find the acct:diogo@social.hackersatporto.com.
So, another idea would be requesting to webfinger for the actor id and retrive the handle from the alises (foreach alias, isAcct followed by remove acctPrefix).
These tend to be short forms without the domain. I think there’s value in having something that also has the domain, because it allows for machine readable data and automation, without having to read a spec. It’s not ideal to have a webfinger dependency in here and extra round trip, when it could be avoided.
I think it would be better to explicitly add the string used for mentions in a user (actor) URL
We possibly could extend the fediverse with a FEP to add this field, but it would require consensus on what to call it.
Off the top of my head, handle might be a good name for it.
Thanks for the info. But it’s really not clear if it’s something accepted by some implementations, or something which can be counted on everywhere. In other words, this should be specified.