tekul / jose-jwt

Haskell implementation of JOSE/JWT standards
BSD 3-Clause "New" or "Revised" License
35 stars 22 forks source link

Trouble exporting and importing keys #23

Closed Qqwy closed 6 years ago

Qqwy commented 6 years ago

Hello there!

I am attempting to use this library to send symmetrically-encrypted information. I am able to run the JWE example fine, but this generates a new key every time.

I am having trouble figuring out how to use the library with a pregenerated key rather than a newly generated one. And, related, how to export a key that was generated using generateSymmetricKey.

I am guessing that this might have to do with the FromJSON and ToJSON typeclasses, but I am not entirely sure how to get their functions in scope. Also, I would just be happy to export the strings in some other easy-to-transport format (hexencoded, base64-encoded or similar) instead.

Thanks!

tekul commented 6 years ago

Hi. FromJSON and ToJSON are typeclasses from the aeson library. If you import Data.Aeson you should be able to use its encode and decode functions to convert to and from ByteStrings.

Qqwy commented 6 years ago

Thank you! This works exactly as intended. :heart: