Skip to main content

generate_user_code

Function generate_user_code 

Source
pub fn generate_user_code() -> String
Expand description

Generate a human-typable user_code for the OAuth 2.0 Device Authorization Grant (RFC 8628).

The code is 8 characters of Crockford base32 (no I, L, O, U), formatted as two dash-separated groups: XXXX-XXXX. Characters are drawn from a cryptographically secure RNG. The alphabet has 32 symbols, so index selection over 0..32 is bias-free.