Generates a cryptographically random one-time code.
Uses the 32-character alphabet ABCDEFGHJKLMNPQRSTUVWXYZ23456789, excluding
I, O, 0, and 1. Each character carries five bits of randomness, so
the default eight-character code has 40 bits of entropy.
Parameters
length: number = 8
Number of characters, defaulting to eight. Use a non-negative
integer no greater than 65,536, the Web Crypto random-byte limit.
Returns string
A random code, or an empty string when length is zero.
Throws
When the byte length is invalid or Web Crypto rejects the request.
Generates a cryptographically random one-time code.
Uses the 32-character alphabet
ABCDEFGHJKLMNPQRSTUVWXYZ23456789, excludingI,O,0, and1. Each character carries five bits of randomness, so the default eight-character code has 40 bits of entropy.