MCPcopy Create free account
hub / github.com/Keats/jsonwebtoken / decode_token_wrong_algorithm

Function decode_token_wrong_algorithm

tests/hmac.rs:224–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222#[test]
223#[wasm_bindgen_test]
224fn decode_token_wrong_algorithm() {
225 let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiQGIuY29tIiwiY29tcGFueSI6IkFDTUUifQ.I1BvFoHe94AFf09O6tDbcSB8-jp8w6xZqmyHIwPeSdY";
226 let claims = decode::<Claims>(
227 token,
228 &DecodingKey::from_secret(b"secret"),
229 &Validation::new(Algorithm::RS512),
230 );
231 assert_eq!(claims.unwrap_err().into_kind(), ErrorKind::InvalidAlgorithm);
232}
233
234#[test]
235#[wasm_bindgen_test]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected