reiver-fediverse/id/syntax.html

265 lines
10 KiB
HTML
Raw Normal View History

2023-11-16 23:27:07 +00:00
<article>
2023-11-17 16:39:12 +00:00
<h1>Fediverse ID Syntax</h1>
2023-11-16 23:27:07 +00:00
<section>
<address class="h-card">
by
<a rel="author" class="u-url" href="http://changelog.ca/"><span class="p-given-name">Charles</span> <span class="p-additional-name">Iliya</span> <span class="p-family-name">Krempeaux</span></a>
</address>
</section>
<section>
<p>
2023-11-17 16:39:12 +00:00
Currently there is no canonical syntax for a <strong>Fediverse ID</strong>.
However, we can infer a syntax for the <strong>Fediverse ID</strong> given that it has to be used with <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link>.
</p>
</section>
<section>
<h2>De Facto </h2>
<p>
Currently, the syntax of a <strong>Fediverse ID</strong> is whatever each <ziba-link dir=".." name="software">Fediverse software</ziba-link> supports.
Which could be different from each other!
2023-11-17 16:50:06 +00:00
And could even change over time!
2023-11-16 23:27:07 +00:00
</p>
<p>
2023-11-17 16:39:12 +00:00
The final say for what is and is not a valid <strong>Fediverse ID</strong> are the many implementations of <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link> in-the-wild for all the different <ziba-link dir=".." name="software">Fediverse software</ziba-link> out there.
Which again could be different from each other!
2023-11-17 16:50:06 +00:00
And again could even change over time!
2023-11-16 23:27:07 +00:00
</p>
<p>
2023-11-17 16:39:12 +00:00
The reason being because, from a technical point-of-view, a <strong>Fediverse ID</strong> is turned into an <ziba-link dir=".." transform="lowercase">acct URI</ziba-link> and then resolved with <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link>.
2023-11-16 23:27:07 +00:00
</p>
<p>
2023-11-17 16:51:36 +00:00
But, having said that, we can infer a <em>minimum syntax</em> and a <em>maximum syntax</em> for what should be considered a valid <strong>Fediverse ID</strong>.
2023-11-17 16:39:12 +00:00
I.e., the syntax that any implmentation for <strong>Fediverse ID</strong>s <em>should</em> support.
But, to say it explicitly, an implemention for <strong>Fediverse ID</strong>s <em>could</em> support more than just what is given by thes syntaxes.
2023-11-16 23:27:07 +00:00
</p>
2023-11-17 16:51:36 +00:00
<p>
Perhaps oddly, the <strong>maximal syntax</strong> is simpler than the <strong>minimal syntax</strong>.
</p>
2023-11-17 16:39:12 +00:00
</section>
<section>
<h2>Maximal Fediverse ID Syntax</h2>
<p>
An <ziba-link dir=".." transform="lowercase">acct URI</ziba-link> has some constraints according to the IETF RFC-7565 (The 'acct' URI Scheme) specification.
But — software, such as <ziba-link dir=".." name="software">Fediverse software</ziba-link>, don't have to implement those constraints.
I.e., they can accept more than just what IETF RFC-7565 (The 'acct' URI Scheme) specifies.
</p>
<p>
Given that, here is a more <em>maximal</em> syntax for a <strong>Fediverse ID</strong>:
</p>
<pre>
fediverseID = "@" [ actor ] "@" host
</pre>
<p>
Where, given that NOTATSIGN (i.e., <em>not at-sign</em>) is any Unicode character that isn't the U+0040 ("@") at-signs —
</p>
<p>
actor is defined as:
</p>
<pre>
actor = NOTATSIGN *NOTATSIGN ; one or more characters that are not an at-sign ("@") (U+0040)
</pre>
<p>
And host is defined as:
</p>
<pre>
host = NOTATSIGN *NOTATSIGN ; one or more characters that are not an at-sign ("@") (U+0040)
</pre>
<p>
Note in this <em>maximal</em> <strong>Fediverse ID</strong> syntax actor is optional.
But when actor isn't included there still needs to be 2 U+0040 ("@") at-signs.
</p>
<p>
Here are some <strong>Fediverse ID</strong>s that fit this <em>maximal</em> <strong>Fediverse ID</strong> syntax:
</p>
<ul>
<li><code class="fediverseid">@joeblow@example.com</code></li>
<li><code class="fediverseid">@janedoe@something.example</code></li>
<li><code class="fediverseid">@reiver@mastodon.social</code></li>
<li><code class="fediverseid">@reiver@greatape.social</code></li>
<li><code class="fediverseid">@dariush@changelog.ca</code></li>
<li><code class="fediverseid">@malekeh@changelog.ca</code></li>
</ul>
<ul>
<li><code class="fediverseid">@دورود@example.com</code></li>
</ul>
<ul>
<li><code class="fediverseid">@@example.com</code></li>
<li><code class="fediverseid">@@something.example</code></li>
<li><code class="fediverseid">@@mastodon.social</code></li>
<li><code class="fediverseid">@@greatape.social</code></li>
<li><code class="fediverseid">@@changelog.ca</code></li>
</ul>
<ul>
<li><code class="fediverseid">@🙂@example.com</code></li>
2023-11-17 16:44:56 +00:00
<li><code class="fediverseid">@hello world :-)@something.example</code></li>
2023-11-17 16:39:12 +00:00
<li><code class="fediverseid">@(╯°□°)╯︵ ┻━┻@mastodon.social</code></li>
<li><code class="fediverseid">@😈❤️@greatape.social</code></li>
2023-11-17 16:44:56 +00:00
<li><code class="fediverseid">@✪@changelog.ca</code></li>
<li><code class="fediverseid">@awesome 🙂@changelog.ca</code></li>
2023-11-17 16:39:12 +00:00
</ul>
<ul>
<li><code class="fediverseid">@.@example.com</code></li>
<li><code class="fediverseid">@joe.blow@example.com</code></li>
<li><code class="fediverseid">@jane.doe@something.example</code></li>
<li><code class="fediverseid">@.reiver@mastodon.social</code></li>
<li><code class="fediverseid">@reiver.@greatape.social</code></li>
<li><code class="fediverseid">@d.a.r.i.u.sh@changelog.ca</code></li>
<li><code class="fediverseid">@.m.a.l.e.k.e.h.@changelog.ca</code></li>
</ul>
<ul>
<li><code class="fediverseid">@joeblow+@example.com</code></li>
<li><code class="fediverseid">@janedoe+@something.example</code></li>
<li><code class="fediverseid">@reiver+@mastodon.social</code></li>
<li><code class="fediverseid">@reiver+@greatape.social</code></li>
<li><code class="fediverseid">@dariush+@changelog.ca</code></li>
<li><code class="fediverseid">@malekeh+@changelog.ca</code></li>
</ul>
<ul>
<li><code class="fediverseid">@joeblow+tech@example.com</code></li>
<li><code class="fediverseid">@janedoe+psychology@something.example</code></li>
<li><code class="fediverseid">@reiver+fediverse@mastodon.social</code></li>
<li><code class="fediverseid">@reiver+allyourbases@greatape.social</code></li>
<li><code class="fediverseid">@dariush+one@changelog.ca</code></li>
<li><code class="fediverseid">@malekeh+two@changelog.ca</code></li>
</ul>
<ul>
<li><code class="fediverseid">@joeblow/tech@example.com</code></li>
<li><code class="fediverseid">@janedoe/psychology@something.example</code></li>
<li><code class="fediverseid">@reiver/fediverse@mastodon.social</code></li>
<li><code class="fediverseid">@reiver/allyourbases@greatape.social</code></li>
<li><code class="fediverseid">@dariush/one@changelog.ca</code></li>
<li><code class="fediverseid">@malekeh/two@changelog.ca</code></li>
</ul>
</section>
2023-11-16 23:27:07 +00:00
<section>
<h2>acct URI</h2>
<p>
2023-11-17 16:42:05 +00:00
Part of the process of <strong>resolving</strong> a <strong>Fediverse ID</strong> transfomrs a <strong>Fediverse ID</strong> into an <ziba-link transform="lowercase">acct URI</ziba-link>.
(And then using that <ziba-link transform="lowercase">acct URI</ziba-link> version of the <strong>Fediverse ID</strong> makes a request to <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link>.)
2023-11-16 23:27:07 +00:00
</p>
<p>
2023-11-17 16:42:05 +00:00
Here is an example of transforming a <strong>Fediverse ID</strong> into an <ziba-link transform="lowercase">acct URI</ziba-link>:
2023-11-16 23:27:07 +00:00
</p>
<pre>
at sign
@joeblow@example.com ← Fediverse ID
acct:joeblow@example.com ← acct URI
no at sign
</pre>
<p>
A client would then make a request to:
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
https://example.com/.well-known/host-meta
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
<p>
2023-11-17 16:39:12 +00:00
To discover what the (template) URL for <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link> is.
2023-11-16 23:27:07 +00:00
And then, for example, if it is at:
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
https://example.com/.well-known/webfinger?resource={uri}
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
<p>
Then make a request to:
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
https://example.com/.well-known/webfinger?resource=acct:joeblow@example.com
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
2023-11-17 16:39:12 +00:00
<p>
This <ziba-link dir=".." transform="lowercase">WebFinger</ziba-link> implementation <em>could</em> accept whatever it wants.
It doesn't have to restrict itself to what is specified by the IETF RFC-7565 (The 'acct' URI Scheme) specification.
BUT —
</p>
2023-11-16 23:27:07 +00:00
</section>
<section>
2023-11-17 16:39:12 +00:00
<h2>Minimal Fediverse ID Syntax</h2>
<p>
Let us consider what a <em>minimal</em> <strong>Fediverse ID</strong> syntax would be if we constrained ourselves to what the IETF RFC-7565 (The 'acct' URI Scheme) specificaiton says.
</p>
2023-11-16 23:27:07 +00:00
<p>
2023-11-17 16:39:12 +00:00
Here is what we get:
2023-11-16 23:27:07 +00:00
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
fediverseID = "@" actor "@" host
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
<p>
Where “actor” is defined as:
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
actor = unreserved / sub-delims 0*( unreserved / pct-encoded / sub-delims )
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
pct-encoded = "%" HEXDIG HEXDIG
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
<p>
(Again note that an implementation <em>could</em> support more characters for “actor” than what is given by this definition.)
</p>
<p>
And “host” is defined as
</p>
<pre>
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
h16 = 1*4HEXDIG
ls32 = ( h16 ":" h16 ) / IPv4address
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
reg-name = *( unreserved / pct-encoded / sub-delims )
2023-11-17 16:39:12 +00:00
2023-11-16 23:27:07 +00:00
</pre>
</section>
</article>