Skip to main content

Module options

Module options 

Source
Expand description

Configuration types for RustAuth core.

§Hooks

RustAuth supports three hook registration paths:

  1. Global HTTP hooks — build GlobalHooksOptions and register it with RustAuthOptions::hooks. These run before/after matched API endpoints (parity with Better Auth hooks).
  2. Init-time database hooks — build InitDatabaseHooksOptions and register it with RustAuthOptions::init_database_hooks. Prefer this for typed create/update callbacks on core models (user, session, account, verification). See RustAuthOptions for when to combine this with low-level hooks.
  3. Low-level plugin database hooks — append crate::plugin::PluginDatabaseHook via RustAuthOptions::database_hook for custom models, plugin-owned tables, or operations that do not fit the init-time schema.

Structs§

AccountLinkingOptions
AccountOptions
Account and OAuth account behavior.
AdvancedOptions
ChangeEmailConfirmation
Payload for notifying the current email address about a pending change.
ChangeEmailOptions
Email change behavior.
CookieAttributesOverride
User-supplied cookie attribute defaults.
CookieCacheOptions
Session cookie cache configuration.
CookieConfig
Cross-subdomain cookie configuration.
DatabaseModelHooks
Create/update hooks for one core model.
DatabaseOperationHooks
Before/after hook pair for a single mutation kind.
DefaultErrorPage
DeleteAccountVerificationEmail
Payload for delete-account verification emails.
DeleteUserOptions
User deletion behavior.
DynamicRateLimitPathRule
EmailPasswordOptions
Email/password authentication configuration.
EmailVerificationCallbackPayload
Payload passed to email verification lifecycle callbacks.
EmailVerificationOptions
Email verification configuration.
ExistingUserSignUpPayload
Payload passed when an existing user attempts email/password sign-up.
ExperimentalOptions
Experimental feature flags.
GlobalHooksOptions
Global before/after hooks applied to every matched endpoint.
HybridRateLimitOptions
InitDatabaseHooksOptions
Structured init-time database hooks for core models.
IpAddressOptions
ModelSchemaOptions
Table and column alias overrides for a core auth model.
OnApiErrorOptions
Configuration for unhandled API errors.
PasswordOptions
Password policy configuration.
PasswordResetEmail
Payload passed to the password reset email sender.
PasswordResetPayload
Payload passed to password reset lifecycle callbacks.
RateLimitConsumeInput
RateLimitDecision
RateLimitOptions
Rate limiting defaults.
RateLimitPathRule
RateLimitRecord
Rate limit storage record.
RateLimitRule
A single rate-limit bucket rule.
RustAuthOptions
Top-level RustAuth configuration.
SessionAdditionalField
Runtime metadata for custom session fields accepted by /update-session.
SessionOptions
Session configuration.
TelemetryOptions
Telemetry collection settings (parity with Better Auth telemetry init option).
UserAdditionalField
Runtime metadata for custom user fields accepted by user-writing endpoints.
UserOptions
User lifecycle configuration.
VerificationEmail
Payload passed to an email verification sender.
VerificationOptions
Verification token storage options.

Enums§

CookieCacheStrategy
Cookie cache encoding strategy.
DeploymentMode
Runtime deployment posture for security-sensitive defaults.
GlobalHookAction
Action returned by a global before hook.
InitDatabaseBeforeAction
Action returned by an init-time database before hook.
MissingIpPolicy
Policy applied when rate limiting is enabled but no client IP can be resolved for a request.
OAuthStateStoreStrategy
Where the OAuth state (and the PKCE verifier / OIDC nonce it carries) is persisted between the authorization redirect and the callback.
RateLimitStorageOption
Rate limit storage selector.
StoreIdentifierOption
How verification identifiers are persisted.
TrustedOriginOptions
VerificationStoreIdentifierConfig
Verification storage configuration.

Traits§

AfterDeleteUser
Hook invoked after a user is deleted.
AfterEmailVerification
Hook invoked after an email is marked as verified or changed.
BackgroundTaskRunner
BeforeDeleteUser
Hook invoked before a user is deleted.
BeforeEmailVerification
Hook invoked before an email is marked as verified or changed.
GlobalAfterHook
Runs after any endpoint handler (before plugins’ onResponse).
GlobalBeforeHook
Runs before any endpoint handler (after plugins’ onRequest).
InitDatabaseAfterHook
Runs after a core model create/update mutation.
InitDatabaseBeforeHook
Runs before a core model create/update mutation.
OnApiErrorHandler
Hook invoked when the router surfaces an unhandled error.
OnExistingUserSignUp
Hook invoked for protected duplicate sign-up attempts.
OnPasswordReset
Hook invoked after a password reset has updated or created the credential.
RateLimitRuleProvider
RateLimitStorage
Synchronous storage contract for router-level rate limiting.
RateLimitStore
Atomic rate limit storage contract.
SecondaryStorage
Async key-value storage for plugin data that can live outside the primary database.
SendChangeEmailConfirmation
Notifies the user’s current email that a change was requested.
SendDeleteAccountVerification
Sends a verification email before deleting the account.
SendResetPassword
Password reset email sender hook.
SendVerificationEmail
Email verification sender hook.
TrustedOriginsProvider
Request-aware trusted origin provider.
TrustedProvidersProvider
TrustedProvidersRequestProvider

Functions§

plugin_database_hooks_from_init
validate_rate_limit_rule
Rejects invalid rate-limit rules before any store consumes a record.

Type Aliases§

BackgroundTaskFuture
Advanced configuration.
RateLimitFuture
SecondaryStorageFuture
StoreIdentifierHashFn
StoreIdentifierHashFuture