Skip to main content

generate

Function generate 

Source
pub async fn generate() -> Result<KeyPair, DBError>
Expand description

Generates an RS256 keypair off the async runtime.

RSA keygen is CPU-bound (tens to hundreds of ms); running it on a spawn_blocking thread keeps it off the request executor so it can’t stall the reactor or starve other tasks.

§Errors

DBError::KeyGen if generation or PEM encoding fails.