Skip to main content

Module username

Module username 

Source
Expand description

Normalized username claims.

A username is not an identity. It is a label a device claims in a non-authoritative directory, and the identity it points at is the Address inside the signed record. Nothing in the protocol authenticates a username: anyone may claim any name, and the resolver’s job is to hand back every claimant rather than to pick one. See docs/spec/username-discovery.md.

§Why this is a type and not a String

A discovery tag is a hash of the normalized name. Two implementations that normalize differently derive different tags and silently fail to find each other — there is no error, no mismatch to observe, just an empty result for a name that exists. That is the whole failure mode this type exists to remove: normalization happens once, at parse, and the derivations downstream take Username rather than &str, so “derive a tag for whatever the app typed” does not compile.

It is the same move Address makes for routing tags, and for the same reason.

Structs§

Username
A normalized username claim: NFC, lowercase, bounded, never address-shaped.

Enums§

UsernameError
Why a username string was rejected by Username::from_str.

Functions§

contains_control_or_format
Whether s contains a character that renders as something other than itself: Unicode Cc (control) or Cf (format).