Expand description
A client for the Portier protocol.
The primary interface of this package is the Client. Construct one using Client::builder or
Client::new. See also the short example using the Rocket framework in
example/src/main.rs.
Some data storage is needed to implement the protocol. This is used for tracking short-lived
login sessions, and caching of basic HTTP GET requests. The Store trait facilitates this, and
by default, an in-memory store is used. This will work fine for simple single-process
applications, but if you intend to run multiple workers, an alternative Store must be
implemented. (In the future, we may offer some alternatives for common databases.
Contributions are welcome!)
Some applications may need multiple configurations and Client instances, for example because
they serve multiple domains. In this case, we recommended creating short-lived Clients and
sharing the Store between them.
The crate feature simple-store is enabled by default, but can be disabled to remove the Tokio
and Hyper dependencies. When disabled, the default MemoryStore will also not be available,
and a custom Store implementation must be provided.
The minimum required Rust version is 1.46.
Structs§
- Builder
- A builder to configure a
Client. - Client
- A client for performing Portier authentication.
- Memory
Store - A
Storeimplementation that keeps everything in-memory.
Enums§
- Build
Error - Errors that can result from
Builder::build. - Fetch
Error - Errors that can result from
Store::fetch. - Response
Mode - Supported response modes.
- Start
Auth Error - Errors that can result from
Client::start_auth. - Verify
Error - Errors that can result from
Client::verify.
Traits§
- Store
- Trait that describes a backing store used by
Clientfor two purposes:
Functions§
- generate_
nonce - Returns 128-bits of secure random data in an URL-safe encoding.
- simple_
fetch - Performs a simple GET-request using the given HTTP client, and handles the response.