Skip to main content

Module normalize

Module normalize 

Source
Expand description

Code normalization (RFC-003 FR-2, INV-4).

Normalization must be identical on the issue path and the redeem path, and idempotent (normalize(normalize(x)) == normalize(x)), or valid codes fail to match their stored lookup key.

§Compatibility note

Normalization strips ASCII whitespace and hyphens and uppercases ASCII letters — and nothing else. In particular it does not drop the visually ambiguous characters 0 1 O I L (those are merely excluded from the generation alphabet, RFC-003 §4). codlet reproduces that exact behavior so existing service codes keep matching. The ambiguity handling lives in super::alphabet, not here.

Functions§

normalize
Normalize raw code input into its canonical form: strip ASCII whitespace and -, uppercase ASCII letters, leave everything else untouched.