Summary: - Sources: add LocalData.swift, Models, Protocols (+1 more) - Tests: add tests for LocalDataTests.swift - Docs: add docs for Proposal, README - Config: add Package - Other: add .gitignore Stats: - 19 files changed, 814 insertions(+)
28 lines
731 B
Swift
28 lines
731 B
Swift
import Foundation
|
|
import Security
|
|
|
|
public enum KeychainAccessControl: Sendable {
|
|
case userPresence
|
|
// Add more as needed
|
|
|
|
func accessControl(accessibility: KeychainAccessibility) -> SecAccessControl? {
|
|
let accessibilityValue: CFString
|
|
switch accessibility {
|
|
case .whenUnlocked:
|
|
accessibilityValue = kSecAttrAccessibleWhenUnlocked
|
|
case .afterFirstUnlock:
|
|
accessibilityValue = kSecAttrAccessibleAfterFirstUnlock
|
|
}
|
|
|
|
switch self {
|
|
case .userPresence:
|
|
return SecAccessControlCreateWithFlags(
|
|
nil,
|
|
accessibilityValue,
|
|
.userPresence,
|
|
nil
|
|
)
|
|
}
|
|
}
|
|
}
|