Skip to main content

install_default_crypto_provider

Function install_default_crypto_provider 

Source
pub fn install_default_crypto_provider()
Expand description

Select the jsonwebtoken crypto provider for this process.

Call it once at startup, before anything in the process signs or verifies a JWT. It is idempotent, and installs the backend this crate was built with, so jsonwebtoken never has to infer one.

A plain ProxyServer deployment needs no call: the server does this while it is being built. It is public for the case the server cannot cover, which is also how the ambiguity arises in the first place: another crate in the graph uses jsonwebtoken too and may reach it first. Call this at the top of main and every consumer is covered, whichever runs first.

With both backends linked the choice is aws_lc_rs: constant-time, and free of the rsa advisory rust_crypto carries. A process that wants a different one installs it through CryptoProvider::install_default before calling this, and the earlier choice stands.