Skip to main content

validate_code_input

Function validate_code_input 

Source
pub fn validate_code_input(
    raw: &str,
    policy: &CodePolicy,
) -> Result<String, CodeInputError>
Expand description

Validate and normalize raw user-supplied code input under policy.

Runs before any storage lookup so garbage never reaches the database (RFC-003 FR-2). Returns the canonical normalized string on success.

ยงErrors

Returns CodeInputError for empty input, raw input over the policy maximum, a normalized length mismatch, or characters outside the policy alphabet. All variants are intended to collapse to one generic public message (INV-8); the distinction is for internal diagnostics only.