Skip to content

Commit 1c58405

Browse files
committed
Renames SecAccessPolicy to AccessPolicy
1 parent aa7f9c5 commit 1c58405

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Sources/SwiftSecurity/Keychain/Keychain.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ extension Keychain: SecItemStore {
181181
// MARK: - GenericPassword
182182

183183
extension Keychain: SecDataStore {
184-
public func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<GenericPassword>, accessPolicy: SecAccessPolicy = .default) throws {
184+
public func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<GenericPassword>, accessPolicy: AccessPolicy = .default) throws {
185185
try store(.data(data.rawRepresentation), query: query, accessPolicy: accessPolicy)
186186
}
187187

@@ -202,7 +202,7 @@ extension Keychain: SecDataStore {
202202
// MARK: - InternetPassword
203203

204204
extension Keychain {
205-
public func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<InternetPassword>, accessPolicy: SecAccessPolicy = .default) throws {
205+
public func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<InternetPassword>, accessPolicy: AccessPolicy = .default) throws {
206206
try store(.data(data.rawRepresentation), query: query, accessPolicy: accessPolicy)
207207
}
208208

@@ -223,7 +223,7 @@ extension Keychain {
223223
// MARK: - SecKey
224224

225225
extension Keychain: SecKeyStore {
226-
public func store<T: SecKeyConvertible>(_ data: T, query: SecItemQuery<SecKey>, accessPolicy: SecAccessPolicy = .default) throws {
226+
public func store<T: SecKeyConvertible>(_ data: T, query: SecItemQuery<SecKey>, accessPolicy: AccessPolicy = .default) throws {
227227
var error: Unmanaged<CFError>?
228228
guard
229229
let key: AnyObject = SecKeyCreateWithData(data.x963Representation as CFData, query.rawValue as CFDictionary, &error)
@@ -259,7 +259,7 @@ extension Keychain: SecKeyStore {
259259
// MARK: - SecCertificate
260260

261261
extension Keychain: SecCertificateStore {
262-
public func store<T: SecCertificateConvertible>(_ data: T, query: SecItemQuery<SecCertificate>, accessPolicy: SecAccessPolicy = .default) throws {
262+
public func store<T: SecCertificateConvertible>(_ data: T, query: SecItemQuery<SecCertificate>, accessPolicy: AccessPolicy = .default) throws {
263263
guard let certificate = SecCertificateCreateWithData(nil, data.derRepresentation as CFData) else {
264264
throw SwiftSecurityError.invalidParameter
265265
}
@@ -307,7 +307,7 @@ extension Keychain: SecIdentityStore {
307307
}
308308
}
309309

310-
public func store(_ item: PKCS12.SecImportItem, query: SecItemQuery<SecIdentity>, accessPolicy: SecAccessPolicy = .default) throws {
310+
public func store(_ item: PKCS12.SecImportItem, query: SecItemQuery<SecIdentity>, accessPolicy: AccessPolicy = .default) throws {
311311
guard let identity = item.identity else {
312312
throw SwiftSecurityError.invalidParameter
313313
}
@@ -334,7 +334,7 @@ extension Keychain: SecIdentityStore {
334334
// MARK: - Private
335335

336336
private extension Keychain {
337-
func store<SecItem>(_ value: SecValue<SecItem>, query: SecItemQuery<SecItem>, accessPolicy: SecAccessPolicy) throws {
337+
func store<SecItem>(_ value: SecValue<SecItem>, query: SecItemQuery<SecItem>, accessPolicy: AccessPolicy) throws {
338338
var query = query
339339
query[.accessGroup] = accessGroup.rawValue
340340
query[.accessControl] = try accessPolicy.accessControl
@@ -455,7 +455,7 @@ extension Keychain {
455455

456456
switch attribute {
457457
case .accessible:
458-
return SecAccessPolicy.Accessibility(rawValue: rawValue)
458+
return AccessPolicy.Accessibility(rawValue: rawValue)
459459
case .protocolType:
460460
return ProtocolType(rawValue: rawValue)
461461
case .authenticationType:

Sources/SwiftSecurity/Keychain/SecItemStore/SecItemInfo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public extension SecItemInfo {
2929
}
3030

3131
/// The corresponding value indicates the item’s one and only access group.
32-
var accessible: SecAccessPolicy.Accessibility? {
32+
var accessible: AccessPolicy.Accessibility? {
3333
get {
3434
if let rawValue = self[.accessible] as? String {
35-
return SecAccessPolicy.Accessibility(rawValue: rawValue)
35+
return AccessPolicy.Accessibility(rawValue: rawValue)
3636
} else {
3737
return nil
3838
}

Sources/SwiftSecurity/Keychain/SecItemStore/SecItemStore.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ public protocol SecItemStore {
2121
public protocol SecDataStore: SecItemStore {
2222
// MARK: - Generic
2323

24-
func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<GenericPassword>, accessPolicy: SecAccessPolicy) throws
24+
func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<GenericPassword>, accessPolicy: AccessPolicy) throws
2525
func retrieve<T: SecDataConvertible>(_ query: SecItemQuery<GenericPassword>, authenticationContext: LAContext?) throws -> T?
2626
func remove(_ query: SecItemQuery<GenericPassword>) throws -> Bool
2727

2828
// MARK: - Internet
2929

30-
func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<InternetPassword>, accessPolicy: SecAccessPolicy) throws
30+
func store<T: SecDataConvertible>(_ data: T, query: SecItemQuery<InternetPassword>, accessPolicy: AccessPolicy) throws
3131
func retrieve<T: SecDataConvertible>(_ query: SecItemQuery<InternetPassword>, authenticationContext: LAContext?) throws -> T?
3232
func remove(_ query: SecItemQuery<InternetPassword>) throws -> Bool
3333
}
3434

3535
// MARK: - SecKey
3636

3737
public protocol SecKeyStore: SecItemStore {
38-
func store<T: SecKeyConvertible>(_ key: T, query: SecItemQuery<SecKey>, accessPolicy: SecAccessPolicy) throws
38+
func store<T: SecKeyConvertible>(_ key: T, query: SecItemQuery<SecKey>, accessPolicy: AccessPolicy) throws
3939
func retrieve<T: SecKeyConvertible>(_ query: SecItemQuery<SecKey>, authenticationContext: LAContext?) throws -> T?
4040
func remove(_ query: SecItemQuery<SecKey>) throws -> Bool
4141
}
4242

4343
// MARK: - SecCertificate
4444

4545
public protocol SecCertificateStore: SecItemStore {
46-
func store<T: SecCertificateConvertible>(_ data: T, query: SecItemQuery<SecCertificate>, accessPolicy: SecAccessPolicy) throws
46+
func store<T: SecCertificateConvertible>(_ data: T, query: SecItemQuery<SecCertificate>, accessPolicy: AccessPolicy) throws
4747
func retrieve<T: SecCertificateConvertible>(_ query: SecItemQuery<SecCertificate>, authenticationContext: LAContext?) throws -> T?
4848
func remove(_ query: SecItemQuery<SecCertificate>) throws -> Bool
4949
}
@@ -52,7 +52,7 @@ public protocol SecCertificateStore: SecItemStore {
5252

5353
public protocol SecIdentityStore: SecItemStore {
5454
func `import`<T: SecIdentityConvertible>(_ data: T, passphrase: String) throws -> [PKCS12.SecImportItem]
55-
func store(_ item: PKCS12.SecImportItem, query: SecItemQuery<SecIdentity>, accessPolicy: SecAccessPolicy) throws
55+
func store(_ item: PKCS12.SecImportItem, query: SecItemQuery<SecIdentity>, accessPolicy: AccessPolicy) throws
5656
func retrieve(_ query: SecItemQuery<SecIdentity>, authenticationContext: LAContext?) throws -> SecIdentity?
5757
func remove(_ query: SecItemQuery<SecIdentity>) throws -> Bool
5858
}

0 commit comments

Comments
 (0)