Documentation
¶
Overview ¶
Package ids makes the identifiers and secrets Aboard hands out: sortable ids for records, bearer tokens, and short join codes. Randomness comes from a reader the caller supplies, so tests can make them repeatable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Digest ¶
Digest returns the keyed SHA-256 digest of a secret. Only digests are stored, so a copy of the database doesn't contain working tokens or join codes.
func NormalizeJoinCode ¶
NormalizeJoinCode turns what a person typed into the canonical "XXX-XXX" form. It accepts any case, with or without the dash, and reads O as 0 and I or L as 1.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator makes ids, tokens and join codes from one source of randomness.
func (*Generator) ID ¶
ID returns prefix + "_" + a 26-character ULID: 48 bits of milliseconds since the Unix epoch, then 80 random bits, so ids sort by creation time.