1- import X509
1+ @ _spi ( FixedExpiryValidationTime ) import X509
22
33#if !canImport(Darwin)
44import FoundationEssentials
@@ -60,8 +60,8 @@ public struct X5CVerifier: Sendable {
6060 /// - Returns: A `X509.VerificationResult` indicating the result of the verification.
6161 public func verifyChain(
6262 certificates: [ String ] ,
63- policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( validationTime : Date ( ) ) }
64- ) async throws -> X509 . VerificationResult {
63+ policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( ) }
64+ ) async throws -> X509 . CertificateValidationResult {
6565 let certificates = try certificates. map { try Certificate ( pemEncoded: $0) }
6666 return try await verifyChain ( certificates: certificates, policy: policy)
6767 }
@@ -74,12 +74,12 @@ public struct X5CVerifier: Sendable {
7474 /// - Returns: A `X509.VerificationResult` indicating the result of the verification.
7575 public func verifyChain(
7676 certificates: [ Certificate ] ,
77- @PolicyBuilder policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( validationTime : Date ( ) ) }
78- ) async throws -> X509 . VerificationResult {
77+ @PolicyBuilder policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( ) }
78+ ) async throws -> X509 . CertificateValidationResult {
7979 let untrustedChain = CertificateStore ( certificates)
8080 var verifier = try Verifier ( rootCertificates: trustedStore, policy: policy)
8181 let result = await verifier. validate (
82- leafCertificate : certificates [ 0 ] , intermediates: untrustedChain)
82+ leaf : certificates [ 0 ] , intermediates: untrustedChain)
8383 return result
8484 }
8585
@@ -141,7 +141,7 @@ public struct X5CVerifier: Sendable {
141141 _ token: some DataProtocol ,
142142 as _: Payload . Type = Payload . self,
143143 jsonDecoder: any JWTJSONDecoder ,
144- @PolicyBuilder policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( validationTime : Date ( ) ) }
144+ @PolicyBuilder policy: ( ) throws -> some VerifierPolicy = { RFC5280Policy ( ) }
145145 ) async throws -> Payload
146146 where Payload: JWTPayload {
147147 // Parse the JWS header to get the header
@@ -187,12 +187,12 @@ public struct X5CVerifier: Sendable {
187187 rootCertificates: trustedStore,
188188 policy: {
189189 try policy ( )
190- RFC5280Policy ( validationTime : date)
190+ RFC5280Policy ( fixedExpiryValidationTime : date)
191191 } )
192192
193193 // Validate the leaf certificate against the trusted store
194194 let result = await verifier. validate (
195- leafCertificate : certificates [ 0 ] ,
195+ leaf : certificates [ 0 ] ,
196196 intermediates: untrustedChain
197197 )
198198
0 commit comments