Skip to content

Commit

Permalink
fix: updated x509 chain to string array
Browse files Browse the repository at this point in the history
BREAKING CHANGE: x5c/x509CertificateChain is now an array of strings
  • Loading branch information
dtsiflit authored and beatt83 committed Oct 2, 2024
1 parent bfe8152 commit c289a01
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension DefaultJWEHeaderImpl: Codable {
jwk = try container.decodeIfPresent(JWK.self, forKey: .jwk)
keyID = try container.decodeIfPresent(String.self, forKey: .keyID)
x509URL = try container.decodeIfPresent(String.self, forKey: .x509URL)
x509CertificateChain = try container.decodeIfPresent(String.self, forKey: .x509CertificateChain)
x509CertificateChain = try container.decodeIfPresent([String].self, forKey: .x509CertificateChain)
x509CertificateSHA1Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA1Thumbprint)
x509CertificateSHA256Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA256Thumbprint)
ephemeralPublicKey = try container.decodeIfPresent(JWK.self, forKey: .ephemeralPublicKey)
Expand Down
10 changes: 5 additions & 5 deletions Sources/JSONWebEncryption/JWERegisteredFieldsHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public protocol JWERegisteredFieldsHeader: JWARegisteredFieldsHeader {
var x509URL: String? { get set }

/// X.509 public key certificate or certificate chain in string format.
var x509CertificateChain: String? { get set }
var x509CertificateChain: [String]? { get set }

/// Base64URL-encoded SHA-1 thumbprint of the DER encoding of an X.509 certificate, used for key identification.
var x509CertificateSHA1Thumbprint: String? { get set }
Expand Down Expand Up @@ -87,7 +87,7 @@ public protocol JWERegisteredFieldsHeader: JWARegisteredFieldsHeader {
jwkSetURL: String?,
jwk: JWK?,
x509URL: String?,
x509CertificateChain: String?,
x509CertificateChain: [String]?,
x509CertificateSHA1Thumbprint: String?,
x509CertificateSHA256Thumbprint: String?,
type: String?,
Expand All @@ -113,7 +113,7 @@ extension JWERegisteredFieldsHeader {
jwkSetURL: String? = nil,
jwk: JWK? = nil,
x509URL: String? = nil,
x509CertificateChain: String? = nil,
x509CertificateChain: [String]? = nil,
x509CertificateSHA1Thumbprint: String? = nil,
x509CertificateSHA256Thumbprint: String? = nil,
type: String? = nil,
Expand Down Expand Up @@ -222,7 +222,7 @@ public struct DefaultJWEHeaderImpl: JWERegisteredFieldsHeader {
public var jwkSetURL: String?
public var jwk: JWK?
public var x509URL: String?
public var x509CertificateChain: String?
public var x509CertificateChain: [String]?
public var x509CertificateSHA1Thumbprint: String?
public var x509CertificateSHA256Thumbprint: String?
public var type: String?
Expand Down Expand Up @@ -258,7 +258,7 @@ public struct DefaultJWEHeaderImpl: JWERegisteredFieldsHeader {
jwkSetURL: String?,
jwk: JWK?,
x509URL: String?,
x509CertificateChain: String?,
x509CertificateChain: [String]?,
x509CertificateSHA1Thumbprint: String?,
x509CertificateSHA256Thumbprint: String?,
type: String?,
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONWebKey/JWK+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extension JWK: Codable {
}
keyID = try container.decodeIfPresent(String.self, forKey: .keyID)
x509URL = try container.decodeIfPresent(String.self, forKey: .x509URL)
x509CertificateChain = try container.decodeIfPresent(String.self, forKey: .x509CertificateChain)
x509CertificateChain = try container.decodeIfPresent([String].self, forKey: .x509CertificateChain)
x509CertificateSHA1Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA1Thumbprint)
x509CertificateSHA256Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA256Thumbprint)
curve = try container.decodeIfPresent(JWK.CryptographicCurve.self, forKey: .curve)
Expand Down
4 changes: 2 additions & 2 deletions Sources/JSONWebKey/JWK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct JWK: Equatable, Hashable {
public var x509URL: String?

/// The X.509 Certificate Chain.
public var x509CertificateChain: String?
public var x509CertificateChain: [String]?

/// The X.509 certificate SHA-1 thumbprint.
public var x509CertificateSHA1Thumbprint: String?
Expand Down Expand Up @@ -84,7 +84,7 @@ public struct JWK: Equatable, Hashable {
key: Data? = nil,
keyID: String? = nil,
x509URL: String? = nil,
x509CertificateChain: String? = nil,
x509CertificateChain: [String]? = nil,
x509CertificateSHA1Thumbprint: String? = nil,
x509CertificateSHA256Thumbprint: String? = nil,
curve: CryptographicCurve? = nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension DefaultJWSHeaderImpl: Codable {
jwk = try container.decodeIfPresent(JWK.self, forKey: .jwk)
keyID = try container.decodeIfPresent(String.self, forKey: .keyID)
x509URL = try container.decodeIfPresent(String.self, forKey: .x509URL)
x509CertificateChain = try container.decodeIfPresent(String.self, forKey: .x509CertificateChain)
x509CertificateChain = try container.decodeIfPresent([String].self, forKey: .x509CertificateChain)
x509CertificateSHA1Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA1Thumbprint)
x509CertificateSHA256Thumbprint = try container.decodeIfPresent(String.self, forKey: .x509CertificateSHA256Thumbprint)
type = try container.decodeIfPresent(String.self, forKey: .type)
Expand Down
6 changes: 3 additions & 3 deletions Sources/JSONWebSignature/JWSRegisteredFieldsHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public protocol JWSRegisteredFieldsHeader: Codable {
var x509URL: String? { get set }

/// X.509 public key certificate or certificate chain.
var x509CertificateChain: String? { get set }
var x509CertificateChain: [String]? { get set }

/// Base64URL-encoded SHA-1 thumbprint (a.k.a. digest) of the DER encoding of an X.509 certificate.
var x509CertificateSHA1Thumbprint: String? { get set }
Expand Down Expand Up @@ -65,7 +65,7 @@ public struct DefaultJWSHeaderImpl: JWSRegisteredFieldsHeader {
public var jwkSetURL: String?
public var jwk: JWK?
public var x509URL: String?
public var x509CertificateChain: String?
public var x509CertificateChain: [String]?
public var x509CertificateSHA1Thumbprint: String?
public var x509CertificateSHA256Thumbprint: String?
public var type: String?
Expand All @@ -92,7 +92,7 @@ public struct DefaultJWSHeaderImpl: JWSRegisteredFieldsHeader {
jwkSetURL: String? = nil,
jwk: JWK? = nil,
x509URL: String? = nil,
x509CertificateChain: String? = nil,
x509CertificateChain: [String]? = nil,
x509CertificateSHA1Thumbprint: String? = nil,
x509CertificateSHA256Thumbprint: String? = nil,
type: String? = nil,
Expand Down

0 comments on commit c289a01

Please sign in to comment.