Skip to main content

Crate openauth

Crate openauth 

Source
Expand description

OpenAuth authentication toolkit.

Re-exports§

pub use auth::open_auth;
pub use auth::open_auth_with_adapter;
pub use auth::open_auth_with_adapter_and_endpoints;
pub use auth::open_auth_with_endpoints;
pub use auth::OpenAuth;
pub use openauth_core::oauth;
pub use openauth_core::social_providers;

Modules§

api
Framework-neutral API contracts.
auth
Public OpenAuth initializer.
context
Request and runtime context contracts.
cookies
Cookie naming, parsing, and chunking helpers.
crypto
Cryptographic primitives used by OpenAuth core.
db
Database contracts, model metadata, and SQL naming defaults.
env
Environment helpers for OpenAuth core.
error
Error types for OpenAuth core.
options
Configuration types for OpenAuth core.
plugin
Plugin contracts for OpenAuth extensions.
rate_limit
Router-level rate limiting.
session
Database-backed session lifecycle helpers.
user
Database-backed user and credential account helpers.
utils
Small shared utilities.
verification
Database-backed verification token/value helpers.

Structs§

AccountLinkingOptions
AccountOptions
Account and OAuth account behavior.
AdvancedOptions
Advanced configuration.
ApiErrorResponse
AsyncAuthEndpoint
AuthContext
AuthCookie
AuthCookies
AuthEndpoint
AuthEndpointOptions
AuthEnvironment
Environment values used by context initialization.
AuthFlowError
AuthPlugin
AuthRouter
BodyField
BodySchema
ChangeEmailOptions
Email change behavior.
ChunkedCookieStore
Cookie
CookieAttributesOverride
User-supplied cookie attribute defaults.
CookieCacheOptions
Session cookie cache configuration.
CookieCachePayload
CookieConfig
Cross-subdomain cookie configuration.
CookieOptions
CreateCredentialAccountInput
CreateSessionInput
Input for creating a persisted session.
CreateUserInput
CreateVerificationInput
DbSessionStore
Session store backed by the OpenAuth adapter contract.
DbUserStore
DbVerificationStore
DeleteUserOptions
User deletion behavior.
DynamicRateLimitPathRule
EmailPasswordAuth
EmailPasswordAuthResult
EmailPasswordConfig
EmailVerificationOptions
Email verification configuration.
EndpointInfo
EndpointMiddleware
Envelope
Parsed Better Auth encrypted payload envelope.
ExperimentalOptions
Experimental feature flags.
GetSessionInput
GetSessionResult
HookedAdapter
Adapter wrapper that runs plugin database hooks for mutating operations.
IpAddressOptions
MemoryAdapter
Async-safe in-memory adapter backed by shared state.
OAuth2Tokens
OAuth2UserInfo
OpenApiOperation
OpenAuthOptions
Top-level OpenAuth configuration.
ParsedCookie
PasswordOptions
Password policy configuration.
PathParams
PluginAfterHook
PluginAsyncAfterHook
PluginBeforeHook
PluginDatabaseHook
Executable database hook registered by a plugin.
PluginDatabaseHookContext
Runtime metadata passed to executable database hooks.
PluginEndpointHooks
PluginErrorCode
Error code contributed by a plugin.
PluginHookMatcher
Matcher used to select endpoint hooks.
PluginInitOutput
Typed, additive output from a plugin init handler.
PluginMiddleware
PluginMigration
Plugin migration metadata.
PluginPasswordValidationInput
PluginPasswordValidationRejection
PluginPasswordValidator
PluginRateLimitRule
Rate-limit rule contributed by a plugin.
ProviderOptions
RateLimitOptions
Rate limiting defaults.
RateLimitPathRule
RateLimitRecord
Rate limit storage record.
RateLimitRule
SecretConfig
Secret rotation configuration.
SecretEntry
Versioned secret entry.
SessionAdditionalField
Runtime metadata for custom session fields accepted by /update-session.
SessionAuth
SessionCookieOptions
SessionOptions
Session configuration.
SignInInput
SignOutResult
SignUpInput
SocialAuthorizationCodeRequest
SocialAuthorizationUrlRequest
SocialIdTokenRequest
TelemetryContext
Optional hints and hooks for telemetry collection.
TelemetryEvent
Event sent to the telemetry collector or custom_track.
TelemetryOptions
Telemetry collection settings (parity with Better Auth telemetry init option).
TelemetryPublisher
Live telemetry handle (Self::publish is a no-op when telemetry is disabled).
TelemetryTestHooks
Overrides used by integration tests (Vitest mocks replacement).
UpdateUserInput
UpdateVerificationInput
UserAdditionalField
Runtime metadata for custom user fields accepted by user-writing endpoints.
UserOptions
User lifecycle configuration.
UserWithAccounts
VerificationEmail
Payload passed to an email verification sender.

Enums§

ApiErrorCode
AuthFlowErrorCode
CookieCacheStrategy
Cookie cache encoding strategy.
EndpointKind
JsonSchemaType
OAuthError
OAuthStateStoreStrategy
OpenAuthError
Core library error.
PluginAfterHookAction
Action returned by an after endpoint hook.
PluginBeforeHookAction
Action returned by a before endpoint hook.
PluginDatabaseAfterInput
Query and adapter result passed to a database hook after the operation runs.
PluginDatabaseBeforeAction
Action returned by a before hook.
PluginDatabaseBeforeInput
Query passed to a database hook before the adapter operation runs.
PluginDatabaseOperation
Mutating database operations that can be observed by plugins.
PluginRequestAction
PluginSchemaContribution
Database schema contribution made by a plugin.
RateLimitStorageOption
Rate limit storage selector.
TrustedOriginOptions

Constants§

VERSION
Current crate version.

Traits§

JweSecretSource
Secret material accepted by Better Auth-compatible JWE helpers.
RateLimitRuleProvider
RateLimitStorage
Synchronous storage contract for router-level rate limiting.
SendVerificationEmail
Synchronous email verification sender hook.
SocialOAuthProvider
TrustedOriginsProvider
Request-aware trusted origin provider.

Functions§

build_secret_config
Build a rotation config from validated entries.
core_auth_async_endpoints
Build Better Auth-inspired core endpoints backed by an OpenAuth database adapter.
create_auth_endpoint
create_telemetry
Creates a telemetry publisher (possibly a hard no-op when neither endpoint nor custom track exist).
get_telemetry_auth_config
parse_request_body
Parse a request body as JSON or application/x-www-form-urlencoded.
parse_secrets_env
Parse comma-separated version:secret entries.
symmetric_decode_jwt
symmetric_decrypt
Decrypt a string with either a raw secret or a versioned secret config.
symmetric_encode_jwt
symmetric_encrypt
Encrypt a string with either a raw secret or a versioned secret config.
validate_secrets
Validate versioned secrets and return warnings for weak current secrets.

Type Aliases§

ApiRequest
ApiResponse
PluginAfterHookFuture
PluginAsyncAfterHookHandler
PluginEndpoint
Async endpoint contributed by a plugin.
PluginPasswordValidatorFuture
PluginPasswordValidatorHandler
SocialProviderFuture