Skip to main content

parse_atproto_did

Function parse_atproto_did 

Source
pub fn parse_atproto_did(body: &str) -> Result<&str, SyntaxError>
Expand description

Reads the body of an /.well-known/atproto-did response.

The response is “the DID and nothing else”, but a text file served off a web server acquires a trailing newline the moment anybody edits it by hand, so surrounding whitespace is trimmed before the string is checked. Nothing else is repaired: a body carrying a second line, JSON, or an HTML error page a proxy substituted with a 200 is not a DID and is refused here rather than fetched.

The generic DID validator, not crate::AccountDid: the account on the other end of a handle may perfectly well be a did:plc, and narrowing that here would make this crate’s own strictness into a rule about everybody else’s identifiers.