oxidite-auth
Authentication and authorization for Oxidite (RBAC, JWT, OAuth2, 2FA, API keys).
Installation
[]
= "0.1"
Usage
JWT Authentication
use *;
// Create JWT
let token = create_jwt?;
// Verify JWT
let claims = verify_jwt?;
Password Hashing
use *;
// Hash password
let hash = hash_password?;
// Verify password
let valid = verify_password?;
RBAC (Role-Based Access Control)
use *;
// Create role
let admin = Role ;
// Check permission
if user.has_permission
API Key Authentication
use *;
// Generate API key
let key = generate?;
// Validate
if validate.await?
2FA (Two-Factor Authentication)
use *;
// Generate secret
let secret = generate_totp_secret;
// Verify code
let valid = verify_totp?;
Features
- JWT token generation/verification
- Password hashing (Argon2)
- RBAC with roles and permissions
- API key authentication
- Two-Factor Authentication (TOTP)
- OAuth2 integration
- Email verification tokens
- Password reset tokens
License
MIT