Require VerifierPolicy not have isolated conformance (#269)

Motivation

While conceptually it is possible for verifier policies to have isolated
conformance, in practice the way PolicyBuilder is implemented makes that
nearly impossible. Given that the utility of an isolated VerifierPolicy
is very limited, let's just disallow it.

Modifications

Require VerifierPolicy to have a SendableMetatype

Result

Easier to build correct compositions over PolicyBuilder
This commit is contained in:
Cory Benfield authored and GitHub committed 2025-08-28 10:32:31 +01:00
1 parent c059d9c9d0
commit 20c451f1ad
3 files changed
+22 -1

No files matched your search

+1
View File
@@ -118,6 +118,7 @@ add_library(X509
"X509BaseTypes/Time.swift"
"X509BaseTypes/TimeCalculations.swift"
"X509BaseTypes/Validity.swift"
"X509SendableMetatype.swift"
)
target_link_libraries(X509 PUBLIC
+2 -1
View File
@@ -28,8 +28,9 @@ import SwiftASN1
/// the basic checks from that RFC. Other objects are less common, such as ``OCSPVerifierPolicy``, which performs live
/// revocation checking. Users can also implement their own policies to enable swift-certificates to support other
/// use-cases.
@preconcurrency
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *)
public protocol VerifierPolicy {
public protocol VerifierPolicy: _X509SendableMetatype {
/// The X.509 extension types that this policy understands and enforces.
///
/// X.509 certificates can have extensions marked as `critical`. These extensions _must_ be understood and enforced by the
+19
View File
@@ -0,0 +1,19 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftCertificates open source project
//
// Copyright (c) 2025 Apple Inc. and the SwiftCertificates project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftCertificates project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
#if compiler(>=6.2)
public typealias _X509SendableMetatype = SendableMetatype
#else
public typealias _X509SendableMetatype = Any
#endif