Ability to encode a `JWT VerifiedJWT` to Text

Issue #6 new
Chris Penner created an issue

Hi Brian, I've got a JWT VerifiedJWT that I need to render into it's JWT form, I see that there's encodeSigned and encodeUnsigned which construct the Text JWT, but they don't accept a JWT type and since the constructors for JWT aren't exported I can't unpack the pieces I need to call those functions either.

Is there some other way that I'm missing to turn a JWT VerifiedJWT into a Text?

May I suggest:

encode :: JWT r -> Text

Which uses the type index to render the verified or unverified JWT.

I'd be happy to submit a PR for this if that sounds good.

Also, I think the Show instance for JWT may be unintuitive and confusing, it's currently being derived, some folks might expect it to render out the encoded form, others might not want a Show instance to exist at all since JWTs are often sensitive.

I’m also curious what you would think about adding ToJSON and FromJSON instances for JWT r

Comments (1)

  1. Log in to comment