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

Function decode_token_wrong_algorithm

tests/hmac.rs:231–239  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229#[test]
230#[wasm_bindgen_test]
231fn decode_token_wrong_algorithm() {
232 let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiQGIuY29tIiwiY29tcGFueSI6IkFDTUUifQ.I1BvFoHe94AFf09O6tDbcSB8-jp8w6xZqmyHIwPeSdY";
233 let claims = decode::<Claims>(
234 token,
235 &DecodingKey::from_secret(b"secret").unwrap(),
236 &Validation::new(Algorithm::RS512),
237 );
238 assert_eq!(claims.unwrap_err().into_kind(), ErrorKind::InvalidAlgorithm);
239}
240
241#[test]
242#[wasm_bindgen_test]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected