Skip to main content

Module passport

Module passport 

Source
Expand description

The traveler’s Passport — one portable identity across the Thread.

Implements the browser side of passport-v0.1: hold the token for the traveler, read its claims, and fetch the descriptor (the portable “you”: name, avatar, consent) fresh from the issuer. The token comes from INFINITE_PASSPORT; the descriptor URL is the token’s avatar claim. Everything degrades gracefully — no passport means an anonymous traveler, never a gate on walking (spec §4).

Claims are decoded unverified here: the browser is the token’s holder, not a verifier — it reads its own claims for display and routing. Hosts and relays are the parties that verify keys-only against the issuer’s JWKS.

Structs§

AvatarDescriptor
avatar-v0.1 envelope — the portable “you” (spec §3 + avatar-v0.1).
Claims
The claims a browser reads from its own token (passport-v0.1 §2). Tolerant to extra fields; every field optional so a dev-issued or non-JWT opaque token still carries.
Descriptor
The fetchable descriptor (passport-v0.1 §3) — fetched fresh, rendered, discarded. Never persisted beyond the session.
DescriptorIdentity
DescriptorPool
Fetches co-travelers’ descriptors by the avatar URL the relay announced (welcome occupants / join broadcast), so the browser renders “them” from their Passport. Session-scoped and fetch-render-discard, per spec §3: nothing here outlives the run. Keyed by occupant id.
Passport
The traveler’s held Passport: the token, its claims, and (once fetched) the descriptor. Fetching runs on a background thread; call Passport::poll once per frame, like the other Loom clients.

Functions§

parse_color
Parse a descriptor colour ("#rrggbb") into linear-ish RGBA for rendering.