Compare commits

...

7 Commits

Author SHA1 Message Date
Matthew Palmer ec6d2f4ee7 Merge pull request #54 from frnde/2.0
Xcode 7 Beta 6 Runtime crash fix
2015-09-04 20:53:09 +10:00
Mounir Dellagi c302757509 Test 2015-09-01 13:52:25 +02:00
Matthew Palmer 267a0559b9 Merge pull request #44 from frnde/2.0
Enabling Testability in main project target to fix errors when compiling
2015-08-05 20:25:39 +10:00
Mounir Dellagi 02f824664a Enabling Testability in main project target to fix errors when compiling 2015-08-03 12:03:19 +02:00
Matthew Palmer 6665a7e16f Merge pull request #43 from jankase/2.0
solve compilation problem for iOS7 targeted apps
2015-08-02 20:08:32 +10:00
Jan Kase 82b46fc760 changed iOS7 fatal error message + make available only for iOS8 WhenPasscodeSetThisDeviceOnly 2015-08-02 09:43:32 +02:00
Jan Kase 6c30f710b2 solve compilation problem for iOS7 targeted apps 2015-08-01 21:09:07 +02:00
4 changed files with 24 additions and 8 deletions
+2
View File
@@ -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";
+1
View File
@@ -5,6 +5,7 @@
// Copyright (c) 2014 Colour Coding. All rights reserved.
//
@testable import Locksmith
import CoreFoundation
import UIKit
import Security
+2 -2
View File
@@ -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:
+19 -6
View File
@@ -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: