frasertweedale / hs-jose

Haskell JOSE and JWT library
http://hackage.haskell.org/package/jose
Apache License 2.0
122 stars 46 forks source link

add function from JWK to compatible JWS header #22

Closed frasertweedale closed 7 years ago

frasertweedale commented 7 years ago

As a user of jose library, I want to load a JWK that will be used for signing, and apply to it a function that returns a JWS header using an algorithm that is "compatible" with the key type and size.

e.g. load a symmetric key, get HS256. Load an RSA key, get RS384.

The strongest compatible algorithm should be chosen by default.

Perhaps a companion function that allows user to further constrain the algorithm would also be a good idea, e.g. to choose "more widely implemented" algos even if key size supports stronger algo, based on required/recommended/recommended+ algos in RFCs.