Access and save keychain data with always access

This helps if an app is running in the background and the device is still locked
This commit is contained in:
Andreas Linde
2015-03-26 18:08:55 +01:00
parent e74a495410
commit db62cc99e0
4 changed files with 4 additions and 4 deletions

View File

@@ -209,7 +209,7 @@ NSString *bit_appAnonID(void) {
andPassword:appAnonID
forServiceName:bit_keychainHockeySDKServiceName()
updateExisting:YES
accessibility:kSecAttrAccessibleWhenUnlockedThisDeviceOnly
accessibility:kSecAttrAccessibleAlwaysThisDeviceOnly
error:&error];
});
}

View File

@@ -391,7 +391,7 @@ bitstadium_info_t bitstadium_library_info __attribute__((section("__TEXT,__bit_h
andPassword:value
forServiceName:bit_keychainHockeySDKServiceName()
updateExisting:YES
accessibility:kSecAttrAccessibleWhenUnlockedThisDeviceOnly
accessibility:kSecAttrAccessibleAlwaysThisDeviceOnly
error:&error];
} else {
updateType = @"delete";

View File

@@ -123,7 +123,7 @@ static NSString *BITKeychainUtilsErrorDomain = @"BITKeychainUtilsErrorDomain";
}
+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error {
return [self storeUsername:username andPassword:password forServiceName:serviceName updateExisting:updateExisting accessibility:kSecAttrAccessibleWhenUnlocked error:error];
return [self storeUsername:username andPassword:password forServiceName:serviceName updateExisting:updateExisting accessibility:kSecAttrAccessibleAlways error:error];
}
+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting accessibility:(CFTypeRef) accessibility error: (NSError **) error

View File

@@ -60,7 +60,7 @@
andPassword:@"PanThisDeviceOnly"
forServiceName:@"Test"
updateExisting:YES
accessibility:kSecAttrAccessibleWhenUnlockedThisDeviceOnly
accessibility:kSecAttrAccessibleAlwaysThisDeviceOnly
error:nil];
assertThatBool(success, equalToBool(YES));
NSString *pass = [BITKeychainUtils getPasswordForUsername:@"Peter"