-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from outfoxx/feature/accessibility
Add accessibility support to `SecKey`, `SecKeyPair`, `SecCertificate` & `SecIdentity`
- Loading branch information
Showing
21 changed files
with
677 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ | |
/TestResults | ||
|
||
/ShieldHost/**/xcuserdata/ | ||
/ShieldHost/**/project.xcworkspace/ |
5 changes: 5 additions & 0 deletions
5
ShieldHost/ShieldHost Watch App/ShieldHost Watch App.entitlements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
ShieldHost/ShieldHost.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
ShieldHost/ShieldHost.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
88 changes: 88 additions & 0 deletions
88
ShieldHost/ShieldHost.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "BigInt", | ||
"repositoryURL": "https://github.com/attaswift/BigInt.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", | ||
"version": "5.3.0" | ||
} | ||
}, | ||
{ | ||
"package": "Float16", | ||
"repositoryURL": "https://github.com/SusanDoggie/Float16.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "936ae66adccf1c91bcaeeb9c0cddde78a13695c3", | ||
"version": "1.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "PotentCodables", | ||
"repositoryURL": "https://github.com/outfoxx/PotentCodables.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "0c423eb5fdbbefffd36926430bf99f9f998c0cad", | ||
"version": "3.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "Regex", | ||
"repositoryURL": "https://github.com/sharplet/Regex.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "76c2b73d4281d77fc3118391877efd1bf972f515", | ||
"version": "2.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "swift-algorithms", | ||
"repositoryURL": "https://github.com/apple/swift-algorithms", | ||
"state": { | ||
"branch": null, | ||
"revision": "b14b7f4c528c942f121c8b860b9410b2bf57825e", | ||
"version": "1.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "swift-collections", | ||
"repositoryURL": "https://github.com/apple/swift-collections.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2", | ||
"version": "1.0.4" | ||
} | ||
}, | ||
{ | ||
"package": "SwiftDocCPlugin", | ||
"repositoryURL": "https://github.com/apple/swift-docc-plugin", | ||
"state": { | ||
"branch": null, | ||
"revision": "10bc670db657d11bdd561e07de30a9041311b2b1", | ||
"version": "1.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "SymbolKit", | ||
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit", | ||
"state": { | ||
"branch": null, | ||
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34", | ||
"version": "1.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "swift-numerics", | ||
"repositoryURL": "https://github.com/apple/swift-numerics", | ||
"state": { | ||
"branch": null, | ||
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b", | ||
"version": "1.0.2" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// SecAccessibility.swift | ||
// Shield | ||
// | ||
// Copyright © 2021 Outfox, inc. | ||
// | ||
// | ||
// Distributed under the MIT License, See LICENSE for details. | ||
// | ||
|
||
import Security | ||
|
||
|
||
public enum SecAccessibility: Equatable { | ||
case `default` | ||
case unlocked(afterFirst: Bool, shared: Bool) | ||
case passcodeEnabled | ||
#if ACCESSIBILITY_ALWAYS_ENABLED | ||
case always(shared: Bool) | ||
#endif | ||
} | ||
|
||
|
||
extension SecAccessibility { | ||
|
||
var attr: Any { | ||
|
||
switch self { | ||
|
||
#if ACCESSIBILITY_ALWAYS_ENABLED | ||
case .always(shared: true): | ||
return kSecAttrAccessibleAlways as String | ||
|
||
case .always(shared: false): | ||
return kSecAttrAccessibleAlwaysThisDeviceOnly as String | ||
#endif | ||
|
||
case .unlocked(afterFirst: true, shared: true): | ||
return kSecAttrAccessibleAfterFirstUnlock as String | ||
|
||
case .unlocked(afterFirst: true, shared: false): | ||
return kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly as String | ||
|
||
case .unlocked(afterFirst: false, shared: true), .default: | ||
return kSecAttrAccessibleWhenUnlocked as String | ||
|
||
case .unlocked(afterFirst: false, shared: false): | ||
return kSecAttrAccessibleWhenUnlockedThisDeviceOnly as String | ||
|
||
case .passcodeEnabled: | ||
return kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly as String | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.