mike-engel/jwt-cli

Allow the `typ` header field to have values other than `JWT`

errhammr opened this issue · 1 comments

Summary

The command line interface of jwt-cli alows the typ header field to be specified. The only value it accepts is JWT, though.

There are specifications that recommend or require the typ header field to be something other than JWT. For testing and debugging things using these tokens it would be convenient if jwt-cli allowed the typ header value to be set to a custom value.

Examples:

the "typ" value used SHOULD be "secevent+jwt".

For the PASSporT, the "typ" header MUST be the string "passport".

Steps to reproduce

$ jwt encode --secret @private-key.pem --alg ES256 --iss=demo --typ='secevent+jwt' 
error: invalid value 'secevent+jwt' for '--typ <type>'
  [possible values: jwt]

For more information, try '--help'.

Expected behavior

jwt-cli emits a JWT with the typ header field containing the value given in the --typ command line argument.

Thanks for the suggestion @errhammr! Unfortunately jsonwebtoken forces the value to be JWT. It would have to be fixed there before I could change it in this tool