Compare commits
7 Commits
rocket-link
...
2.0
| Author | SHA1 | Date | |
|---|---|---|---|
| ec6d2f4ee7 | |||
| c302757509 | |||
| 267a0559b9 | |||
| 02f824664a | |||
| 6665a7e16f | |||
| 82b46fc760 | |||
| 6c30f710b2 |
@@ -333,6 +333,7 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Pod/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
@@ -350,6 +351,7 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Pod/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// Copyright (c) 2014 Colour Coding. All rights reserved.
|
||||
//
|
||||
|
||||
@testable import Locksmith
|
||||
import CoreFoundation
|
||||
import UIKit
|
||||
import Security
|
||||
|
||||
@@ -68,9 +68,9 @@ public class Locksmith: NSObject {
|
||||
|
||||
switch type {
|
||||
case .Create:
|
||||
status = withUnsafeMutablePointer(&result) { SecItemAdd(requestReference, UnsafeMutablePointer($0)) }
|
||||
status = SecItemAdd(requestReference, &result)
|
||||
case .Read:
|
||||
status = withUnsafeMutablePointer(&result) { SecItemCopyMatching(requestReference, UnsafeMutablePointer($0)) }
|
||||
status = SecItemCopyMatching(requestReference, &result)
|
||||
case .Delete:
|
||||
status = SecItemDelete(requestReference)
|
||||
case .Update:
|
||||
|
||||
@@ -50,7 +50,9 @@ public enum SecurityClass: RawRepresentable {
|
||||
|
||||
// MARK: Accessible
|
||||
public enum Accessible: RawRepresentable {
|
||||
case WhenUnlocked, AfterFirstUnlock, Always, WhenPasscodeSetThisDeviceOnly, WhenUnlockedThisDeviceOnly, AfterFirstUnlockThisDeviceOnly, AlwaysThisDeviceOnly
|
||||
case WhenUnlocked, AfterFirstUnlock, Always, WhenUnlockedThisDeviceOnly, AfterFirstUnlockThisDeviceOnly, AlwaysThisDeviceOnly
|
||||
@available (iOS 8,*)
|
||||
case WhenPasscodeSetThisDeviceOnly
|
||||
|
||||
public init?(rawValue: String) {
|
||||
switch rawValue {
|
||||
@@ -60,8 +62,6 @@ public enum Accessible: RawRepresentable {
|
||||
self = AfterFirstUnlock
|
||||
case String(kSecAttrAccessibleAlways):
|
||||
self = Always
|
||||
case String(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly):
|
||||
self = WhenPasscodeSetThisDeviceOnly
|
||||
case String(kSecAttrAccessibleWhenUnlockedThisDeviceOnly):
|
||||
self = WhenUnlockedThisDeviceOnly
|
||||
case String(kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly):
|
||||
@@ -69,8 +69,17 @@ public enum Accessible: RawRepresentable {
|
||||
case String(kSecAttrAccessibleAlwaysThisDeviceOnly):
|
||||
self = AlwaysThisDeviceOnly
|
||||
default:
|
||||
print("Accessible: invalid rawValue provided. Defaulting to Accessible.WhenUnlocked.")
|
||||
self = WhenUnlocked
|
||||
if #available(iOS 8,*) {
|
||||
if rawValue == String(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly) {
|
||||
self = WhenPasscodeSetThisDeviceOnly
|
||||
} else {
|
||||
print("Accessible: invalid rawValue provided. Defaulting to Accessible.WhenUnlocked.")
|
||||
self = WhenUnlocked
|
||||
}
|
||||
} else {
|
||||
print("Accessible: invalid rawValue provided. Defaulting to Accessible.WhenUnlocked.")
|
||||
self = WhenUnlocked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +92,11 @@ public enum Accessible: RawRepresentable {
|
||||
case .Always:
|
||||
return String(kSecAttrAccessibleAlways)
|
||||
case .WhenPasscodeSetThisDeviceOnly:
|
||||
return String(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
|
||||
if #available(iOS 8.0, *) {
|
||||
return String(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
|
||||
} else {
|
||||
fatalError("Accessible.WhenPasscodeSetThisDeviceOnly has no raw representation in iOS 7.")
|
||||
}
|
||||
case .WhenUnlockedThisDeviceOnly:
|
||||
return String(kSecAttrAccessibleWhenUnlockedThisDeviceOnly)
|
||||
case .AfterFirstUnlockThisDeviceOnly:
|
||||
|
||||
Reference in New Issue
Block a user