Wednesday, January 8, 2025

You can leverage your own domain as an identity anchor by setting up a local WebFinger instance without requiring internet-hosted servers. To do this, you’ll need to: * Obtain and install a reliable DNS service that allows for custom DNS records * Set up a simple web server (like Apache or Nginx) on your device * Install the required software for running a local WebFinger server With these elements in place, you can host a WebFinger instance on your own domain.

Mastodon is a free, open-source, decentralized, and distributed social networking platform. The decentralized social networking platform was launched in 2016 as an alternative to centralised social media giants like Twitter and Facebook.

Mastodon’s key feature includes leveraging the WebFinger protocol, allowing users to locate and access information about other community members through seamless discovery and authentication. WebFinger is a simple HTTP-based protocol enabling individuals to discover information about various customers or assets online by utilizing their email address or other identifying data. As a crucial component of the Mastodon ecosystem, the WebFinger protocol enables seamless discovery and following of users across different instances, regardless of their hosting location.

When invoking an endpoint via WebFinger, it relies on the standard “well-known” path convention. You may be familiar with the robots.txt convention. While we all concur that robots.txt plays a crucial role in controlling access to our online spaces, its presence undoubtedly occupies a prominent position.

The WebFinger protocol operates as a simple, HTTP-based mechanism allowing users to discover information about various entities online, leveraging email addresses or other identifying data. My website’s final title is .com; therefore, my private WebFinger API endpoint exists right here.

The concept is that…

  1. When someone initiates a WebFinger query towards a server, they employ their email address or alternative identifying information regarding the individual or resource they are attempting to locate.

  2. The server successfully retrieves the requested information from its database and returns a JSON object that provides detailed information about the person or resource in question. The JSON object in question is commonly referred to as a “useful resource descriptor.”

  3. When a consumer receives the valuable resource descriptor, they display the information to the individual in question.

The useful resource descriptor encompasses a comprehensive array of information regarding the individual or resource, including their name, profile image, and links to their social media profiles or other online assets. The digital identity system is likely to incorporate various types of information, including the individual’s public key, which enables secure referencing.

There’s . From that web page:

GET }

When referring to Mastodon user handles, remember that they typically start with the @ symbol followed by the username and server details, such as @username@someserver.com. Now I can tweet as @Shanahan or reach me at @hanselman.com – the perfect digital duality!

Searching for me with Mastodon

So maybe

Mine returns

{
"topic":"acct:shanselman@hachyderm.io",
"aliases":
[
"https://hachyderm.io/@shanselman",
"https://hachyderm.io/users/shanselman"
],
"hyperlinks":
[
{
"rel":"http://webfinger.net/rel/profile-page",
"type":"text/html",
"href":"https://hachyderm.io/@shanselman"
},
{
"rel":"self",
"type":"application/activity+json",
"href":"https://hachyderm.io/users/shanselman"
},
{
"rel":"http://ostatus.org/schema/1.0/subscribe",
"template":"https://hachyderm.io/authorize_interaction?uri={uri}"
}
]
}

application/octet-stream

The Startup.cs file in my ASP.NET Razor Pages website features a simple mapping of the well-known URL to a webpage and route that returns the desired JSON output.

companies.AddRazorPages().AddRazorPagesOptions(choices =>
{
choices.Conventions.RemovePageRoute("/robots.txt");
choices.Conventions.AddPageRoute("/webfinger", "/.well-known/webfinger");
choices.Conventions.AddPageRoute("/webfinger", "/.well-known/webfinger/{val?}");
});

Be aware that you’ll need to doubly escape @@ websites because it’s Razor syntax.

@web page
@{
Structure = null;
this.Response.ContentType = "software/jrd+json";
}
{
"topic":"acct:shanselman@hachyderm.io",
"aliases":
[
"https://hachyderm.io/@@shanselman",
"https://hachyderm.io/users/shanselman"
],
"hyperlinks":
[
{
"rel":"http://webfinger.net/rel/profile-page",
"type":"text/html",
"href":"https://hachyderm.io/@@shanselman"
},
{
"rel":"self",
"type":"application/activity+json",
"href":"https://hachyderm.io/users/shanselman"
},
{
"rel":"http://ostatus.org/schema/1.0/subscribe",
"template":"https://hachyderm.io/authorize_interaction?uri={uri}"
}
]
}

When hosting websites for individuals, I may want to incorporate URLs that feature the person’s title, followed by mapping those to their respective aliases and returning them accordingly?

By leveraging the JSON file from your Mastodon server’s webfinger response, you can easily save and replicate it on your own personal server. Simply download the file and store it locally for future use.

As long as your server correctly responds with the expected JSON data at that universally recognized URL, the solution will function accordingly.

So that is the template from the place I’m hosted now?

To start using Mastodon, begin now! It seems to emulate the early days of Twitter, minus its ownership and foundation in Internet standards such as ActivityPub.

Hope this helps!

About Scott

Scott Hanselman is a former academic, having held the position of professor, as well as serving as the Chief Architect in the financial sector. Currently, he occupies roles as a prominent speaker, trusted guide, devoted father, and individual living with diabetes, while also working at Microsoft. A struggling entertainer, part-time hairstylist, and aspiring digital author.

 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles