Skip to content

Commit

Permalink
Improve JWKS find(identifier:type:) (#90)
Browse files Browse the repository at this point in the history
Refactoring filter and first syntax

Co-authored-by: Tim Condon <[email protected]>
  • Loading branch information
nnsnodnb and 0xTim authored Jul 5, 2023
1 parent 8b3a69c commit 78b292d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/JWTKit/JWK/JWKS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct JWKS: Codable {
/// - identifier: The `kid` value to lookup.
/// - type: The `kty` value.
public func find(identifier: String, type: JWK.KeyType) -> JWK? {
self.keys.filter { $0.keyType == type && $0.keyIdentifier?.string == identifier }.first
self.keys.first(where: { $0.keyType == type && $0.keyIdentifier?.string == identifier })
}

/// Retrieves the desired key from the JSON Web Key Set
Expand Down

0 comments on commit 78b292d

Please sign in to comment.