Expand description
The core of fastauth: the builder, the type-level
plugin list, sessions, crypto, routing and the core endpoints. Apps use the fastauth
facade crate; adapters, integrations and plugins depend on this one.
Re-exports§
pub use error::AuthError;pub use error::BuildError;
Modules§
- adapter
- The database contract. See
docs/concepts/02-database.md. - config
- cookies
- Cookie parsing and Set-Cookie building.
- crypto
- Secrets, derived keys, signing, encryption, hashing and password hashing.
See
docs/concepts/03-security.md. - endpoint
- Endpoints, the request context, hooks, and the execution pipeline shared by HTTP requests and server-side API calls.
- error
- events
- Events fire after an endpoint succeeds, for every caller (HTTP, server API, plugins).
Server API calls made with
Api::withindefer them to aDeferredEventsqueue. - internal
- Core operations shared by core endpoints and plugins: users, accounts, sessions, sign-in with gates, verification values, email.
- Auth emails. A
Mailerturns each typed email into a message. - memory
- An in-memory adapter for tests and examples. Not for production: no durability, and a transaction is a snapshot that overwrites the store on commit.
- migrate
- Diffs the configured schema against the live database. Only ever adds.
- model
- models
- Core tables:
user,session,account,verification. - plugin
- The plugin trait and the registration API plugins (and the app) use in
init. - plugin_
prelude - Everything a plugin author needs.
- prelude
- Everything an app needs to configure auth.
- query
- The typed query builder plugins use through
ctx.db(). - rate_
limit - GCRA rate limiting: one timestamp per key, in sharded in-memory maps.
- routes
- Core endpoints. Paths and JSON shapes follow Better Auth, so its client works unchanged.
- schema
- session
- Session lookup (cookie, cookie cache, resolvers), refresh, and the typed session the app sees.
- value
Macros§
- plugins
plugins![A, B]isCons<A, Cons<B, Nil>>: the plugin list in registration order.
Structs§
- Api
- Server-side endpoint calls. Pass the request’s headers (or a session token) for endpoints that need a session.
- ApiResponse
- An endpoint’s typed output plus the cookies it wants set.
- Auth
- A configured auth instance. Cheap to clone (two
Arcs). - Builder
- Collects configuration.
.build()only exists oncesecret,base_urlanddatabaseare set: the last three type parameters track that. - Client
Addr - The client’s socket address. Integrations put it in request extensions.
- Cons
- A plugin followed by the rest of the list.
- Fast
Auth - Entry point:
FastAuth::builder(). - Here
- Index: the plugin is the head.
- Missing
- Builder state: a required option is missing.
- Nil
- The empty plugin list.
- NoDatabase
- Builder state: no database yet.
- Present
- Builder state: a required option is set.
- There
- Index: the plugin is in the tail.
Traits§
- Append
- Appends at the end, so the list reads in registration order like
plugins![..]. - Auth
Instance - What integrations and plugin extension traits need from an auth instance, without naming its type parameters.
- Has
- HasPlugin
- For plugin extension traits: methods bounded by
Self: HasPlugin<MyPlugin, I>only compile on anAuththat registered the plugin. - Plugin
Set - Walks the list: registration at build time, decoding on every session load.
- Satisfied
- A tuple of plugins that must all be in list
L. Checked by.plugin(..).
Type Aliases§
- Duration
- A
SignedDurationunder its original name.