Compare commits

..

26 Commits

Author SHA1 Message Date
matthewpalmer 6b32c7ec68 Fix regression in update method to fix #110 2016-02-16 20:23:02 +11:00
Matthew Palmer 80df919791 Merge pull request #108 from matthewpalmer/2.0.7
2.0.7
2016-02-14 18:24:59 +11:00
matthewpalmer 2f54712fda Bump podspec 2016-02-14 18:17:57 +11:00
matthewpalmer 78060ecc28 Add extra tests for new update method 2016-02-14 18:15:06 +11:00
Sergey Galezdinov e04d6291d4 Use SecItemUpdate function for updating the data. Added missing updateInSecureStore method to CreateableSecureStorable 2016-02-11 02:46:34 +03:00
Matthew Palmer c29ebcdba8 Merge pull request #102 from gilt/bitcode
full bitcode is needed for running Debug on an Apple TV device, even in Debug mode
2016-01-24 10:39:30 +11:00
Matthew Palmer ed56b9015c Merge pull request #101 from gilt/build_all_architectures
don't set ONLY_ACTIVE_ARCH to YES
2016-01-24 10:39:06 +11:00
Evan Maloney b5f7410d0e full bitcode is needed for running Debug on device
without this setting, it won't be possible to run a Debug build on the device; 'marker' only works in the sim
2016-01-22 14:24:00 -05:00
Evan Maloney e002690ccf don't set ONLY_ACTIVE_ARCH to YES
When embedding this project directly into another Xcode project in a target that:

• Is being built for a platform that has a simulator/device dichotomy (iOS, tvOS, watchOS), and
• Is inside a parent project building a Debug configuration

You will get one of two kinds of errors:

• Either the framework module itself is missing at the 'import' level, or
• Some or all of the framework's public symbols can't be found

