A modular, WebAssembly-compatible (WASI Preview 2) authentication framework for Rust.
JWT session management, OAuth2/OIDC flows, email OTP, TOTP MFA, WebAuthn passkeys, and a composable HTTP proxy middleware — all targeting wasm32-wasip2.
- WebAssembly-Native Crypto — RSA JWT signing/verifying on
wasm32-wasip2without external JS runtimes. - Composable Proxy Middleware —
wasi-auth-interceptorplugs in front of any WASI HTTP handler viawac plug. - Multi-Protocol Auth — Passwordless OTP, Magic Links, OAuth2/OIDC presets, TOTP MFA, and WebAuthn Passkeys.
- Leptos Integration — Session middleware, routing guards, and premium glassmorphism UI components for SSR/hydration.
- Pluggable Storage — Swap in Redis, DynamoDB, SQLite, or Spin KV by implementing the
AuthStoragetrait.
rustup target add wasm32-wasip2
cargo build --workspaceRequires Rust ≥ 1.93.0, edition
2024. See Getting Started for full prerequisites.
| Guide | What's Inside |
|---|---|
| 📖 Getting Started | Prerequisites, build & serve commands, use-case tutorials (proxy composition, Library/Gateway mode, custom traits, TOTP, Magic Links) |
| 🧩 UI Components | How-to guide for LoginForm, TotpSetup, SessionList, MfaStatus, PasskeyList — props API + full working examples |
| 🏗️ Architecture | System topology, request flow, crate breakdown, security boundaries, MFA/WebAuthn flow designs |
| ⚙️ Configuration | Environment variables, wasi-auth.toml schema, cookie precedence, rate-limiter defaults, OAuth2 provider presets |
Each crate has its own README with API details:
| Crate | Purpose |
|---|---|
wasi-auth-traits |
Core trait abstractions (AuthStorage, EmailSender, RateLimiter) and storage backends |
wasi-auth-core |
JWT engine, OAuth2 client, OTP, TOTP, Magic Links, Passkey WebAuthn |
leptos-wasi-auth |
Leptos framework integration (session context, guards, cookie helpers) |
leptos-wasi-ui |
Styled Leptos UI components for auth workflows |
wasi-auth-providers |
OAuth2/OIDC client presets (Google, GitHub, Apple, Discord, etc.) |
wasi-auth-interceptor |
Standalone WASI HTTP proxy middleware |
The examples/leptos-auth-demo is a full SSR Leptos app demonstrating every auth flow and UI component. Run it with:
just example# Run formatting, clippy, and tests:
just checkAll changes must compile cleanly, pass tests, and follow standard formatting.
- Bugs — Search existing issues or open a new one with reproduction steps.
- Security — Do not file public issues. Use GitHub private vulnerability reporting or email maintainers directly.
Dual-licensed under MIT and Apache 2.0.