rust-jwt icon indicating copy to clipboard operation
rust-jwt copied to clipboard

Allow custom value in `HeaderContentType`

Open abonander opened this issue 4 years ago • 0 comments

Generating JWTs for client API access to Twilio requires setting the cty field of the JWT header to a specific magic string: https://www.twilio.com/docs/iam/access-tokens#jwt-format

cty is the content-type and encodes the version of the Access Token. Its value must be "twilio-fpa;v=1".

It would be nice not to have to implement JoseHeader for a custom type just to set this. I'm thinking an extra variant HeaderContentType::Custom(String) would be sufficient. If we want to ensure it's a properly formatted MIME type it could be mime::Mime instead but I feel like that's overkill.

abonander avatar Feb 22 '21 22:02 abonander