Crate portier

source ·
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

  • A builder to configure a Client.
  • A client for performing Portier authentication.
  • A Store implementation that keeps everything in-memory.

Enums

Traits

  • Trait that describes a backing store used by Client for two purposes:

Functions

  • Returns 128-bits of secure random data in an URL-safe encoding.
  • Performs a simple GET-request using the given HTTP client, and handles the response.