File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11Pod ::Spec . new do |spec |
22 spec . name = 'JSONWebToken'
3- spec . version = '1.0.0 '
3+ spec . version = '1.0.1 '
44 spec . summary = 'Swift library for JSON Web Tokens (JWT).'
55 spec . homepage = 'https://github.com/kylef/JSONWebToken.swift'
66 spec . license = { :type => 'BSD' , :file => 'LICENSE' }
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ public enum Algorithm : Printable {
1313
1414 static func algorithm( name: String , key: String ? ) -> Algorithm ? {
1515 if name == " none " {
16+ if let key = key {
17+ return nil // We don't allow nil when we configured a key
18+ }
1619 return Algorithm . None
1720 } else if let key = key {
1821 if name == " HS256 " {
Original file line number Diff line number Diff line change @@ -143,6 +143,11 @@ class JWTDecodeTests : XCTestCase {
143143 XCTAssertEqual ( payload as NSDictionary , [ " test " : " ing " ] )
144144 }
145145 }
146+
147+ func testNoneFailsWithSecretAlgorithm( ) {
148+ let jwt = " eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ0ZXN0IjoiaW5nIn0. "
149+ assertFailure ( decode ( jwt, key: " secret " ) )
150+ }
146151}
147152
148153// MARK: Helpers
You can’t perform that action at this time.
0 commit comments