Module count

Source
Expand description

PKCE code verifier bytes count.

As per the standard, the length of the code verifier must be at least 43 and at most 128.

The core idea is that 43 and 128 correspond to Base64-encoded lengths of 32 and 96 bytes respectively (padding is not used).

This module provides the Count type, which represents the number of bytes before encoding and effectively creating the code verifier.

Count can be converted to Length, but not vice versa.

The type internally stores usize values, which are guaranteed to be in the range from MIN to MAX inclusively, defaulting to DEFAULT.

§Example

Converting from Count to Length value:

use pkce_std::{count::Count, length::Length};

let count = Count::default();

let length: Length = count.into();

assert_eq!(count.encoded(), length.get());

Structs§

Count
Represents byte counts.
Error
Represents errors that can occur when constructing Count values.

Enums§

ParseError
Represents sources of errors that can occur when parsing Count values.

Constants§

DEFAULT
The default count.
MAX
The maximum count.
MIN
The minimum count.