-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalise the types of `signJWT`, `verifyJWT`, and related functions to accept custom JWS header types. Add new type synonym `SignedJWTWithHeader h` (keeping `SignedJWT` *as is*). This change could break some applications by introducing type ambiguity. Possible solutions include… Type application: ```haskell {-# LANGUAGE TypeApplications #-} decodeCompact @SignedJWT s >>= verifyClaims settings k ``` Type annotation: ```haskell do jwt <- decodeCompact s verifyClaims settings k (jwt :: SignedJWT) ``` Explicitly typed coercion function: ```haskell let fixType = id :: SignedJWT -> SignedJWT in verifyClaims settings k . fixType =<< decodeCompact s ``` I used type applications in the test suite to address the ambiguity. Fixes: #122
- Loading branch information
1 parent
853edcb
commit b7c0a38
Showing
4 changed files
with
90 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters