pub fn normalize_user_code(code: &str) -> StringExpand description
Apply the Crockford Base32 decode mapping to a user code as typed by a user.
On top of uppercasing, this folds O onto 0 and I and L onto 1,
repairing a user who read a 0 as an O or a 1 as an I.
U is not in the alphabet but has no mapping defined for it either, so it
is passed through unchanged.
Crockford ignores hyphens when decoding, but we issue none, so nothing is stripped here: hyphens, whitespace and punctuation all just fail to match.
The mapping is lossy, so a caller which looks up both the code as the user
typed and its normalized form should try the code as typed first: a legacy
code containing I, L or O is otherwise shadowed by any live grant at
the code it folds onto. See the lookup in the device link handler.