Guard Security.framework usage with canImport(Security) (#614)

The certificate validation code only needs the `Security` framework, not
`Darwin`.
This commit is contained in:
Franz Busch authored and GitHub committed 2026-11-09 10:17:57 +01:00
1 parent 15e0b9e495
commit 2a439aff65
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -536,7 +536,7 @@ public final class NIOSSLContext {
let conn = SSLConnection(ownedSSL: ssl, parentContext: self)
// If we need to turn on the validation on Apple platforms, do it here.
#if canImport(Darwin)
#if canImport(Security)
switch self.configuration.trustRoots {
case .some(.default), .none:
conn.setCustomVerificationCallback(
@@ -15,7 +15,7 @@
import NIOCore
// We can only use Security.framework to validate TLS certificates on Apple platforms.
#if canImport(Darwin)
#if canImport(Security)
import Dispatch
import Foundation
@preconcurrency import Security