anvilresearch/jwk

Method for generating basic JWS protected header from JWK instance

EternalDeiwos opened this issue · 3 comments

As per title.

It would be best if we could find an ideal single point of truth for all of this kind of logic to live. Maybe that's here? I can see advantages and disadvantages.

Would like to see a healthy debate within the team about adding methods like this here in general, this one specifically, identify the tradeoffs, weigh the pros/cons, and establish a solid consensus.

Ideally before we start expanding the scope. It's easier to add than subtract once it's released.

It's also good to have this here because we can do some validation of header parameters to key material and enforce things like trying to use ES256 "alg" with an RSA key. I like having the responsibility here. It seems like it may result in some superficial duplication, as with the adapter pattern we use in JWA and webcrypto, but also seems to fit with the goal of limiting opportunity for misuse.

As a tangential and probably easily dismissed consideration, I wonder if we should support any kind of interchangeability of these constituent parts with other JOSE libs? Probably not, but it's perhaps worth explicitly stating the reasons in either case.