Skip to main content

Module control

Module control 

Source
Expand description

Control plane trait and implementations for client lookup

§Control Plane Abstraction

Defines the ControlPlane trait for looking up client authentication and authorization records. Implementations include:

  • RemoteControlPlane — reads client records from a remote control repository (the production source of truth).
  • LocalControlPlane — resolves clients from a static in-memory list (useful for dev/test or as a fallback).
  • FallbackControlPlane — chains a primary and secondary control plane: the primary is tried first and, on any error, the secondary is consulted. This lets you run the remote backend as the primary with local config as the fallback.

§Client record schema

Records live at clients/by-key/{sha256(api_key)}.json in the control repository. The JSON schema is defined by [ClientRecord].

§Extending

To add a new backend (e.g. PostgreSQL, Redis, Vault), implement the ControlPlane trait and wire it into the server’s AppState.

Modules§

remote_control

Structs§

ClientRecord
Canonical client record stored in the control plane.
FallbackControlPlane
Chains a primary and secondary control plane.
LocalClient
A client entry for local (in-memory) lookup.
LocalControlPlane
Resolves clients from a static list — typically parsed from env vars.

Enums§

ControlPlaneError

Traits§

ControlPlane
Abstraction over the source of truth for client authentication and authorization.

Functions§

hash_api_key
SHA-256 hash of an API key, returned as a lowercase hex string.