Skip to main content

Module code

Module code 

Source
Expand description

Human-friendly pairing code generator.

8 chars from ABCDEFGHJKLMNPQRSTUVWXYZ23456789 (no 0/O/1/I/L), retried up to 500 times if the generator collides with an already-active code in the store.

Constants§

ALPHABET
LENGTH

Functions§

generate_unique
Generate a code that does not collide with any entry in existing. Returns Err after MAX_ATTEMPTS collisions — caller should surface that as a 5xx-equivalent: the keyspace is large (32^8 ≈ 10^12), so 500 collisions in a row means something else is wrong (e.g. RNG broken).
random