Auth Types
Auth types provide secure handling of credentials and tokens.
Reference
Section titled “Reference”| Type | Expands To |
|---|---|
col.username() | string(50) + pattern + min(3) |
col.password_hash() | string(255), hidden from API |
col.token() | string(64), for API keys |
Example
Section titled “Example”export default table({ id: col.id(), username: col.username(), password_hash: col.password_hash(), api_token: col.token(),});Username Pattern
Section titled “Username Pattern”Usernames must be at least 3 characters, lowercase alphanumeric with underscores:
^[a-z0-9_]+$This pattern enforces:
- Lowercase letters only (a-z)
- Numbers allowed (0-9)
- Underscores allowed (_)
- Minimum length of 3 characters (enforced via min constraint)
- Maximum length of 50 characters (enforced via string length)
Password Hash
Section titled “Password Hash”The password_hash column is automatically excluded from API responses. Always
hash passwords before storage—never store plaintext.
64-character string suitable for API keys and session tokens. Generate using cryptographically secure random functions.