Expand description
Where an identifier’s authority comes from.
Every rule of the form “the key must belong to the actor’s server” or “an object fetched from here must say it is from here” compares origins, and an origin is one of two things:
- for an
httporhttpsIRI, its scheme, host and port, as the web defines an origin; - for an
ap://IRI (FEP-ef61) or a DID URL, the DID: a portable object is vouched for by the key that controls it, wherever it is served from. So is a portable object’s compatiblehttpsidentifier at a gateway,https://gateway.example/.well-known/apgateway/did:key:…/path: the gateway is where it is, not who vouches for it.
The rules are written once against Origin, never against hostnames, so
that portable objects are the same rules over a second kind of origin.
Enums§
- Origin
- An identifier’s origin.
- Port
- What
normalize_hostdoes with a port.
Functions§
- host_of
- The host of the URL
iri, without its port, in the form hosts are compared in: lower case, an internationalised name in its ASCII form, an IPv6 address in brackets.Nonewheniriis not a URL or has no host. This is the host Mastodon’sAddressable::URI.parse(url).normalized_hostreads, by which it tracks deliveries and matches domain blocks. - host_
within - Whether
hostisparentor one of its subdomains, without regard to case:a.example.comandexample.comare withinexample.com, andnotexample.comis not. This is how a block on a domain covers its subdomains, as Mastodon’sDomainBlock.rule_formatches every suffix of a host. An empty parent has nothing within it. - normalize_
host - A host as written by hand — a domain typed into a form, or taken from a
handle — in the form hosts are compared in: lower case, percent-encoding
decoded, an internationalised name in its ASCII form (IDNA), and a single
trailing dot left off, as
Addressable::URI#normalized_hosthas it. The port is kept or left out asportsays.Nonewhen it is empty or is not a host, such as one with a space,/or@in it. - same_
authority - Whether
aandbhave the same authority, as a rule that only cares which server vouches for an identifier compares them: the same DID for portable identifiers, and forhttpandhttpsones the same host, whatever their schemes and ports, compared without regard to case. A portable identifier never has the authority of a web one, and an identifier that is neither has none. - same_
host - Whether
comparisonis anhttporhttpsURL on the same host asbase, whatever their schemes and ports: Mastodon’snon_matching_uri_hosts?, negated, which is how it decides that a collection page or a pinned post is on an account’s server. Hosts are compared without regard to case. - same_
origin - Whether
aandbhave the same origin. An identifier with no origin Ojak recognises is never the same as anything.