wacht crate is the official Rust SDK for the Wacht platform. It provides a robust, type-safe interface for interacting with Wacht’s backend APIs, performing gateway authorization checks, and integrating authentication middleware into your Rust web applications.
Designed with performance and safety in mind, the SDK leverages tokio for asynchronous execution and integrates seamlessly with popular modern Rust web frameworks like axum.
Core Capabilities
The Rust SDK is designed to handle three primary backend workflows:Typed API Client
Interact with Wacht’s platform APIs (Users, Webhooks, AI Agents, etc.) using strongly-typed Rust structs and asynchronous requests.
Gateway Authorization
Validate API keys and OAuth access tokens securely at your gateway layer to resolve normalized machine and user principal contexts.
Axum Middleware
Drop-in
AuthLayer middleware and extractors for axum routes to enforce JWT session authentication and verify permissions.Environment Configuration
Instantiate clients effortlessly using environment variables or explicit programmatic configuration.
When to use the Rust SDK
You should use thewacht crate when you are building:
- Backend APIs in Rust that need to verify incoming session tokens from a frontend application.
- Machine-to-Machine (M2M) services that require validation of API keys or OAuth credentials.
- Worker processes or scheduled tasks that need to interact with Wacht’s management APIs (e.g., fetching user details, dispatching webhooks).
