Expand description
Configuration types for RustAuth core.
§Hooks
RustAuth supports three hook registration paths:
- Global HTTP hooks — build
GlobalHooksOptionsand register it withRustAuthOptions::hooks. These run before/after matched API endpoints (parity with Better Authhooks). - Init-time database hooks — build
InitDatabaseHooksOptionsand register it withRustAuthOptions::init_database_hooks. Prefer this for typed create/update callbacks on core models (user,session,account,verification). SeeRustAuthOptionsfor when to combine this with low-level hooks. - Low-level plugin database hooks — append
crate::plugin::PluginDatabaseHookviaRustAuthOptions::database_hookfor custom models, plugin-owned tables, or operations that do not fit the init-time schema.
Structs§
- Account
Linking Options - Account
Options - Account and OAuth account behavior.
- Advanced
Options - Change
Email Confirmation - Payload for notifying the current email address about a pending change.
- Change
Email Options - Email change behavior.
- Cookie
Attributes Override - User-supplied cookie attribute defaults.
- Cookie
Cache Options - Session cookie cache configuration.
- Cookie
Config - Cross-subdomain cookie configuration.
- Database
Model Hooks - Create/update hooks for one core model.
- Database
Operation Hooks - Before/after hook pair for a single mutation kind.
- Default
Error Page - Delete
Account Verification Email - Payload for delete-account verification emails.
- Delete
User Options - User deletion behavior.
- Dynamic
Rate Limit Path Rule - Email
Password Options - Email/password authentication configuration.
- Email
Verification Callback Payload - Payload passed to email verification lifecycle callbacks.
- Email
Verification Options - Email verification configuration.
- Existing
User Sign UpPayload - Payload passed when an existing user attempts email/password sign-up.
- Experimental
Options - Experimental feature flags.
- Global
Hooks Options - Global before/after hooks applied to every matched endpoint.
- Hybrid
Rate Limit Options - Init
Database Hooks Options - Structured init-time database hooks for core models.
- IpAddress
Options - Model
Schema Options - Table and column alias overrides for a core auth model.
- OnApi
Error Options - Configuration for unhandled API errors.
- Password
Options - Password policy configuration.
- Password
Reset Email - Payload passed to the password reset email sender.
- Password
Reset Payload - Payload passed to password reset lifecycle callbacks.
- Rate
Limit Consume Input - Rate
Limit Decision - Rate
Limit Options - Rate limiting defaults.
- Rate
Limit Path Rule - Rate
Limit Record - Rate limit storage record.
- Rate
Limit Rule - A single rate-limit bucket rule.
- Rust
Auth Options - Top-level RustAuth configuration.
- Session
Additional Field - Runtime metadata for custom session fields accepted by
/update-session. - Session
Options - Session configuration.
- Telemetry
Options - Telemetry collection settings (parity with Better Auth
telemetryinit option). - User
Additional Field - Runtime metadata for custom user fields accepted by user-writing endpoints.
- User
Options - User lifecycle configuration.
- Verification
Email - Payload passed to an email verification sender.
- Verification
Options - Verification token storage options.
Enums§
- Cookie
Cache Strategy - Cookie cache encoding strategy.
- Deployment
Mode - Runtime deployment posture for security-sensitive defaults.
- Global
Hook Action - Action returned by a global before hook.
- Init
Database Before Action - Action returned by an init-time database before hook.
- Missing
IpPolicy - Policy applied when rate limiting is enabled but no client IP can be resolved for a request.
- OAuth
State Store Strategy - Where the OAuth
state(and the PKCE verifier / OIDC nonce it carries) is persisted between the authorization redirect and the callback. - Rate
Limit Storage Option - Rate limit storage selector.
- Store
Identifier Option - How verification identifiers are persisted.
- Trusted
Origin Options - Verification
Store Identifier Config - Verification storage configuration.
Traits§
- After
Delete User - Hook invoked after a user is deleted.
- After
Email Verification - Hook invoked after an email is marked as verified or changed.
- Background
Task Runner - Before
Delete User - Hook invoked before a user is deleted.
- Before
Email Verification - Hook invoked before an email is marked as verified or changed.
- Global
After Hook - Runs after any endpoint handler (before plugins’ onResponse).
- Global
Before Hook - Runs before any endpoint handler (after plugins’ onRequest).
- Init
Database After Hook - Runs after a core model create/update mutation.
- Init
Database Before Hook - Runs before a core model create/update mutation.
- OnApi
Error Handler - Hook invoked when the router surfaces an unhandled error.
- OnExisting
User Sign Up - Hook invoked for protected duplicate sign-up attempts.
- OnPassword
Reset - Hook invoked after a password reset has updated or created the credential.
- Rate
Limit Rule Provider - Rate
Limit Storage - Synchronous storage contract for router-level rate limiting.
- Rate
Limit Store - Atomic rate limit storage contract.
- Secondary
Storage - Async key-value storage for plugin data that can live outside the primary database.
- Send
Change Email Confirmation - Notifies the user’s current email that a change was requested.
- Send
Delete Account Verification - Sends a verification email before deleting the account.
- Send
Reset Password - Password reset email sender hook.
- Send
Verification Email - Email verification sender hook.
- Trusted
Origins Provider - Request-aware trusted origin provider.
- Trusted
Providers Provider - Trusted
Providers Request Provider
Functions§
- plugin_
database_ hooks_ from_ init - validate_
rate_ limit_ rule - Rejects invalid rate-limit rules before any store consumes a record.