@@ -47,7 +47,7 @@ public enum InvalidToken : CustomStringConvertible, Error {
47
47
48
48
49
49
/// Decode a JWT
50
- func decode( _ jwt: String , algorithms: [ Algorithm ] , verify: Bool = true , audience: String ? = nil , issuer: String ? = nil ) throws -> ClaimSet {
50
+ public func decode( _ jwt: String , algorithms: [ Algorithm ] , verify: Bool = true , audience: String ? = nil , issuer: String ? = nil ) throws -> ClaimSet {
51
51
let ( header, claims, signature, signatureInput) = try load ( jwt)
52
52
53
53
if verify {
@@ -60,12 +60,20 @@ func decode(_ jwt: String, algorithms: [Algorithm], verify: Bool = true, audienc
60
60
61
61
62
62
/// Decode a JWT
63
+ public func decode( _ jwt: String , algorithm: Algorithm , verify: Bool = true , audience: String ? = nil , issuer: String ? = nil ) throws -> ClaimSet {
64
+ return try decode ( jwt, algorithms: [ algorithm] , verify: verify, audience: audience, issuer: issuer)
65
+ }
66
+
67
+
68
+ /// Decode a JWT
69
+ @available ( * , deprecated, message: " use decode that returns a ClaimSet instead " )
63
70
public func decode( _ jwt: String , algorithms: [ Algorithm ] , verify: Bool = true , audience: String ? = nil , issuer: String ? = nil ) throws -> Payload {
64
71
return try decode ( jwt, algorithms: algorithms, verify: verify, audience: audience, issuer: issuer) . claims
65
72
}
66
73
67
74
68
75
/// Decode a JWT
76
+ @available ( * , deprecated, message: " use decode that returns a ClaimSet instead " )
69
77
public func decode( _ jwt: String , algorithm: Algorithm , verify: Bool = true , audience: String ? = nil , issuer: String ? = nil ) throws -> Payload {
70
78
return try decode ( jwt, algorithms: [ algorithm] , verify: verify, audience: audience, issuer: issuer) . claims
71
79
}
0 commit comments