jsonwebtoken
jsonwebtoken copied to clipboard
Validation: `required_spec_claims` HashSet should use a non-allocating value type.
I can't see any reason why required_spec_claims couldn't be a HashSet<&'static str>, or, even better, use an enum instead.
Using a String as the value type leads to unnecessary allocations as well as assigning to that field being rather unergonomic. Having to convert your &'static strs to owned strings is annoying and wasteful.
Current workaround is to just not use the feature.
I don't remember why it's that way but Validation has been like that for >7 years.
In practice I think most users create a Validation struct once in their program and re-use it (the original intended use) so allocations are not an issue in that case