Skip to main content

mint

Function mint 

Source
pub fn mint(pem: &str, kid: &str, claims: &impl Serialize) -> String
Available on crate feature testing only.
Expand description

Mint an RS256 token with full control over every field a test might want wrong. pem is which key signs it; kid is what the header claims signed it — letting a test say “signed by B, labelled A” for the bad-signature case. claims is anything that serializes to a JSON object: a serde_json::json! literal, or the test’s own claims struct.

§Panics

If pem is not a valid RSA private key in PEM form, or if the claims fail to serialize.