Expand description
Account building blocks shared by WeirdBrains services (TAUR, Salty Gull).
Storage stays with the application: this crate holds the rules and the cryptography, and never opens a database.
password: Argon2id hashing (PHC strings) and the minimum-length rule.token: 256-bit random tokens handed out once; only their SHA-256 is stored.names: user-name and email checks.ratelimit: fixed-window per-client limits, generic over the app’s request classes, withX-Forwarded-Forhonoured only from trusted proxies.apikeys: org-scoped API keys with a visible prefix, scopes, optional app and channel bindings, expiry and revocation.
Re-exports§
Modules§
- apikeys
- Org-scoped API keys.
- error
- Errors. None carry passwords, tokens or keys.
- names
- User-name and email rules.
- password
- Argon2id password hashes in PHC string format.
- ratelimit
- Per-client rate limits. State is in memory, bounded, and not shared across processes.
- token
- Bearer tokens (sessions, email links): 32 random bytes as hex, stored only as SHA-256.
Functions§
- now
- Seconds since the Unix epoch (0 if the clock is before 1970).