Skip to content

Commit d292036

Browse files
authored
Merge pull request #5 from mmllr/main
Adds some conditional Sendable conformances and fixes tests
2 parents 5680858 + bfffba8 commit d292036

File tree

9 files changed

+119
-112
lines changed

9 files changed

+119
-112
lines changed

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ let package = Package(
2121
.testTarget(
2222
name: "SwiftSecurityTests",
2323
dependencies: [
24-
.target(name: "SwiftSecurity")
25-
]
24+
.target(name: "SwiftSecurity"),
25+
],
26+
resources: [.process("Resources")]
2627
),
2728
]
2829
)
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
//
2-
// GenericPassword.swift
2+
// SecItem.swift
33
//
44
//
55
// Created by Dmitriy Zharov on 17.01.2024.
66
//
77

88
import Security
99

10-
public protocol SecItem { }
11-
public protocol SecData: SecItem { }
10+
public protocol SecItem {}
11+
public protocol SecData: SecItem {}
1212

13-
public struct GenericPassword: SecData { }
14-
public struct InternetPassword: SecData { }
13+
public struct GenericPassword: SecData, Sendable {}
14+
public struct InternetPassword: SecData, Sendable {}
1515

16-
extension SecKey: SecItem { }
17-
extension SecCertificate: SecItem { }
18-
extension SecIdentity: SecItem { }
16+
extension SecKey: SecItem {}
17+
extension SecCertificate: SecItem {}
18+
extension SecIdentity: SecItem {}

Sources/SwiftSecurity/Keychain/SecItem/SecValue.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ extension SecValue: CustomDebugStringConvertible {
5555
}
5656
}
5757
}
58+
59+
extension SecValue: Sendable where Value: Sendable {}

Sources/SwiftSecurity/Keychain/SecItemAttr/TokenID.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
import Security
99

10-
public enum TokenID {
10+
public enum TokenID: Sendable {
1111
/**
1212
Specifies an item should be stored in the device's Secure Enclave.
1313

1414
The only keychain items supported by the Secure Enclave are 256-bit elliptic curve private keys (those that have key type kSecAttrKeyTypeEC).
1515
Such keys must be generated directly on the Secure Enclave using the ``SecKeyGeneratePair(_:_:_:)`` function
1616
with the ``tokenID`` key set to ``.secureEnclave`` in the query.
17-
17+
1818
- Important: It is not possible to import pre-existing keys into the Secure Enclave.
1919
*/
2020
case secureEnclave
@@ -29,14 +29,14 @@ extension TokenID: RawRepresentable, CustomStringConvertible {
2929
return nil
3030
}
3131
}
32-
32+
3333
public var rawValue: String {
3434
switch self {
3535
case .secureEnclave:
3636
return String(kSecAttrTokenIDSecureEnclave)
3737
}
3838
}
39-
39+
4040
public var description: String {
4141
switch self {
4242
case .secureEnclave:

Sources/SwiftSecurity/Keychain/SecItemStore/SecItemInfo.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,5 @@ extension SecItemInfo {
409409
get { self[key.rawValue] }
410410
}
411411
}
412+
413+
extension SecItemInfo: Sendable where Value: Sendable {}

Sources/SwiftSecurity/Keychain/SecItemStore/SecItemQuery.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,3 +549,5 @@ extension SecItemQuery {
549549
set { self[key.rawValue] = newValue }
550550
}
551551
}
552+
553+
extension SecItemQuery: Sendable where Value: Sendable {}

0 commit comments

Comments
 (0)