From e78c6a6b2aab1f24c56e192b2530a245f5d41e29 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Fri, 5 Jun 2015 15:03:39 -0700 Subject: [PATCH 1/3] Share schemes --- .../xcshareddata/xcschemes/Valet Mac.xcscheme | 110 ++++++++++++++++++ .../xcshareddata/xcschemes/Valet iOS.xcscheme | 110 ++++++++++++++++++ .../xcschemes/ValetTouchIDTest.xcscheme | 88 ++++++++++++++ 3 files changed, 308 insertions(+) create mode 100644 Valet.xcodeproj/xcshareddata/xcschemes/Valet Mac.xcscheme create mode 100644 Valet.xcodeproj/xcshareddata/xcschemes/Valet iOS.xcscheme create mode 100644 Valet.xcodeproj/xcshareddata/xcschemes/ValetTouchIDTest.xcscheme diff --git a/Valet.xcodeproj/xcshareddata/xcschemes/Valet Mac.xcscheme b/Valet.xcodeproj/xcshareddata/xcschemes/Valet Mac.xcscheme new file mode 100644 index 00000000..5b1b3b83 --- /dev/null +++ b/Valet.xcodeproj/xcshareddata/xcschemes/Valet Mac.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Valet.xcodeproj/xcshareddata/xcschemes/Valet iOS.xcscheme b/Valet.xcodeproj/xcshareddata/xcschemes/Valet iOS.xcscheme new file mode 100644 index 00000000..3ab54cd3 --- /dev/null +++ b/Valet.xcodeproj/xcshareddata/xcschemes/Valet iOS.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Valet.xcodeproj/xcshareddata/xcschemes/ValetTouchIDTest.xcscheme b/Valet.xcodeproj/xcshareddata/xcschemes/ValetTouchIDTest.xcscheme new file mode 100644 index 00000000..77e20fed --- /dev/null +++ b/Valet.xcodeproj/xcshareddata/xcschemes/ValetTouchIDTest.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 01fe25c2f7ab3e20987515a897a57aa69297edfd Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Fri, 5 Jun 2015 15:03:51 -0700 Subject: [PATCH 2/3] Add Travis CI YAML file --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..dd489340 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: objective-c +script: + - xcodebuild -project Valet.xcodeproj -scheme "Valet iOS" -sdk iphonesimulator -configuration Debug -PBXBuildsContinueAfterErrors=0 build test + - xcodebuild -project Valet.xcodeproj -scheme "Valet Mac" -sdk macosx -configuration Debug -destination "platform=OS X" -PBXBuildsContinueAfterErrors=0 build test \ No newline at end of file From 46f4431c79b97e74aae324767e26478e7e9773e2 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Fri, 5 Jun 2015 16:36:16 -0700 Subject: [PATCH 3/3] Ensure builds work on 10.9 --- Valet.podspec | 2 +- Valet.xcodeproj/project.pbxproj | 8 ++------ Valet/VALSecureEnclaveValet.h | 1 + Valet/VALValet.h | 4 ++-- Valet/VALValet.m | 4 ++++ ValetTests/ValetTests.m | 5 ++++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Valet.podspec b/Valet.podspec index e9a51c1c..6e1e924f 100644 --- a/Valet.podspec +++ b/Valet.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Valet' - s.version = '1.1.1' + s.version = '1.1.2' s.license = 'Apache' s.summary = 'Valet lets you securely store data in the iOS or OS X Keychain without knowing a thing about how the Keychain works. It\'s easy. We promise.' s.homepage = 'https://github.com/square/Valet' diff --git a/Valet.xcodeproj/project.pbxproj b/Valet.xcodeproj/project.pbxproj index ffec4dee..55d5aa03 100644 --- a/Valet.xcodeproj/project.pbxproj +++ b/Valet.xcodeproj/project.pbxproj @@ -13,14 +13,12 @@ EAEAA8991B16813100F7AA98 /* ValetTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E1F9F1A8C48560067C991 /* ValetTests.m */; }; EAEAA89E1B16818400F7AA98 /* Valet.h in Headers */ = {isa = PBXBuildFile; fileRef = EA1E1F861A8C46080067C991 /* Valet.h */; settings = {ATTRIBUTES = (Public, ); }; }; EAEAA89F1B16818400F7AA98 /* VALValet.h in Headers */ = {isa = PBXBuildFile; fileRef = EAEEAC181AB7B83300EDB6E3 /* VALValet.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EAEAA8A01B16818400F7AA98 /* VALSecureEnclaveValet.h in Headers */ = {isa = PBXBuildFile; fileRef = EAEEAC1E1AB7B84E00EDB6E3 /* VALSecureEnclaveValet.h */; settings = {ATTRIBUTES = (Public, ); }; }; EAEAA8A11B16818400F7AA98 /* VALSynchronizableValet.h in Headers */ = {isa = PBXBuildFile; fileRef = EAEEAC1B1AB7B84000EDB6E3 /* VALSynchronizableValet.h */; settings = {ATTRIBUTES = (Public, ); }; }; EAEAA8A21B16818E00F7AA98 /* VALValet_Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = EAEEAC231AB7BA0C00EDB6E3 /* VALValet_Protected.h */; }; EAEAA8A31B1681F400F7AA98 /* ValetDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = EAEEAC251AB7BA9800EDB6E3 /* ValetDefines.h */; }; EAEAA8A41B16821D00F7AA98 /* VALValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC191AB7B83300EDB6E3 /* VALValet.m */; }; EAEAA8A61B16821D00F7AA98 /* VALSynchronizableValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC1C1AB7B84000EDB6E3 /* VALSynchronizableValet.m */; }; EAEAA8AC1B16864D00F7AA98 /* Valet.h in Headers */ = {isa = PBXBuildFile; fileRef = EA1E1F861A8C46080067C991 /* Valet.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EAEAA8AD1B1690E400F7AA98 /* VALSecureEnclaveValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC1F1AB7B84E00EDB6E3 /* VALSecureEnclaveValet.m */; }; EAEEAC1A1AB7B83300EDB6E3 /* VALValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC191AB7B83300EDB6E3 /* VALValet.m */; }; EAEEAC1D1AB7B84000EDB6E3 /* VALSynchronizableValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC1C1AB7B84000EDB6E3 /* VALSynchronizableValet.m */; }; EAEEAC201AB7B84E00EDB6E3 /* VALSecureEnclaveValet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEEAC1F1AB7B84E00EDB6E3 /* VALSecureEnclaveValet.m */; }; @@ -230,7 +228,6 @@ EAEAA8A21B16818E00F7AA98 /* VALValet_Protected.h in Headers */, EAEAA8A11B16818400F7AA98 /* VALSynchronizableValet.h in Headers */, EAEAA8A31B1681F400F7AA98 /* ValetDefines.h in Headers */, - EAEAA8A01B16818400F7AA98 /* VALSecureEnclaveValet.h in Headers */, EAEAA89F1B16818400F7AA98 /* VALValet.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -437,7 +434,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - EAEAA8AD1B1690E400F7AA98 /* VALSecureEnclaveValet.m in Sources */, EAEAA8A61B16821D00F7AA98 /* VALSynchronizableValet.m in Sources */, EAEAA8A41B16821D00F7AA98 /* VALValet.m in Sources */, ); @@ -642,7 +638,7 @@ "DEBUG=1", "$(inherited)", ); - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_NAME = Valet; SDKROOT = macosx; }; @@ -658,7 +654,7 @@ DYLIB_CURRENT_VERSION = 1; EXECUTABLE_PREFIX = lib; GCC_NO_COMMON_BLOCKS = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_NAME = Valet; SDKROOT = macosx; }; diff --git a/Valet/VALSecureEnclaveValet.h b/Valet/VALSecureEnclaveValet.h index 86bca075..5854900c 100644 --- a/Valet/VALSecureEnclaveValet.h +++ b/Valet/VALSecureEnclaveValet.h @@ -22,6 +22,7 @@ /// Reads and writes keychain elements that are stored on the Secure Enclave (supported on iOS 8.0 or later) using accessibility attribute VALAccessibilityWhenPasscodeSetThisDeviceOnly. Accessing or modifying these items will require the user to confirm their presence via Touch ID or passcode entry. If no passcode is set on the device, the below methods will fail. Data is removed from the Secure Enclave when the user removes a passcode from the device. Use the userPrompt methods to display custom text to the user in Apple's Touch ID and passcode entry UI. +NS_CLASS_AVAILABLE_IOS(8_0) @interface VALSecureEnclaveValet : VALValet /// Retuns YES if Secure Enclave storage is supported on the current iOS version (8.0 and later). diff --git a/Valet/VALValet.h b/Valet/VALValet.h index 3dccc96d..8bb327b3 100644 --- a/Valet/VALValet.h +++ b/Valet/VALValet.h @@ -67,10 +67,10 @@ typedef NS_ENUM(NSUInteger, VALMigrationError) { @interface VALValet : NSObject /// Creates a Valet that reads/writes keychain elements with the desired accessibility. -- (instancetype)initWithIdentifier:(NSString *)identifier accessibility:(VALAccessibility)accessibility __attribute__((nonnull(1))) NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier accessibility:(VALAccessibility)accessibility __attribute__((nonnull(1))) __attribute((objc_designated_initializer)); /// Creates a Valet that reads/writes keychain elements that can be shared across applications written by the same development team. The sharedAccessGroupIdentifier must correspond with the value for keychain-access-groups in your Entitlements file. -- (instancetype)initWithSharedAccessGroupIdentifier:(NSString *)sharedAccessGroupIdentifier accessibility:(VALAccessibility)accessibility __attribute__((nonnull(1))) NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithSharedAccessGroupIdentifier:(NSString *)sharedAccessGroupIdentifier accessibility:(VALAccessibility)accessibility __attribute__((nonnull(1))) __attribute((objc_designated_initializer)); @property (copy, readonly) NSString *identifier; @property (readonly, getter=isSharedAcrossApplications) BOOL sharedAcrossApplications; diff --git a/Valet/VALValet.m b/Valet/VALValet.m index 1f227c4d..c2ab0234 100644 --- a/Valet/VALValet.m +++ b/Valet/VALValet.m @@ -36,8 +36,10 @@ return @"AccessibleAfterFirstUnlock"; case VALAccessibilityAlways: return @"AccessibleAlways"; +#if __IPHONE_8_0 || __MAC_10_10 case VALAccessibilityWhenPasscodeSetThisDeviceOnly: return @"AccessibleWhenPasscodeSetThisDeviceOnly"; +#endif case VALAccessibilityWhenUnlockedThisDeviceOnly: return @"AccessibleWhenUnlockedThisDeviceOnly"; case VALAccessibilityAfterFirstUnlockThisDeviceOnly: @@ -590,8 +592,10 @@ - (id)_secAccessibilityAttributeForAccessibility:(VALAccessibility)accessibility return (__bridge id)kSecAttrAccessibleAfterFirstUnlock; case VALAccessibilityAlways: return (__bridge id)kSecAttrAccessibleAlways; +#if __IPHONE_8_0 || __MAC_10_10 case VALAccessibilityWhenPasscodeSetThisDeviceOnly: return (__bridge id)kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly; +#endif case VALAccessibilityWhenUnlockedThisDeviceOnly: return (__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly; case VALAccessibilityAfterFirstUnlockThisDeviceOnly: diff --git a/ValetTests/ValetTests.m b/ValetTests/ValetTests.m index 545300b0..47a0ab82 100644 --- a/ValetTests/ValetTests.m +++ b/ValetTests/ValetTests.m @@ -110,8 +110,11 @@ - (void)test_initialization_invalidArgumentsCauseFailure; { XCTAssertNil([[VALValet alloc] initWithIdentifier:@"" accessibility:VALAccessibilityAlways]); XCTAssertNil([[VALValet alloc] initWithIdentifier:@"test" accessibility:0]); - XCTAssertNil([[VALSynchronizableValet alloc] initWithIdentifier:@"test" accessibility:VALAccessibilityWhenPasscodeSetThisDeviceOnly]); + XCTAssertNil([[VALSynchronizableValet alloc] initWithIdentifier:@"test" accessibility:VALAccessibilityWhenUnlockedThisDeviceOnly]); + +#if TARGET_OS_IPHONE && __IPHONE_8_0 XCTAssertNil([[VALSecureEnclaveValet alloc] initWithIdentifier:@"test" accessibility:VALAccessibilityWhenUnlockedThisDeviceOnly]); +#endif } - (void)test_canAccessKeychain;