nova_auth_token (nova_auth v0.2.0)
View SourceCryptographic token generation, hashing, and time-based validation. Tokens are base64-encoded random bytes, hashed with SHA-256 for storage.
Summary
Functions
Generate a random token using the default byte size.
Generate a random token with the specified number of random bytes.
SHA-256 hash a raw token for safe database storage.
Check if a token is still valid using the default session validity period.
Check if a token inserted at InsertedAt is within ValidityDays of now.
Functions
-spec generate() -> binary().
Generate a random token using the default byte size.
-spec generate(pos_integer()) -> binary().
Generate a random token with the specified number of random bytes.
SHA-256 hash a raw token for safe database storage.
-spec valid(calendar:datetime()) -> boolean().
Check if a token is still valid using the default session validity period.
-spec valid(calendar:datetime(), pos_integer()) -> boolean().
Check if a token inserted at InsertedAt is within ValidityDays of now.