How to retrieve "user@server.tld" handle from actor's URL

Hello,

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?

Thanks :slight_smile:

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.

A few issues related to this:

2 Likes

Alright, I’ll use that then, thanks a lot!

@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 :pray:

So that hopefully the next AP dev can find everything in one place :hugs:


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.

Example:

https://social.hackersatporto.com/.well-known/webfinger?resource=https://social.hackersatporto.com/index.php/user/1

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).

1 Like

“preferredUsername” could be similar to a field we used in solid called “nick” which came from FOAF

http://xmlns.com/foaf/spec/#term_nick

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.

1 Like

That what I would have expected initially, a field with the full handle (username and domain) available directly in the actor data.

1 Like

FEP-2c59 introduces webfinger, a new property of an actor object: https://codeberg.org/fediverse/fep/src/branch/main/fep/2c59/fep-2c59.md

Discussion: FEP-2c59: Discovery of a Webfinger address from an ActivityPub actor

1 Like