AuthError
struct AuthErrorTyped error raised by the Authorization header parsers in this module (parse_bearer_token, parse_basic_credentials, _b64_decode).
Enumerated (_variant Int field) with comptime aliases
per condition. Equatable so callers can pattern-match with
e == AuthError.MISSING_HEADER etc. The detail field
carries human-readable extra context (the offending
character, the unexpected scheme, ...) — empty when the
variant is self-explanatory.
Variants:
MISSING_HEADER—Authorizationheader absent.EMPTY_VALUE— header present but empty after the colon.TOO_SHORT— header value too short to start with the expected scheme prefix (Beareris 7 bytes,Basicis 6).WRONG_SCHEME— scheme prefix doesn't match the parser called (e.g.Basicpassed toparse_bearer_token).EMPTY_TOKEN— scheme present but no token / credentials after it.B64_BAD_LENGTH— RFC 4648 base64 input length not a multiple of 4.B64_TOO_MUCH_PADDING— more than 2=pad bytes.B64_INVALID_CHAR— character outside the base64 alphabet.B64_PADDING_BEFORE_TAIL—=pad byte appears in a block that isn't the final block.MISSING_SEPARATOR— RFC 7617 Basic credentials decoded without a:separator between userid and password.
Implements Copyable, Equatable, ImplicitlyCopyable, Movable, Writable
- Fields
detail: String
comptime MISSING_HEADER = AuthError(Int(1), String(""))comptime EMPTY_VALUE = AuthError(Int(2), String(""))comptime TOO_SHORT = AuthError(Int(3), String(""))comptime WRONG_SCHEME = AuthError(Int(4), String(""))comptime EMPTY_TOKEN = AuthError(Int(5), String(""))comptime B64_BAD_LENGTH = AuthError(Int(6), String(""))comptime B64_TOO_MUCH_PADDING = AuthError(Int(7), String(""))comptime B64_INVALID_CHAR = AuthError(Int(8), String(""))comptime B64_PADDING_BEFORE_TAIL = AuthError(Int(9), String(""))comptime MISSING_SEPARATOR = AuthError(Int(10), String(""))__eq__
def __eq__(self, other: Self) -> Bool Compare on the _variant tag only — detail is human-readable context, not part of the identity.
__ne__
def __ne__(self, other: Self) -> Bool variant_name
def variant_name(self) -> String write_to
def write_to[W: Writer](self, mut writer: W)