Skip to main content

Module key_source

Module key_source 

Source
Expand description

JWT key source abstraction for unified key resolution.

JwtKeySource provides a unified interface for resolving JWT verification keys, abstracting the difference between:

  • Regular services (trust only cluster CA)
  • PolicyService (handles federation via ID-JAG, SPIFFE, OIDC)

§Trust Model

Services within a cluster all trust the same PolicyService. The CA verifying key is derived from the cluster’s root signing key via HKDF: derive_purpose_key(&root_key, "hyprstream-jwt-v1").verifying_key()

§Usage

Services receive a JwtKeySource at construction time, binding them to their trust anchors. Most services use ClusterKeySource; PolicyService uses FederatedKeySource for cross-cluster token exchange.

ⓘ
// In service factory:
let key_source = ctx.cluster_key_source();
let service = MyService::new(...).with_jwt_key_source(key_source);

Structs§

ClusterKeySource
Key source for regular services — trusts only the cluster CA.
FederatedKeySource
Key source that combines local cluster trust with federation.
JwksKeySource
JWKS-backed key source with issuer-and-kid-based resolution.

Enums§

JwksMode
Deployment mode for JWKS-backed key resolution.

Traits§

IssuerResolver
Resolves an issuer string to its JWKS endpoint URL.
JwtKeySource
Source of JWT verification keys.

Type Aliases§

JwksFetcher
Async function that fetches raw JWKS JSON from a URL.