Skip to main content

initialize_jwt_crypto_provider

Function initialize_jwt_crypto_provider 

Source
pub fn initialize_jwt_crypto_provider() -> Result<()>
Expand description

Installs the backend selected by this crate’s Cargo features for the entire process.

Call exactly once from the product composition root before starting workers or making any JWT calls, including direct jsonwebtoken calls. Features are additive: another dependency may enable the other upstream backend, but this explicit selection remains deterministic. Custom providers and separate providers per signer/verifier are not supported.

§Errors

Returns AuthError::CryptoProviderAlreadyInstalled if any caller has already initialized the upstream provider, including upstream automatic initialization. No provider is replaced or silently accepted. A duplicate call after Forge’s successful initialization returns this error while existing JWT operations remain available. If another caller installed first, Forge stays unavailable; the product must treat that as a startup configuration failure.