Skip to content

Commit 625d438

Browse files
authored
Change canImport condition (#6238)
1 parent 4559d27 commit 625d438

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Sources/PackageSigning/SignatureProvider.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import struct Foundation.Data
1414

15-
#if canImport(Darwin)
15+
#if canImport(Security)
1616
import Security
1717
#endif
1818

@@ -166,7 +166,7 @@ struct CMSSignatureProvider: SignatureProviderProtocol {
166166
intermediateCertificates: [[UInt8]],
167167
observabilityScope: ObservabilityScope
168168
) async throws -> [UInt8] {
169-
#if canImport(Darwin)
169+
#if canImport(Security)
170170
if CFGetTypeID(identity as CFTypeRef) == SecIdentityGetTypeID() {
171171
let secIdentity = identity as! SecIdentity // !-safe because we ensure type above
172172

@@ -251,7 +251,7 @@ struct CMSSignatureProvider: SignatureProviderProtocol {
251251
}
252252
}
253253

254-
#if canImport(Darwin)
254+
#if canImport(Security)
255255
extension SecKey {
256256
func sign(content: [UInt8], algorithm: SignatureAlgorithm) throws -> [UInt8] {
257257
let secKeyAlgorithm: SecKeyAlgorithm

Sources/PackageSigning/SigningIdentity.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if canImport(Darwin)
13+
#if canImport(Security)
1414
import Security
1515
#endif
1616

@@ -22,7 +22,7 @@ public protocol SigningIdentity {}
2222

2323
// MARK: - SecIdentity conformance to SigningIdentity
2424

25-
#if canImport(Darwin)
25+
#if canImport(Security)
2626
extension SecIdentity: SigningIdentity {}
2727
#endif
2828

@@ -52,7 +52,7 @@ public struct SwiftSigningIdentity: SigningIdentity {
5252
do {
5353
switch privateKeyType {
5454
case .p256:
55-
#if canImport(Darwin)
55+
#if canImport(Security)
5656
if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
5757
self.privateKey = try Certificate.PrivateKey(P256.Signing.PrivateKey(derRepresentation: privateKey))
5858
} else {
@@ -80,7 +80,7 @@ public struct SigningIdentityStore {
8080
}
8181

8282
public func find(by label: String) async -> [SigningIdentity] {
83-
#if canImport(Darwin)
83+
#if canImport(Security)
8484
// Find in Keychain
8585
let query: [String: Any] = [
8686
// Use kSecClassCertificate instead of kSecClassIdentity because the latter

Sources/PackageSigning/X509Extensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212

1313
import struct Foundation.Data
1414

15-
#if canImport(Darwin)
15+
#if canImport(Security)
1616
import Security
1717
#endif
1818

1919
import Basics
2020
@_implementationOnly import SwiftASN1
2121
@_implementationOnly import X509
2222

23-
#if canImport(Darwin)
23+
#if canImport(Security)
2424
extension Certificate {
2525
init(secCertificate: SecCertificate) throws {
2626
let data = SecCertificateCopyData(secCertificate) as Data

Tests/CommandsTests/PackageRegistryToolTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ final class PackageRegistryToolTests: CommandsTestCase {
506506
)
507507

508508
// FIXME: test cert chain is not considered valid on non-Darwin platforms
509-
#if canImport(Darwin)
509+
#if canImport(Security)
510510
// Read and validate signature
511511
let signature = try localFileSystem.readFileContents(signaturePath).contents
512512
let archive = try localFileSystem.readFileContents(archivePath).contents

Tests/PackageSigningTests/SigningEntityTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class SigningEntityTests: XCTestCase {
5252
}
5353
}
5454

55-
#if canImport(Darwin)
55+
#if canImport(Security)
5656
func testFromKeychainCertificate() async throws {
5757
#if ENABLE_REAL_SIGNING_IDENTITY_TEST
5858
#else

Tests/PackageSigningTests/SigningIdentityTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final class SigningIdentityTests: XCTestCase {
7777
}
7878
}
7979

80-
#if canImport(Darwin)
80+
#if canImport(Security)
8181
func testSigningIdentityFromKeychain() async throws {
8282
#if ENABLE_REAL_SIGNING_IDENTITY_TEST
8383
#else

Tests/PackageSigningTests/SigningTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class SigningTests: XCTestCase {
4141
)
4242

4343
// FIXME: test cert chain is not considered valid on non-Darwin platforms
44-
#if canImport(Darwin)
44+
#if canImport(Security)
4545
var verifierConfiguration = VerifierConfiguration()
4646
verifierConfiguration.trustedRoots = [keyAndCertChain.rootCertificate]
4747

@@ -81,7 +81,7 @@ final class SigningTests: XCTestCase {
8181
)
8282

8383
// FIXME: test cert chain is not considered valid on non-Darwin platforms
84-
#if canImport(Darwin)
84+
#if canImport(Security)
8585
var verifierConfiguration = VerifierConfiguration()
8686
verifierConfiguration.trustedRoots = [keyAndCertChain.rootCertificate]
8787

@@ -120,7 +120,7 @@ final class SigningTests: XCTestCase {
120120
)
121121

122122
// FIXME: test cert chain is not considered valid on non-Darwin platforms
123-
#if canImport(Darwin)
123+
#if canImport(Security)
124124
var verifierConfiguration = VerifierConfiguration()
125125
verifierConfiguration.trustedRoots = [keyAndCertChain.rootCertificate]
126126

@@ -167,7 +167,7 @@ final class SigningTests: XCTestCase {
167167
}
168168
}
169169

170-
#if canImport(Darwin)
170+
#if canImport(Security)
171171
func testCMS1_0_0EndToEndWithSigningIdentityFromKeychain() async throws {
172172
#if ENABLE_REAL_SIGNING_IDENTITY_TEST
173173
#else
@@ -215,7 +215,7 @@ final class SigningTests: XCTestCase {
215215
}
216216
#endif
217217

218-
#if canImport(Darwin)
218+
#if canImport(Security)
219219
func testCMSEndToEndWithECSigningIdentityFromKeychain() async throws {
220220
#if ENABLE_REAL_SIGNING_IDENTITY_TEST
221221
#else
@@ -261,7 +261,7 @@ final class SigningTests: XCTestCase {
261261
}
262262
#endif
263263

264-
#if canImport(Darwin)
264+
#if canImport(Security)
265265
func testCMSEndToEndWithRSASigningIdentityFromKeychain() async throws {
266266
#if ENABLE_REAL_SIGNING_IDENTITY_TEST
267267
#else

0 commit comments

Comments
 (0)