Skip to main content

Module handle

Module handle 

Source
Expand description

Handle syntax, as atproto specifies it.

A handle is a domain name, and this validator says only whether a string could be one. It is deliberately looser than crate::did’s hostname rules in two ways that matter:

  • Case is allowed. A.ISI.EDU is a syntactically valid handle: the spec’s answer to case is to lowercase before comparing, not to refuse. A did:web cannot do that, because the DID is compared byte for byte across the network and two spellings would be two identities.
  • .arpa is allowed. The atproto handle spec keeps “is this a legal handle string” separate from “is this a top-level domain handles may be registered under”, and puts .arpa, .local, .invalid and the rest in the second list. SRI-NIC.ARPA is in the upstream valid vectors for exactly that reason, and a caller that needs the second question asks it separately.

Nothing here touches DNS. A syntactically valid handle is one that could be resolved, not one that resolves.

Enums§

HandleError
Why a string is not a syntactically valid handle.

Constants§

ATPROTO_DID_PATH
Path an atproto handle resolves through over HTTPS.
DISALLOWED_TLDS
Top-level domains the atproto handle spec reserves: a handle under one is syntactically valid and never resolves.
MAX_HANDLE_LENGTH
Longest a handle may be, matching a DNS name.
MAX_SEGMENT_LENGTH
Longest any one segment may be, matching a DNS label.

Functions§

atproto_did_url
Where handle is resolved over HTTPS, or why it cannot be.
has_disallowed_tld
Whether handle sits under one of DISALLOWED_TLDS, compared without regard to case.
parse_atproto_did
Reads the body of an /.well-known/atproto-did response.
validate
Checks a string against the handle syntax rules.