-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added migratory types with deprecations to guide users updating from …
…version 4 to version 5
- Loading branch information
1 parent
13e7513
commit fba14c1
Showing
9 changed files
with
664 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
/// A JWT payload is a Publically Readable set of claims | ||
/// Each variable represents a claim. | ||
/// - Warning: Requirements changed in v5 to be async. Please also conform to ``AsyncJWTPayload`` while on v4, and remove the ``AsyncJWTPayload`` conformance once you do update to v5. | ||
public protocol JWTPayload: Codable { | ||
/// Verifies that the payload's claims are correct or throws an error. | ||
func verify(using signer: JWTSigner) throws | ||
} | ||
|
||
/// A transitionary protocol with sync and async requirements. | ||
/// | ||
/// This protocol should be dropped once you are finished migrating to v5, as it'll have been renamed back to ``JWTPayload``, but with a single async requirement. In order to support both versions v4 and v5 in a library, do not implement the requirements of ``JWTPayload`` as ``JWTSigner`` is no longer available in v5. | ||
public protocol AsyncJWTPayload: Codable { | ||
func verify<Algorithm: JWTAlgorithm>(using signer: Algorithm) throws | ||
|
||
/// Verifies that the payload's claims are correct or throws an error. | ||
func verify<Algorithm: JWTAlgorithm>(using algorithm: Algorithm) async throws | ||
} |
Oops, something went wrong.