Skip to main content

Module code

Module code 

Source
Expand description

One-time code policy, generation, normalization, and validation (RFC-003).

The four representations of a code are kept distinct (RFC-003 §11.2): generated plaintext and user input are crate::secret::PlainCode / normalized String (secret, never persisted); the persisted value is a crate::hashing::LookupKey derived in the crate::hashing module.

Re-exports§

pub use alphabet::Alphabet;
pub use alphabet::DEFAULT_ALPHABET;
pub use generate::generate_code;
pub use generate::validate_code_input;
pub use normalize::normalize;
pub use policy::CodePolicy;
pub use policy::DEFAULT_MAX_RAW_LEN;
pub use policy::SECURE_MIN_HUMAN_LENGTH;
pub use policy::SHORT_COMPAT_LENGTH;

Modules§

alphabet
Code alphabet (RFC-003).
generate
Code generation (RFC-003 §4, FR-1) and input validation (FR-2).
normalize
Code normalization (RFC-003 FR-2, INV-4).
policy
Code policy (RFC-003 §3, §11.1).