Render a borrowed JID into a CompactString sized to what it actually
takes, so a group id or a LID that fits the 24 inline bytes never touches
the heap. Reserving user.len() + 20 up front, as the decoder used to,
exceeded the inline budget for every user longer than four characters and
heap-allocated unconditionally — once per JID token in a device-list or
usync response.
Privacy-aware redaction of a JID supplied as a string (e.g. a group jid &str
in a span field). Parses it and applies Jid::observe; if it does not parse,
falls back to a keyed token so a raw number can never leak. Honors tracing-pii.
Per-process keyed token for a sensitive string: a SipHash with a random key
created once per process. Stable within a run (so the same value correlates
across spans) but not precomputable from the input, so exported traces cannot
be brute-forced back to the original (e.g. an E.164 phone number). Public so
other layers can redact non-Jid identifiers (e.g. a Signal ProtocolAddress
name, which embeds a phone number) with the same keyed scheme. On browser WASM,
unavailable entropy yields the opaque token zero for every input, disabling
correlation without falling back to a guessable key.
Single-pass JID parser optimized for hot paths.
Scans the input string once to find all relevant separators (@, :)
and returns slices into the original string without allocation.
A message id, inline: WhatsApp ids are 20–32 hex/base64 characters, and
every client-generated one is 22, so the common case pays no heap
allocation per message, per receipt id and per dedup-cache key.