-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[117] Allow JWK parameters of type [String] #120
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
722937b
Implement decoding of String and [String] parameters
dlggr 0478b7c
Adapt tests
dlggr 9d98e85
Add new test case
dlggr 32c1e11
Remove key type computed property
dlggr 0bcdd26
Update tests
dlggr daedd4b
Fix long lines
dlggr c27f7fa
Update readme
dlggr 82ca0c2
Move parameter getter extension
dlggr 9a6eaa7
Add doc comments to param getters
dlggr 2cf0c6a
Remove old array parameter test
dlggr 3e7ea46
Merge branch 'master' into feature/string-array-jwk-parameters
2d75cc2
Merge branch 'master' into feature/string-array-jwk-parameters
bf2539b
Use Codable for JWKPArameterType
daniel-moh 763c67f
Use JWKPArameterType instsead of Any for subscript
daniel-moh 5ad7f1a
Merge branch 'master' into feature/string-array-jwk-parameters
daniel-moh f006882
Adapt EC keys for String arary parameters
daniel-moh fcee76c
Adapt tests
daniel-moh da05a0c
Add symmetric key parsing tests
daniel-moh df830e1
Merge branch 'master' into feature/string-array-jwk-parameters
99b7b0a
Add rsa tests to test target
daniel-moh 3044537
Switch on parameter type in a single loop
daniel-moh 575d31a
Add single loop decoding for ec private key as well
daniel-moh fe2dfe3
Add single loop decoding for rsa private key as well
daniel-moh 3ae5424
Merge branch 'master' into feature/string-array-jwk-parameters
b75f698
Resolve conflicts
daniel-moh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -24,6 +24,12 @@ | |
|
||
import Foundation | ||
|
||
// Common protocol for all types that can be used as JWK parameters. | ||
public protocol JWKParameterType: Codable { } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
|
||
extension String: JWKParameterType { } | ||
extension Array: JWKParameterType where Element == String { } | ||
|
||
/// Possible common JWK parameters. | ||
/// See [RFC-7517, Section 4](https://tools.ietf.org/html/rfc7517#section-4) for details. | ||
public enum JWKParameter: String, CodingKey { | ||
|
@@ -37,10 +43,15 @@ public enum JWKParameter: String, CodingKey { | |
case X509CertificateSHA1Thumbprint = "x5t" | ||
case X509CertificateSHA256Thumbprint = "x5t#S256" | ||
|
||
static let nonStringParameters: [JWKParameter] = [ | ||
.keyOperations, | ||
.X509CertificateChain | ||
] | ||
var type: Codable.Type { | ||
switch self { | ||
case .keyType, .keyUse, .algorithm, .keyIdentifier, | ||
.X509URL, .X509CertificateSHA1Thumbprint, .X509CertificateSHA256Thumbprint: | ||
return String.self | ||
case .keyOperations, .X509CertificateChain: | ||
return [String].self | ||
} | ||
} | ||
} | ||
|
||
/// RSA specific JWK parameters. | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing_newline
JWKExtensions.swift:104