The solution is to disable ONLY_ACTIVE_ARCH, which will ensure that both processor architectures are built and the symbols can be found.
2016-01-22 12:23:25 -05:00
Matthew Palmer 6ae6aaedf2 Merge pull request #93 from gambcl/gambcl-carthage-tvos
Added support for tvOS for Carthage builds
2015-12-15 07:31:43 +11:00
Charles Gamble c75cccde53 Change tvOS Deployment Target to 9.0 2015-12-14 13:12:55 +00:00
Matthew Palmer ecef17994c Update README.md 2015-12-11 20:51:19 +11:00
Matthew Palmer 55d9ad27a3 Merge pull request #87 from tc/master
carthage install instructions
2015-12-11 20:50:26 +11:00
Matthew Palmer 3393682ee7 Merge pull request #91 from juliangrosshauser/remove-info-plist-copy-bundle-resources
Remove Info.plist from Copy Bundle Resources phase
2015-12-11 20:49:53 +11:00
Matthew Palmer ff6e09e051 Merge pull request #90 from emrekyv/remove-print-statements
Remove print statements
2015-12-11 20:49:26 +11:00
Julian Grosshauser 6298dc0ec6 Remove Info.plist from Copy Bundle Resources phase
The removal of Info.plist from the Copy Bundle Resources build phase of the iOS target fixes the following warning:

Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Source/Info.plist'.
2015-12-11 00:55:13 +01:00
Emre Kucukayvaz 96d1958632 Remove print statements 2015-12-10 10:47:03 +01:00
Charles Gamble ee5351dfe9 Added carthage support for tvOS build 2015-12-09 13:55:10 +00:00
Matthew Palmer 2459d0c2ff Update README.md 2015-11-23 08:19:06 +11:00
Matthew Palmer effbd18736 Merge pull request #83 from matthewpalmer/matthewpalmer-tvos
Re-add tvOS support
2015-11-22 20:20:41 +11:00
Tommy Chheng bb380ebd3b carthage install instructions 2015-11-16 14:24:33 -08:00
Matthew Palmer 4d9fcd7f77 Update README.md 2015-10-15 06:46:08 +11:00
Matthew Palmer 2ed51c13e7 Update README.md 2015-10-15 06:45:57 +11:00
Matthew Palmer 60a44fe471 Re-add tvOS support 2015-10-15 06:45:02 +11:00
Matthew Palmer da2ea377bc Merge pull request #82 from matthewpalmer/revert-81-master
Revert "Add support for tvOS"
2015-10-15 06:42:32 +11:00
Matthew Palmer 90fb6207ae Revert "Add support for tvOS" 2015-10-15 06:41:29 +11:00
11 changed files with 319 additions and 37 deletions
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Locksmith"
s.version = "2.0.2"
s.version = "2.0.8"
s.summary = "Locksmith is a powerful, protocol-oriented library for working with the keychain in Swift."
s.description = <<-DESC
Locksmith is a powerful, protocol-oriented library for working with the iOS, Mac OS X, watchOS, and tvOS keychain in Swift. It provides extensive support for a lot of different keychain requests, and extensively uses Swift-native concepts.
+132 -11
View File
@@ -7,13 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
056F2A971BA4316700B24B65 /* Dictionary_Initializers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C401BA38539004191AF /* Dictionary_Initializers.swift */; settings = {ASSET_TAGS = (); }; };
056F2A981BA4316700B24B65 /* Locksmith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C421BA38539004191AF /* Locksmith.swift */; settings = {ASSET_TAGS = (); }; };
056F2A991BA4316700B24B65 /* LocksmithAccessibleOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C431BA38539004191AF /* LocksmithAccessibleOption.swift */; settings = {ASSET_TAGS = (); }; };
056F2A9A1BA4316700B24B65 /* LocksmithError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C441BA38539004191AF /* LocksmithError.swift */; settings = {ASSET_TAGS = (); }; };
056F2A9B1BA4316700B24B65 /* LocksmithInternetAuthenticationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C451BA38539004191AF /* LocksmithInternetAuthenticationType.swift */; settings = {ASSET_TAGS = (); }; };
056F2A9C1BA4316700B24B65 /* LocksmithInternetProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C461BA38539004191AF /* LocksmithInternetProtocol.swift */; settings = {ASSET_TAGS = (); }; };
056F2A9D1BA4316700B24B65 /* LocksmithSecurityClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C471BA38539004191AF /* LocksmithSecurityClass.swift */; settings = {ASSET_TAGS = (); }; };
056F2A971BA4316700B24B65 /* Dictionary_Initializers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C401BA38539004191AF /* Dictionary_Initializers.swift */; };
056F2A981BA4316700B24B65 /* Locksmith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C421BA38539004191AF /* Locksmith.swift */; };
056F2A991BA4316700B24B65 /* LocksmithAccessibleOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C431BA38539004191AF /* LocksmithAccessibleOption.swift */; };
056F2A9A1BA4316700B24B65 /* LocksmithError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C441BA38539004191AF /* LocksmithError.swift */; };
056F2A9B1BA4316700B24B65 /* LocksmithInternetAuthenticationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C451BA38539004191AF /* LocksmithInternetAuthenticationType.swift */; };
056F2A9C1BA4316700B24B65 /* LocksmithInternetProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C461BA38539004191AF /* LocksmithInternetProtocol.swift */; };
056F2A9D1BA4316700B24B65 /* LocksmithSecurityClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C471BA38539004191AF /* LocksmithSecurityClass.swift */; };
0EC25C631BA385AB004191AF /* Locksmith.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EC25C591BA385AA004191AF /* Locksmith.framework */; };
0EC25C7F1BA385F6004191AF /* Locksmith.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EC25C751BA385F6004191AF /* Locksmith.framework */; };
0EC25C8D1BA38648004191AF /* LocksmithTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C491BA38539004191AF /* LocksmithTests.swift */; };
@@ -32,10 +32,17 @@
0EC25C9A1BA38660004191AF /* LocksmithInternetProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C461BA38539004191AF /* LocksmithInternetProtocol.swift */; };
0EC25C9B1BA38662004191AF /* LocksmithSecurityClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C471BA38539004191AF /* LocksmithSecurityClass.swift */; };
0EC25C9C1BA38663004191AF /* LocksmithSecurityClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C471BA38539004191AF /* LocksmithSecurityClass.swift */; };
0EC25C9F1BA389CB004191AF /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0EC25C9E1BA389CB004191AF /* Info.plist */; };
DF6BD4B91BB0524500A3EB64 /* Locksmith.h in Headers */ = {isa = PBXBuildFile; fileRef = DF6BD4B61BB051ED00A3EB64 /* Locksmith.h */; settings = {ATTRIBUTES = (Public, ); }; };
DF6BD4BC1BB054CB00A3EB64 /* Locksmith.h in Headers */ = {isa = PBXBuildFile; fileRef = DF6BD4B61BB051ED00A3EB64 /* Locksmith.h */; settings = {ATTRIBUTES = (Public, ); }; };
DF6BD4BD1BB054D400A3EB64 /* Locksmith.h in Headers */ = {isa = PBXBuildFile; fileRef = DF6BD4B61BB051ED00A3EB64 /* Locksmith.h */; settings = {ATTRIBUTES = (Public, ); }; };
FBD0C9511C18693200291F2A /* Dictionary_Initializers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C401BA38539004191AF /* Dictionary_Initializers.swift */; };
FBD0C9521C18693900291F2A /* Locksmith.h in Headers */ = {isa = PBXBuildFile; fileRef = DF6BD4B61BB051ED00A3EB64 /* Locksmith.h */; settings = {ATTRIBUTES = (Public, ); }; };
FBD0C9531C18694100291F2A /* Locksmith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C421BA38539004191AF /* Locksmith.swift */; };
FBD0C9541C18694600291F2A /* LocksmithAccessibleOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C431BA38539004191AF /* LocksmithAccessibleOption.swift */; };
FBD0C9551C18694C00291F2A /* LocksmithError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C441BA38539004191AF /* LocksmithError.swift */; };
FBD0C9561C18695000291F2A /* LocksmithInternetAuthenticationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C451BA38539004191AF /* LocksmithInternetAuthenticationType.swift */; };
FBD0C9571C18695600291F2A /* LocksmithInternetProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C461BA38539004191AF /* LocksmithInternetProtocol.swift */; };
FBD0C9581C18695A00291F2A /* LocksmithSecurityClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC25C471BA38539004191AF /* LocksmithSecurityClass.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -72,6 +79,7 @@
0EC25C9E1BA389CB004191AF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0EC25CA71BA39C9F004191AF /* Locksmith.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Locksmith.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DF6BD4B61BB051ED00A3EB64 /* Locksmith.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Locksmith.h; sourceTree = "<group>"; };
FBD0C9491C1866BE00291F2A /* Locksmith.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Locksmith.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -112,6 +120,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FBD0C9451C1866BE00291F2A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -173,6 +188,7 @@
0EC25C751BA385F6004191AF /* Locksmith.framework */,
0EC25C7E1BA385F6004191AF /* Locksmith OS X Tests.xctest */,
0EC25CA71BA39C9F004191AF /* Locksmith.framework */,
FBD0C9491C1866BE00291F2A /* Locksmith.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -204,6 +220,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FBD0C9461C1866BE00291F2A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
FBD0C9521C18693900291F2A /* Locksmith.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
@@ -297,6 +321,24 @@
productReference = 0EC25CA71BA39C9F004191AF /* Locksmith.framework */;
productType = "com.apple.product-type.framework";
};
FBD0C9481C1866BE00291F2A /* Locksmith tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = FBD0C9501C1866BE00291F2A /* Build configuration list for PBXNativeTarget "Locksmith tvOS" */;
buildPhases = (
FBD0C9441C1866BE00291F2A /* Sources */,
FBD0C9451C1866BE00291F2A /* Frameworks */,
FBD0C9461C1866BE00291F2A /* Headers */,
FBD0C9471C1866BE00291F2A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Locksmith tvOS";
productName = "Locksmith tvOS";
productReference = FBD0C9491C1866BE00291F2A /* Locksmith.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -304,7 +346,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Mathew Palmer";
TargetAttributes = {
0EC25C581BA385AA004191AF = {
@@ -322,6 +364,9 @@
0EC25CA61BA39C9F004191AF = {
CreatedOnToolsVersion = 7.0;
};
FBD0C9481C1866BE00291F2A = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = BFFB19CA1A4870A300CCFFC3 /* Build configuration list for PBXProject "Locksmith" */;
@@ -341,6 +386,7 @@
0EC25C741BA385F6004191AF /* Locksmith OS X */,
0EC25C7D1BA385F6004191AF /* Locksmith OS X Tests */,
0EC25CA61BA39C9F004191AF /* Locksmith watchOS */,
FBD0C9481C1866BE00291F2A /* Locksmith tvOS */,
);
};
/* End PBXProject section */
@@ -350,7 +396,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EC25C9F1BA389CB004191AF /* Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -382,6 +427,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FBD0C9471C1866BE00291F2A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -443,6 +495,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FBD0C9441C1866BE00291F2A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FBD0C9541C18694600291F2A /* LocksmithAccessibleOption.swift in Sources */,
FBD0C9581C18695A00291F2A /* LocksmithSecurityClass.swift in Sources */,
FBD0C9531C18694100291F2A /* Locksmith.swift in Sources */,
FBD0C9511C18693200291F2A /* Dictionary_Initializers.swift in Sources */,
FBD0C9551C18694C00291F2A /* LocksmithError.swift in Sources */,
FBD0C9561C18695000291F2A /* LocksmithInternetAuthenticationType.swift in Sources */,
FBD0C9571C18695600291F2A /* LocksmithInternetProtocol.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -687,7 +753,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -738,6 +803,53 @@
};
name = Release;
};
FBD0C94E1C1866BE00291F2A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Source/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.matthewpalmer.Locksmith-tvOS";
PRODUCT_NAME = Locksmith;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
};
FBD0C94F1C1866BE00291F2A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Source/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.matthewpalmer.Locksmith-tvOS";
PRODUCT_NAME = Locksmith;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -795,6 +907,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FBD0C9501C1866BE00291F2A /* Build configuration list for PBXNativeTarget "Locksmith tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FBD0C94E1C1866BE00291F2A /* Debug */,
FBD0C94F1C1866BE00291F2A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = BFFB19C71A4870A300CCFFC3 /* Project object */;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD0C9481C1866BE00291F2A"
BuildableName = "Locksmith.framework"
BlueprintName = "Locksmith tvOS"
ReferencedContainer = "container:Locksmith.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD0C9481C1866BE00291F2A"
BuildableName = "Locksmith.framework"
BlueprintName = "Locksmith tvOS"
ReferencedContainer = "container:Locksmith.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD0C9481C1866BE00291F2A"
BuildableName = "Locksmith.framework"
BlueprintName = "Locksmith tvOS"
ReferencedContainer = "container:Locksmith.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+6
View File
@@ -28,6 +28,12 @@ Locksmith is available through [CocoaPods](http://cocoapods.org).
pod 'Locksmith'
### Carthage
Locksmith is available through [Carthage](https://github.com/Carthage/Carthage).
github 'matthewpalmer/Locksmith'
## Quick start
**Save data**
+35 -10
View File
@@ -39,15 +39,14 @@ public struct Locksmith {
}
public static func updateData(data: [String: AnyObject], forUserAccount userAccount: String, inService service: String = LocksmithDefaultService) throws {
// Delete and then re-save
do {
try Locksmith.deleteDataForUserAccount(userAccount, inService: service)
} catch {
// Deletion is likely to fail if the piece of data doesn't exist yet.
// This doesn't matter--we only tell the user about errors on the save request.
struct UpdateRequest: GenericPasswordSecureStorable, CreateableSecureStorable {
let service: String
let account: String
let data: [String: AnyObject]
}
return try Locksmith.saveData(data, forUserAccount: userAccount, inService: service)
let request = UpdateRequest(service: service, account: userAccount, data: data)
try request.updateInSecureStore()
}
}
@@ -424,6 +423,7 @@ public protocol CreateableSecureStorable: SecureStorable {
var data: [String: AnyObject] { get }
var performCreateRequestClosure: PerformRequestClosureType { get }
func createInSecureStore() throws
func updateInSecureStore() throws
}
// MARK: - ReadableSecureStorable
@@ -480,7 +480,6 @@ public extension ReadableSecureStorable where Self : GenericPasswordSecureStorab
return nil
}
} catch {
print(error)
return nil
}
}
@@ -495,7 +494,6 @@ public extension ReadableSecureStorable where Self : InternetPasswordSecureStora
return nil
}
} catch {
print(error)
return nil
}
}
@@ -511,6 +509,27 @@ public protocol DeleteableSecureStorable: SecureStorable {
// MARK: - Default property dictionaries
extension CreateableSecureStorable {
func updateInSecureStore(query: [String: AnyObject]) throws {
var attributesToUpdate = query
attributesToUpdate[String(kSecClass)] = nil
let status = SecItemUpdate(query, attributesToUpdate)
if let error = LocksmithError(fromStatusCode: Int(status)) {
if error == .NotFound || error == .NotAvailable {
try self.createInSecureStore()
} else {
throw error
}
} else {
if status != errSecSuccess {
throw LocksmithError.Undefined
}
}
}
}
public extension CreateableSecureStorable where Self : GenericPasswordSecureStorable {
var asCreateableSecureStoragePropertyDictionary: [String: AnyObject] {
var old = genericPasswordBaseStoragePropertyDictionary
@@ -523,6 +542,9 @@ public extension CreateableSecureStorable where Self : GenericPasswordSecureStor
func createInSecureStore() throws {
try performSecureStorageAction(performCreateRequestClosure, secureStoragePropertyDictionary: asCreateableSecureStoragePropertyDictionary)
}
func updateInSecureStore() throws {
try self.updateInSecureStore(self.asCreateableSecureStoragePropertyDictionary)
}
}
public extension CreateableSecureStorable where Self : InternetPasswordSecureStorable {
@@ -545,6 +567,9 @@ public extension CreateableSecureStorable where Self : InternetPasswordSecureSto
func createInSecureStore() throws {
try performSecureStorageAction(performCreateRequestClosure, secureStoragePropertyDictionary: asCreateableSecureStoragePropertyDictionary)
}
func updateInSecureStore() throws {
try self.updateInSecureStore(self.asCreateableSecureStoragePropertyDictionary)
}
}
public extension DeleteableSecureStorable {
-1
View File
@@ -18,7 +18,6 @@ public enum LocksmithSecurityClass: RawRepresentable {
case String(kSecClassIdentity):
self = Identity
default:
print("SecurityClass: Invalid raw value provided. Defaulting to .GenericPassword")
self = GenericPassword
}
}
+61 -10
View File
@@ -53,6 +53,12 @@ class LocksmithTests: XCTestCase {
let loaded3 = Locksmith.loadDataForUserAccount(userAccount, inService: service)! as! TestingDictionaryType
XCTAssertEqual(loaded3, updatedData)
try! Locksmith.deleteDataForUserAccount(userAccount, inService: service)
try! Locksmith.updateData(["some update": "data"], forUserAccount: userAccount, inService: service)
let updateResult = Locksmith.loadDataForUserAccount(userAccount, inService: service)! as! [String: String]
XCTAssertEqual(updateResult, ["some update": "data"])
}
func testStaticMethodsForDefaultService() {
@@ -94,6 +100,40 @@ class LocksmithTests: XCTestCase {
createGenericPasswordWithData(data)
}
func testUpdateCreatesIfNotExists() {
let data = ["some": "data"]
struct CreateGenericPassword: CreateableSecureStorable, GenericPasswordSecureStorable, ReadableSecureStorable {
var data: [String: AnyObject]
let account: String
let service: String
}
let update = CreateGenericPassword(data: data, account: userAccount, service: service)
try! update.updateInSecureStore()
let read = update.readFromSecureStore()!.data as! [String: String]
XCTAssertEqual(read, ["some": "data"])
}
func testUpdateForGenericPassword() {
let data = ["some": "data"]
struct CreateGenericPassword: CreateableSecureStorable, GenericPasswordSecureStorable, ReadableSecureStorable {
var data: [String: AnyObject]
let account: String
let service: String
}
var create = CreateGenericPassword(data: data, account: userAccount, service: service)
try! create.createInSecureStore() // make sure it doesn't throw
create.data = ["other": "data"]
try! create.updateInSecureStore()
let read = create.readFromSecureStore()!.data as! [String: String]
XCTAssertEqual(read, ["other": "data"])
}
func testLoadForGenericPassword() {
let data = ["one": "two"]
createGenericPasswordWithData(data)
@@ -239,7 +279,7 @@ class LocksmithTests: XCTestCase {
func testInternetPasswordMetaAttributesAreCreatedAndReturned() {
struct CreateInternetPassword: CreateableSecureStorable, InternetPasswordSecureStorable {
let account: String
let data: [String: AnyObject]
var data: [String: AnyObject]
let server: String
let port: Int
let internetProtocol: LocksmithInternetProtocol
@@ -265,20 +305,31 @@ class LocksmithTests: XCTestCase {
let authenticationType: LocksmithInternetAuthenticationType
}
let c = CreateInternetPassword(account: userAccount, data: initialData, server: server, port: port, internetProtocol: internetProtocol, authenticationType: authenticationType, path: path, securityDomain: securityDomain)
var c = CreateInternetPassword(account: userAccount, data: initialData, server: server, port: port, internetProtocol: internetProtocol, authenticationType: authenticationType, path: path, securityDomain: securityDomain)
try! c.createInSecureStore()
func assertResultMetadataIsOk(result: InternetPasswordSecureStorableResultType?) {
XCTAssertEqual(result?.account, userAccount)
XCTAssertEqual(result?.server, server)
XCTAssertEqual(result?.port, port)
XCTAssertEqual(result?.internetProtocol, internetProtocol)
XCTAssertEqual(result?.authenticationType, authenticationType)
XCTAssertEqual(result?.securityDomain, securityDomain)
XCTAssertEqual(result?.path, path)
}
let r = ReadInternetPassword(account: userAccount, server: server, port: port, internetProtocol: internetProtocol, authenticationType: authenticationType)
let result = r.readFromSecureStore()
XCTAssertEqual(result?.account, userAccount)
XCTAssertEqual(result!.data as! [String: String], initialData)
XCTAssertEqual(result?.server, server)
XCTAssertEqual(result?.port, port)
XCTAssertEqual(result?.internetProtocol, internetProtocol)
XCTAssertEqual(result?.authenticationType, authenticationType)
XCTAssertEqual(result?.securityDomain, securityDomain)
XCTAssertEqual(result?.path, path)
assertResultMetadataIsOk(result)
// Assert that metadata is maintained after an update
c.data = ["other internet": "junk"]
try! c.updateInSecureStore()
let result2 = r.readFromSecureStore()
XCTAssertEqual(result2!.data as! [String: String], ["other internet": "junk"])
assertResultMetadataIsOk(result2)
}
func assertStringPairsMatchInDictionary(dictionary: NSDictionary, pairs: [(key: CFString, expectedOutput: String)]) {