unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.66k stars 266 forks source link

Update deprecated call to Crypto.JWT.addClaim #4212

Open aryairani opened 11 months ago

aryairani commented 11 months ago

https://github.com/unisonweb/unison/pull/4203/files#diff-08ec3a5cf8f198a78c351f2977ceb06b77705272109827e474d2401e6647158bR133 noted this, and can be reverted after the update.

There only seems to be one usage site:

instance Servant.Auth.ToJWT HashJWTClaims where
  encodeJWT (HashJWTClaims h u) =
    Jose.emptyClaimsSet
      & Jose.addClaim "h" (toJSON h)
      & Jose.addClaim "u" (toJSON u)
      & Jose.addClaim "t" (toJSON hashJWTType)

https://hackage.haskell.org/package/jose-0.10/docs/Crypto-JWT.html says "Deprecated: use a sub-type". I don't know what that means, but hopefully @ChrisPenner does :)

Low priority but maybe a quick fix so we can forget about it?

ChrisPenner commented 11 months ago

I looked into the use a sub-type thing but there doesn't actually appear to be a valid (and non-silly) way to do it. Left an issue here so we'll hopefully hear back: https://github.com/frasertweedale/hs-jose/issues/116

frasertweedale commented 11 months ago

From your use case, it seems you are constrained by types classes from servant-auth that deal with ClaimsSet in the concrete. I'll look into it further to see how servant-auth could be updated to handle claims set types more abstractly.

frasertweedale commented 11 months ago

It looks like some significant (probably API-breaking) changes are needed in servant-auth to avoid the deprecated symbols. I'll file a ticket there soon, and promise not to remove the deprecated bits from jose until servant is no longer using them.