I’m assuming you don’t mean Mastodon literally here since the Webfinger resolution in that context would require an “acct:” URI for the user actor. However, for another server implementation, would the following work (ignoring Mastodon interop for the moment)?
https://server.example/.well-known/webfinger?resource=https://server.example/
returning…
{
"subject": "https://server.example/",
"links": [
{
"rel": "https://www.w3.org/ns/activitystreams#Application",
"type": "application/activity+json",
"href": "https://server.example/ApplicationActor"
},
{
"rel": "self",
"type": "application/activity+json",
"href": "https://server.example/"
}
]
}
That’s not compatible with Mastodon, so for interop one might also want to support:
https://server.example/.well-known/webfinger?resource=acct:user@server.example
returning…
{
"subject": "acct:user@server.example",
"links": [
{
"rel": "self",
"type": "application/activity+json",
"href": "https://server.example/"
}
]
}