tsndr / cloudflare-worker-jwt

A lightweight JWT implementation with ZERO dependencies for Cloudflare Workers.
MIT License
649 stars 51 forks source link

There is no possibility to modify header #51

Closed step135 closed 9 months ago

step135 commented 9 months ago

It is sometimes needed to add some parameters to the header, e.g. kid. I had to modify sign method to enable it. You should find some consistent solution as it is ugly to put another sometimes compulsory (fourth) parameter after options.

Le0Developer commented 9 months ago

The options argument accepts a header field.

So await sign({hello: "world"}, "KEY", { header: { typ: "JWT", kid: "..." } }) should work