Expand description
Minting and validating the did:web identifiers that agents get.
Structs§
- Account
Did - A validated
did:webbelonging to one agent. - Zone
- The DNS zone agents are minted under, plus the port their PDS listens on during development.
- Zone
Registry - Several
Zones under one server. They may nest — a zone atdev.agents.botunder a deployment that also mints fromagents.botis fine — because nesting is not actually ambiguous: a wildcard certificate matches exactly one label, so*.agents.botcoversfoo.agents.botand does not coverfoo.dev.agents.bot. The two namespaces do not intersect. The single point of contact between them isdev.agents.botitself, which the outer zone could otherwise mint as an agent name, and that is guarded separately — by reserving the inner zone’s apex label in the outer zone’s own name registry, not by refusing the pair here. What this type does check is what only a set of zones can violate: the same hostname configured twice.
Enums§
- DidError
- Why a string is not a usable agent
did:web. - Syntax
Error - Why a string is not a syntactically valid DID of any method.
- Zone
Registry Error - Why a set of zones could not be assembled.
Constants§
- DID_
JSON_ 🔒PATH - Path the DID document is served at, per the
did:webmethod. - DID_
WEB_ 🔒PREFIX - The prefix every DID this crate handles starts with.
- ENCODED_
COLON 🔒 - The only percent escape an atproto
did:webmay contain: the colon that separates a bare loopback hostname from its port. Uppercase hex only, because the spec says “DIDs are case-sensitive” and implementations “should reject DIDs with invalid casing” — one spelling keeps comparison a byte compare. - MAX_
DID_ LENGTH - Hard cap on DID length, from the atproto DID specification: “DID identifiers do not generally have a maximum length restriction, but in the context of atproto, there is a current hard limit of 2048 characters.”
- RESOLVE_
PORTS - The environment variable naming which port a loopback hostname’s
documents answer on, as
host=portpairs separated by commas.
Functions§
- account_
name - How a person reads an account’s name in a command’s output.
- canonical_
did - A DID from a URL, spelled the way this project stores it.
- decode_
authority 🔒 - Turns the method-specific identifier into a decoded
hostorhost:port. - did_
web_ for_ host - The
did:weba hostname spells. - host_
without_ port - A hostname without the port it is reached on.
- hostname_
is_ at_ or_ below - Whether
hostisancestoror a subdomain of it. - is_
loopback_ host - Whether a hostname resolves to this machine.
- is_
loopback_ literal - Whether a hostname is one of the bare loopback names the atproto profile permits a port on.
- parse_
port 🔒 - Reads the port half of a decoded authority, in one spelling only.
- resolve_
port - The port
RESOLVE_PORTSgiveshost, if it gives one. - validate_
did - Checks a string against the generic atproto DID syntax rules.
- validate_
hostname 🔒 - Checks a decoded hostname: lowercase DNS labels, no empties, no
.arpa. - validate_
label - Checks one DNS label. Uppercase is rejected rather than normalized: a DID is compared byte for byte across the network, so two spellings of one identity would be two identities.