@@ -18,7 +18,7 @@ class DecodeTests: XCTestCase {
1818 }
1919
2020 func testFailsToDecodeInvalidStringWithoutThreeSegments( ) {
21- XCTAssertThrowsError ( try decode ( " a.b " , algorithm: . none) , " Not enough segments " )
21+ XCTAssertThrowsError ( try decode ( " a.b " , algorithm: . none) as ClaimSet , " Not enough segments " )
2222 }
2323
2424 // MARK: Disable verify
@@ -39,24 +39,24 @@ class DecodeTests: XCTestCase {
3939
4040 func testIncorrectIssuerValidation( ) {
4141 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJmdWxsZXIubGkifQ.wOhJ9_6lx-3JGJPmJmtFCDI3kt7uMAMmhHIslti7ryI "
42- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , issuer: " querykit.org " ) )
42+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , issuer: " querykit.org " ) as ClaimSet )
4343 }
4444
4545 func testMissingIssuerValidation( ) {
4646 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.2_8pWJfyPup0YwOXK7g9Dn0cF1E3pdn299t4hSeJy5w "
47- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , issuer: " fuller.li " ) )
47+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , issuer: " fuller.li " ) as ClaimSet )
4848 }
4949
5050 // MARK: Expiration claim
5151
5252 func testExpiredClaim( ) {
5353 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0MjgxODg0OTF9.cy6b2szsNkKnHFnz2GjTatGjoHBTs8vBKnPGZgpp91I "
54- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) )
54+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) as ClaimSet )
5555 }
5656
5757 func testInvalidExpiaryClaim( ) {
5858 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOlsiMTQyODE4ODQ5MSJdfQ.OwF-wd3THjxrEGUhh6IdnNhxQZ7ydwJ3Z6J_dfl9MBs "
59- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) )
59+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) as ClaimSet )
6060 }
6161
6262 func testUnexpiredClaim( ) throws {
@@ -99,7 +99,7 @@ class DecodeTests: XCTestCase {
9999 func testUnmetNotBeforeClaim( ) {
100100 // If this just started failing, hello 2024!
101101 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3MjgxODg0OTF9.Tzhu1tu-7BXcF5YEIFFE1Vmg4tEybUnaz58FR4PcblQ "
102- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) )
102+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) as ClaimSet )
103103 }
104104
105105 // MARK: Issued at claim
@@ -121,7 +121,7 @@ class DecodeTests: XCTestCase {
121121 func testIssuedAtClaimInTheFuture( ) {
122122 // If this just started failing, hello 2024!
123123 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjgxODg0OTF9.owHiJyJmTcW1lBW5y_Rz3iBfSbcNiXlbZ2fY9qR7-aU "
124- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) )
124+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) as ClaimSet )
125125 }
126126
127127 func testInvalidIssuedAtClaim( ) {
@@ -149,12 +149,12 @@ class DecodeTests: XCTestCase {
149149
150150 func testMismatchAudienceClaim( ) {
151151 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJreWxlIn0.VEB_n06pTSLlTXPFkc46ARADJ9HXNUBUPo3VhL9RDe4 " // kyle
152- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , audience: " maxine " ) )
152+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , audience: " maxine " ) as ClaimSet )
153153 }
154154
155155 func testMissingAudienceClaim( ) {
156156 let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.2_8pWJfyPup0YwOXK7g9Dn0cF1E3pdn299t4hSeJy5w "
157- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , audience: " kyle " ) )
157+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) , audience: " kyle " ) as ClaimSet )
158158 }
159159
160160 // MARK: Signature verification
@@ -168,7 +168,7 @@ class DecodeTests: XCTestCase {
168168
169169 func testNoneFailsWithSecretAlgorithm( ) {
170170 let jwt = " eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ0ZXN0IjoiaW5nIn0. "
171- XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) )
171+ XCTAssertThrowsError ( try decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) ) as ClaimSet )
172172 }
173173
174174 func testMatchesAnyAlgorithm( ) {
0 commit comments