Protect the store file with iOS security features.
This commit is contained in:
		@@ -238,9 +238,9 @@
 | 
				
			|||||||
                     
 | 
					                     
 | 
				
			||||||
                     [AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError
 | 
					                     [AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError
 | 
				
			||||||
                                                     message:
 | 
					                                                     message:
 | 
				
			||||||
                                                             @"Incorrect master password.\n\n"
 | 
					                      @"Incorrect master password.\n\n"
 | 
				
			||||||
                             @"If you are trying to use the app with a different master password, "
 | 
					                      @"If you are trying to use the app with a different master password, "
 | 
				
			||||||
                                                                     @"flip the 'Change my password' option in Settings."
 | 
					                      @"flip the 'Change my password' option in Settings."
 | 
				
			||||||
                                                   viewStyle:UIAlertViewStyleDefault
 | 
					                                                   viewStyle:UIAlertViewStyleDefault
 | 
				
			||||||
                                           tappedButtonBlock:
 | 
					                                           tappedButtonBlock:
 | 
				
			||||||
                      ^(UIAlertView *alert, NSInteger buttonIndex) {
 | 
					                      ^(UIAlertView *alert, NSInteger buttonIndex) {
 | 
				
			||||||
@@ -341,14 +341,14 @@
 | 
				
			|||||||
                                                          
 | 
					                                                          
 | 
				
			||||||
                                                          [__managedObjectContext performBlock:^{
 | 
					                                                          [__managedObjectContext performBlock:^{
 | 
				
			||||||
                                                              [__managedObjectContext mergeChangesFromContextDidSaveNotification:note];
 | 
					                                                              [__managedObjectContext mergeChangesFromContextDidSaveNotification:note];
 | 
				
			||||||
 | 
					                                                              
 | 
				
			||||||
                                                              [[NSNotificationCenter defaultCenter] postNotification:
 | 
					                                                              [[NSNotificationCenter defaultCenter] postNotification:
 | 
				
			||||||
                                                               [NSNotification notificationWithName:UIScreenModeDidChangeNotification
 | 
					                                                               [NSNotification notificationWithName:UIScreenModeDidChangeNotification
 | 
				
			||||||
                                                                                             object:self userInfo:[note userInfo]]];
 | 
					                                                                                             object:self userInfo:[note userInfo]]];
 | 
				
			||||||
                                                          }];
 | 
					                                                          }];
 | 
				
			||||||
                                                      }];
 | 
					                                                      }];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    return __managedObjectContext;
 | 
					    return __managedObjectContext;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -360,7 +360,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (__managedObjectModel)
 | 
					    if (__managedObjectModel)
 | 
				
			||||||
        return __managedObjectModel;
 | 
					        return __managedObjectModel;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MasterPassword" withExtension:@"momd"];
 | 
					    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MasterPassword" withExtension:@"momd"];
 | 
				
			||||||
    return __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
 | 
					    return __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -422,8 +422,13 @@
 | 
				
			|||||||
        @throw [NSException exceptionWithName:error.domain reason:error.localizedDescription
 | 
					        @throw [NSException exceptionWithName:error.domain reason:error.localizedDescription
 | 
				
			||||||
                                     userInfo:[NSDictionary dictionaryWithObject:error forKey:@"cause"]];
 | 
					                                     userInfo:[NSDictionary dictionaryWithObject:error forKey:@"cause"]];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    if (![[NSFileManager defaultManager] setAttributes:[NSDictionary dictionaryWithObject:NSFileProtectionComplete
 | 
				
			||||||
 | 
					                                                                                   forKey:NSFileProtectionKey]
 | 
				
			||||||
 | 
					                                          ofItemAtPath:storeURL.path error:&error])
 | 
				
			||||||
 | 
					        err(@"Unresolved error %@, %@", error, [error userInfo]);
 | 
				
			||||||
    [__persistentStoreCoordinator unlock];
 | 
					    [__persistentStoreCoordinator unlock];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    return __persistentStoreCoordinator;
 | 
					    return __persistentStoreCoordinator;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user