Open tkrause opened 1 year ago
We can implement PartialEq
but if we implement a Debug
it should be a custom implementation that just prints the algorithm and not the data contained in it to avoid accidental dump of secrets in logs.
Let's not implement PartialEq
actually, only a custom Debug
: https://github.com/Keats/jsonwebtoken/issues/220
Currently
DecodingKey::as_bytes
is crate public which means you can't even get the secret out of the DecodingKey that you originally put in.Additionally it does not implement
Debug
orPartialEq
so once you create a DecodingKey you cannot compare for testing purposes ever. This is really a pain point if you're trying to test your decoding logic to support many algorithms and keys using JWK as well as static secrets.DecodingKey should really implement the
std::cmp::PartialEq
interface at the very least.A similar issue exists with
Algorithm
where you have to resort to matching in order to implementDebug
on types using it. Ideally the library would handle this case as well convertingAlgorithm
back to a string.