Lockspire.Security.DeviceCode
(lockspire v1.0.0)
Copy Markdown
Utilities for generating secure device authorization codes.
Summary
Functions
Generates a high-entropy device code (minimum 256 bits of entropy)
using :crypto.strong_rand_bytes/1 and encodes it securely.
Generates a collision-resistant Base20 user code of length 8. Uses an alphabet that avoids vowels and similar-looking characters (1/I/L, 0/O). Returns a continuous 8-character string.
Functions
@spec generate_device_code() :: String.t()
Generates a high-entropy device code (minimum 256 bits of entropy)
using :crypto.strong_rand_bytes/1 and encodes it securely.
@spec generate_user_code() :: String.t()
Generates a collision-resistant Base20 user code of length 8. Uses an alphabet that avoids vowels and similar-looking characters (1/I/L, 0/O). Returns a continuous 8-character string.