Skip to main content

generate_invite_code

Function generate_invite_code 

Source
pub fn generate_invite_code() -> Result<String>
Expand description

Generate a random, unguessable invite code of the form FEATHER-XXXXXXXX.

Draws from the OS CSPRNG (getrandom) and maps each byte onto [CODE_ALPHABET] via rejection sampling so the alphabet distribution is uniform (no modulo bias). Infallible in practice; a getrandom failure (no entropy source) propagates as an error rather than a weak code.