Skip to main content

Crate fastauth_core

Crate fastauth_core 

Source
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/06-database.md.
config
cookies
Cookie parsing and Set-Cookie building.
crypto
Secrets, derived keys, signing, encryption, hashing and password hashing. See docs/09-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::within defer them to a DeferredEvents queue.
internal
Core operations shared by core endpoints and plugins: users, accounts, sessions, sign-in with gates, verification values, email.
mail
Auth emails. A Mailer turns 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] is Cons<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 once secret, base_url and database are set: the last three type parameters track that.
ClientAddr
The client’s socket address. Integrations put it in request extensions.
Cons
A plugin followed by the rest of the list.
FastAuth
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![..].
AuthInstance
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 an Auth that registered the plugin.
PluginSet
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 SignedDuration under its original name.