Prefix change: OP -> MP
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPAppDelegate.h
|
||||
// MPAppDelegate.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface OPAppDelegate : AbstractAppDelegate
|
||||
@interface MPAppDelegate : AbstractAppDelegate
|
||||
|
||||
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
||||
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
||||
@@ -17,7 +17,7 @@
|
||||
@property (strong, nonatomic) NSData *keyPhraseHash;
|
||||
@property (strong, nonatomic) NSString *keyPhraseHashHex;
|
||||
|
||||
+ (OPAppDelegate *)get;
|
||||
+ (MPAppDelegate *)get;
|
||||
+ (NSManagedObjectModel *)managedObjectModel;
|
||||
+ (NSManagedObjectContext *)managedObjectContext;
|
||||
|
@@ -1,17 +1,17 @@
|
||||
//
|
||||
// OPAppDelegate.m
|
||||
// MPAppDelegate.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPAppDelegate.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
#import "OPMainViewController.h"
|
||||
#import "MPMainViewController.h"
|
||||
#import "IASKSettingsReader.h"
|
||||
|
||||
@interface OPAppDelegate ()
|
||||
@interface MPAppDelegate ()
|
||||
|
||||
+ (NSDictionary *)keyPhraseQuery;
|
||||
+ (NSDictionary *)keyPhraseHashQuery;
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation OPAppDelegate
|
||||
@implementation MPAppDelegate
|
||||
|
||||
@synthesize managedObjectModel = __managedObjectModel;
|
||||
@synthesize managedObjectContext = __managedObjectContext;
|
||||
@@ -42,26 +42,26 @@
|
||||
|
||||
+ (NSDictionary *)keyPhraseQuery {
|
||||
|
||||
static NSDictionary *OPKeyPhraseQuery = nil;
|
||||
if (!OPKeyPhraseQuery)
|
||||
OPKeyPhraseQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
||||
static NSDictionary *MPKeyPhraseQuery = nil;
|
||||
if (!MPKeyPhraseQuery)
|
||||
MPKeyPhraseQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
||||
attributes:[NSDictionary dictionaryWithObject:@"MasterPassword"
|
||||
forKey:(__bridge id)kSecAttrService]
|
||||
matches:nil];
|
||||
|
||||
return OPKeyPhraseQuery;
|
||||
return MPKeyPhraseQuery;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)keyPhraseHashQuery {
|
||||
|
||||
static NSDictionary *OPKeyPhraseHashQuery = nil;
|
||||
if (!OPKeyPhraseHashQuery)
|
||||
OPKeyPhraseHashQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
||||
static NSDictionary *MPKeyPhraseHashQuery = nil;
|
||||
if (!MPKeyPhraseHashQuery)
|
||||
MPKeyPhraseHashQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
||||
attributes:[NSDictionary dictionaryWithObject:@"MasterPasswordHash"
|
||||
forKey:(__bridge id)kSecAttrService]
|
||||
matches:nil];
|
||||
|
||||
return OPKeyPhraseHashQuery;
|
||||
return MPKeyPhraseHashQuery;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
@@ -134,7 +134,7 @@
|
||||
}
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
|
||||
if ([[OPConfig get].showQuickStart boolValue])
|
||||
if ([[MPConfig get].showQuickStart boolValue])
|
||||
[self showGuide];
|
||||
else
|
||||
[self loadKeyPhrase];
|
||||
@@ -142,12 +142,12 @@
|
||||
|
||||
- (void)showGuide {
|
||||
|
||||
[self.navigationController performSegueWithIdentifier:@"OP_Guide" sender:self];
|
||||
[self.navigationController performSegueWithIdentifier:@"MP_Guide" sender:self];
|
||||
}
|
||||
|
||||
- (void)loadKeyPhrase {
|
||||
|
||||
if ([[OPConfig get].forgetKeyPhrase boolValue]) {
|
||||
if ([[MPConfig get].forgetKeyPhrase boolValue]) {
|
||||
[self forgetKeyPhrase];
|
||||
return;
|
||||
}
|
||||
@@ -175,23 +175,23 @@
|
||||
if (buttonIndex == [alert firstOtherButtonIndex]) {
|
||||
// Key phrase reset. Delete it.
|
||||
dbg(@"Deleting master key phrase and hash from key chain.");
|
||||
[KeyChain deleteItemForQuery:[OPAppDelegate keyPhraseQuery]];
|
||||
[KeyChain deleteItemForQuery:[OPAppDelegate keyPhraseHashQuery]];
|
||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
||||
}
|
||||
|
||||
[self loadKeyPhrase];
|
||||
}
|
||||
cancelTitle:[PearlStrings get].commonButtonAbort
|
||||
otherTitles:[PearlStrings get].commonButtonContinue, nil];
|
||||
[OPConfig get].forgetKeyPhrase = [NSNumber numberWithBool:NO];
|
||||
[MPConfig get].forgetKeyPhrase = [NSNumber numberWithBool:NO];
|
||||
}
|
||||
|
||||
- (void)loadStoredKeyPhrase {
|
||||
|
||||
if ([[OPConfig get].storeKeyPhrase boolValue]) {
|
||||
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
||||
// Key phrase is stored in keychain. Load it.
|
||||
dbg(@"Loading master key phrase from key chain.");
|
||||
NSData *keyPhraseData = [KeyChain dataOfItemForQuery:[OPAppDelegate keyPhraseQuery]];
|
||||
NSData *keyPhraseData = [KeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||
dbg(@" -> Master key phrase %@.", keyPhraseData? @"found": @"NOT found");
|
||||
|
||||
self.keyPhrase = keyPhraseData? [[NSString alloc] initWithBytes:keyPhraseData.bytes length:keyPhraseData.length
|
||||
@@ -199,14 +199,14 @@
|
||||
} else {
|
||||
// Key phrase should not be stored in keychain. Delete it.
|
||||
dbg(@"Deleting master key phrase from key chain.");
|
||||
[KeyChain deleteItemForQuery:[OPAppDelegate keyPhraseQuery]];
|
||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)askKeyPhrase {
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSData *keyPhraseHash = [KeyChain dataOfItemForQuery:[OPAppDelegate keyPhraseHashQuery]];
|
||||
NSData *keyPhraseHash = [KeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
||||
dbg(@"Key phrase hash %@.", keyPhraseHash? @"known": @"NOT known");
|
||||
|
||||
[AlertViewController showAlertWithTitle:@"Master Password"
|
||||
@@ -259,7 +259,7 @@
|
||||
|
||||
[self saveContext];
|
||||
|
||||
if (![[OPConfig get].rememberKeyPhrase boolValue])
|
||||
if (![[MPConfig get].rememberKeyPhrase boolValue])
|
||||
self.keyPhrase = nil;
|
||||
}
|
||||
|
||||
@@ -268,19 +268,19 @@
|
||||
[self saveContext];
|
||||
}
|
||||
|
||||
+ (OPAppDelegate *)get {
|
||||
+ (MPAppDelegate *)get {
|
||||
|
||||
return (OPAppDelegate *)[super get];
|
||||
return (MPAppDelegate *)[super get];
|
||||
}
|
||||
|
||||
+ (NSManagedObjectContext *)managedObjectContext {
|
||||
|
||||
return [(OPAppDelegate *)[UIApplication sharedApplication].delegate managedObjectContext];
|
||||
return [(MPAppDelegate *)[UIApplication sharedApplication].delegate managedObjectContext];
|
||||
}
|
||||
|
||||
+ (NSManagedObjectModel *)managedObjectModel {
|
||||
|
||||
return [(OPAppDelegate *)[UIApplication sharedApplication].delegate managedObjectModel];
|
||||
return [(MPAppDelegate *)[UIApplication sharedApplication].delegate managedObjectModel];
|
||||
}
|
||||
|
||||
- (void)saveContext {
|
||||
@@ -301,14 +301,14 @@
|
||||
self.keyPhraseHashHex = [self.keyPhraseHash encodeHex];
|
||||
|
||||
dbg(@"Updating master key phrase hash to: %@.", self.keyPhraseHashHex);
|
||||
[KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseHashQuery]
|
||||
[KeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseHashQuery]
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
self.keyPhraseHash, (__bridge id)kSecValueData,
|
||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||
nil]];
|
||||
if ([[OPConfig get].storeKeyPhrase boolValue]) {
|
||||
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
||||
dbg(@"Storing master key phrase in key chain.");
|
||||
[KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseQuery]
|
||||
[KeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseQuery]
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[keyPhrase dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecValueData,
|
||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||
@@ -343,7 +343,7 @@
|
||||
[__managedObjectContext mergeChangesFromContextDidSaveNotification:note];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotification:
|
||||
[NSNotification notificationWithName:OPPersistentStoreDidChangeNotification
|
||||
[NSNotification notificationWithName:UIScreenModeDidChangeNotification
|
||||
object:self userInfo:[note userInfo]]];
|
||||
}];
|
||||
}];
|
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// OPConfig.h
|
||||
// MPConfig.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
@interface OPConfig : Config
|
||||
@interface MPConfig : Config
|
||||
|
||||
@property (nonatomic, retain) NSNumber *dataStoreError;
|
||||
@property (nonatomic, retain) NSNumber *storeKeyPhrase;
|
||||
@@ -15,6 +15,6 @@
|
||||
@property (nonatomic, retain) NSNumber *helpHidden;
|
||||
@property (nonatomic, retain) NSNumber *showQuickStart;
|
||||
|
||||
+ (OPConfig *)get;
|
||||
+ (MPConfig *)get;
|
||||
|
||||
@end
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// OPConfig.m
|
||||
// MPConfig.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPConfig.h"
|
||||
#import "MPConfig.h"
|
||||
|
||||
@implementation OPConfig
|
||||
@implementation MPConfig
|
||||
|
||||
@dynamic dataStoreError, storeKeyPhrase, rememberKeyPhrase, forgetKeyPhrase, helpHidden, showQuickStart;
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (OPConfig *)get {
|
||||
+ (MPConfig *)get {
|
||||
|
||||
return (OPConfig *)[super get];
|
||||
return (MPConfig *)[super get];
|
||||
}
|
||||
|
||||
@end
|
16
MasterPassword/MPContentViewController.h
Normal file
16
MasterPassword/MPContentViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MPContentViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 03/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
@interface MPContentViewController : UIViewController
|
||||
|
||||
@property (nonatomic, weak) MPElementEntity *activeElement;
|
||||
|
||||
@end
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// OPContentViewController.m
|
||||
// MPContentViewController.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 03/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPContentViewController.h"
|
||||
#import "MPContentViewController.h"
|
||||
|
||||
@implementation OPContentViewController
|
||||
@implementation MPContentViewController
|
||||
@synthesize activeElement = _activeElement;
|
||||
|
||||
#pragma mark - View lifecycle
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPElementEntity.h
|
||||
// MPElementEntity.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
@@ -10,7 +10,7 @@
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
|
||||
@interface OPElementEntity : NSManagedObject
|
||||
@interface MPElementEntity : NSManagedObject
|
||||
|
||||
@property (nonatomic, retain) NSString *name;
|
||||
@property (nonatomic, retain) NSString *mpHashHex;
|
@@ -1,15 +1,15 @@
|
||||
//
|
||||
// OPElementEntity.m
|
||||
// MPElementEntity.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPElementEntity.h"
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
|
||||
@implementation OPElementEntity
|
||||
@implementation MPElementEntity
|
||||
|
||||
@dynamic name;
|
||||
@dynamic mpHashHex;
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPElementGeneratedEntity.h
|
||||
// MPElementGeneratedEntity.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 16/01/12.
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
#import "OPElementEntity.h"
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
|
||||
@interface OPElementGeneratedEntity : OPElementEntity
|
||||
@interface MPElementGeneratedEntity : MPElementEntity
|
||||
|
||||
@property (nonatomic, assign) int16_t counter;
|
||||
|
@@ -1,28 +1,28 @@
|
||||
//
|
||||
// OPElementGeneratedEntity.m
|
||||
// MPElementGeneratedEntity.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 16/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPElementGeneratedEntity.h"
|
||||
#import "OPAppDelegate.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
|
||||
@implementation OPElementGeneratedEntity
|
||||
@implementation MPElementGeneratedEntity
|
||||
|
||||
@dynamic counter;
|
||||
|
||||
- (id)content {
|
||||
|
||||
assert(self.type & OPElementTypeClassCalculated);
|
||||
assert(self.type & MPElementTypeClassCalculated);
|
||||
|
||||
if (![self.name length])
|
||||
return nil;
|
||||
|
||||
if (self.type & OPElementTypeClassCalculated)
|
||||
return OPCalculateContent(self.type, self.name, [OPAppDelegate get].keyPhrase, self.counter);
|
||||
if (self.type & MPElementTypeClassCalculated)
|
||||
return MPCalculateContent(self.type, self.name, [MPAppDelegate get].keyPhrase, self.counter);
|
||||
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"Unsupported type: %d", self.type] userInfo:nil];
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPElementStoredEntity.h
|
||||
// MPElementStoredEntity.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
#import "OPElementEntity.h"
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
|
||||
@interface OPElementStoredEntity : OPElementEntity
|
||||
@interface MPElementStoredEntity : MPElementEntity
|
||||
|
||||
@property (nonatomic, retain, readwrite) id content;
|
||||
|
@@ -1,21 +1,21 @@
|
||||
//
|
||||
// OPElementStoredEntity.m
|
||||
// MPElementStoredEntity.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPElementStoredEntity.h"
|
||||
#import "OPAppDelegate.h"
|
||||
#import "MPElementStoredEntity.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
@interface OPElementStoredEntity ()
|
||||
@interface MPElementStoredEntity ()
|
||||
|
||||
@property (nonatomic, retain, readwrite) id contentObject;
|
||||
|
||||
@end
|
||||
|
||||
@implementation OPElementStoredEntity
|
||||
@implementation MPElementStoredEntity
|
||||
|
||||
@dynamic contentObject;
|
||||
|
||||
@@ -31,15 +31,15 @@
|
||||
|
||||
- (id)content {
|
||||
|
||||
assert(self.type & OPElementTypeClassStored);
|
||||
assert(self.type & MPElementTypeClassStored);
|
||||
|
||||
NSData *encryptedContent;
|
||||
if (self.type == OPElementTypeStoredDevicePrivate)
|
||||
encryptedContent = [KeyChain dataOfItemForQuery:[OPElementStoredEntity queryForDevicePrivateElementNamed:self.name]];
|
||||
if (self.type == MPElementTypeStoredDevicePrivate)
|
||||
encryptedContent = [KeyChain dataOfItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]];
|
||||
else
|
||||
encryptedContent = self.contentObject;
|
||||
|
||||
NSData *decryptedContent = [encryptedContent decryptWithSymmetricKey:[[OPAppDelegate get].keyPhrase
|
||||
NSData *decryptedContent = [encryptedContent decryptWithSymmetricKey:[[MPAppDelegate get].keyPhrase
|
||||
dataUsingEncoding:NSUTF8StringEncoding]
|
||||
usePadding:YES];
|
||||
return [[NSString alloc] initWithBytes:decryptedContent.bytes length:decryptedContent.length encoding:NSUTF8StringEncoding];
|
||||
@@ -47,12 +47,12 @@
|
||||
|
||||
- (void)setContent:(id)content {
|
||||
|
||||
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[[OPAppDelegate get].keyPhrase
|
||||
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[[MPAppDelegate get].keyPhrase
|
||||
dataUsingEncoding:NSUTF8StringEncoding]
|
||||
usePadding:YES];
|
||||
|
||||
if (self.type == OPElementTypeStoredDevicePrivate) {
|
||||
[KeyChain addOrUpdateItemForQuery:[OPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
||||
if (self.type == MPElementTypeStoredDevicePrivate) {
|
||||
[KeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
encryptedContent, (__bridge id)kSecValueData,
|
||||
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPGuideViewController.h
|
||||
// MPGuideViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 30/01/12.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface OPGuideViewController : UIViewController
|
||||
@interface MPGuideViewController : UIViewController
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
|
||||
|
@@ -1,15 +1,15 @@
|
||||
//
|
||||
// OPGuideViewController.m
|
||||
// MPGuideViewController.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 30/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPGuideViewController.h"
|
||||
#import "OPAppDelegate.h"
|
||||
#import "MPGuideViewController.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
@implementation OPGuideViewController
|
||||
@implementation MPGuideViewController
|
||||
@synthesize scrollView;
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
[OPConfig get].showQuickStart = [NSNumber numberWithBool:NO];
|
||||
[[OPAppDelegate get] loadKeyPhrase];
|
||||
[MPConfig get].showQuickStart = [NSNumber numberWithBool:NO];
|
||||
[[MPAppDelegate get] loadKeyPhrase];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
@@ -1,20 +1,20 @@
|
||||
//
|
||||
// OPMainViewController.h
|
||||
// MPMainViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPTypeViewController.h"
|
||||
#import "OPElementEntity.h"
|
||||
#import "OPSearchDelegate.h"
|
||||
#import "MPTypeViewController.h"
|
||||
#import "MPElementEntity.h"
|
||||
#import "MPSearchDelegate.h"
|
||||
#import "IASKAppSettingsViewController.h"
|
||||
|
||||
@interface OPMainViewController : UIViewController <OPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, OPSearchResultsDelegate, UIWebViewDelegate, IASKSettingsDelegate>
|
||||
@interface MPMainViewController : UIViewController <MPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, MPSearchResultsDelegate, UIWebViewDelegate, IASKSettingsDelegate>
|
||||
|
||||
@property (strong, nonatomic) OPElementEntity *activeElement;
|
||||
@property (strong, nonatomic) IBOutlet OPSearchDelegate *searchResultsController;
|
||||
@property (strong, nonatomic) MPElementEntity *activeElement;
|
||||
@property (strong, nonatomic) IBOutlet MPSearchDelegate *searchResultsController;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *contentField;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *typeButton;
|
||||
@property (weak, nonatomic) IBOutlet UIWebView *helpView;
|
@@ -1,22 +1,22 @@
|
||||
//
|
||||
// OPMainViewController.m
|
||||
// MPMainViewController.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPMainViewController.h"
|
||||
#import "OPAppDelegate.h"
|
||||
#import "OPContentViewController.h"
|
||||
#import "OPElementGeneratedEntity.h"
|
||||
#import "OPElementStoredEntity.h"
|
||||
#import "MPMainViewController.h"
|
||||
#import "MPAppDelegate.h"
|
||||
#import "MPContentViewController.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
#import "MPElementStoredEntity.h"
|
||||
#import "IASKAppSettingsViewController.h"
|
||||
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
|
||||
|
||||
@interface OPMainViewController (Private)
|
||||
@interface MPMainViewController (Private)
|
||||
|
||||
- (void)updateAnimated:(BOOL)animated;
|
||||
- (void)updateWasAnimated:(BOOL)animated;
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation OPMainViewController
|
||||
@implementation MPMainViewController
|
||||
@synthesize activeElement = _activeElement;
|
||||
@synthesize searchResultsController = _searchResultsController;
|
||||
@synthesize typeButton = _typeButton;
|
||||
@@ -55,10 +55,10 @@
|
||||
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
|
||||
if ([[segue identifier] isEqualToString:@"OP_Main_ChooseType"])
|
||||
if ([[segue identifier] isEqualToString:@"MP_Main_ChooseType"])
|
||||
[[segue destinationViewController] setDelegate:self];
|
||||
if ([[segue identifier] isEqualToString:@"OP_Main_Content"])
|
||||
((OPContentViewController *)[segue destinationViewController]).activeElement = self.activeElement;
|
||||
if ([[segue identifier] isEqualToString:@"MP_Main_Content"])
|
||||
((MPContentViewController *)[segue destinationViewController]).activeElement = self.activeElement;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
@@ -72,7 +72,7 @@
|
||||
self.searchTipContainer.alpha = 1;
|
||||
}];
|
||||
|
||||
[self setHelpHidden:[[OPConfig get].helpHidden boolValue] animated:animated];
|
||||
[self setHelpHidden:[[MPConfig get].helpHidden boolValue] animated:animated];
|
||||
[self updateAnimated:animated];
|
||||
}
|
||||
|
||||
@@ -104,14 +104,14 @@
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:nil queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification *note) {
|
||||
if (![OPAppDelegate get].keyPhrase) {
|
||||
if (![MPAppDelegate get].keyPhrase) {
|
||||
self.activeElement = nil;
|
||||
[self updateAnimated:NO];
|
||||
}
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification *note) {
|
||||
if (![OPAppDelegate get].keyPhrase) {
|
||||
if (![MPAppDelegate get].keyPhrase) {
|
||||
self.activeElement = nil;
|
||||
[self updateAnimated:NO];
|
||||
}
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
- (void)updateAnimated:(BOOL)animated {
|
||||
|
||||
[[OPAppDelegate get] saveContext];
|
||||
[[MPAppDelegate get] saveContext];
|
||||
|
||||
if (animated)
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
@@ -168,18 +168,18 @@
|
||||
[self setHelpChapter:self.activeElement? @"2": @"1"];
|
||||
self.siteName.text = self.activeElement.name;
|
||||
|
||||
self.passwordCounter.alpha = self.activeElement.type & OPElementTypeClassCalculated? 0.5f: 0;
|
||||
self.passwordIncrementer.alpha = self.activeElement.type & OPElementTypeClassCalculated? 0.5f: 0;
|
||||
self.passwordEdit.alpha = self.activeElement.type & OPElementTypeClassStored? 0.5f: 0;
|
||||
self.passwordCounter.alpha = self.activeElement.type & MPElementTypeClassCalculated? 0.5f: 0;
|
||||
self.passwordIncrementer.alpha = self.activeElement.type & MPElementTypeClassCalculated? 0.5f: 0;
|
||||
self.passwordEdit.alpha = self.activeElement.type & MPElementTypeClassStored? 0.5f: 0;
|
||||
|
||||
[self.typeButton setTitle:NSStringFromOPElementType(self.activeElement.type)
|
||||
[self.typeButton setTitle:NSStringFromMPElementType(self.activeElement.type)
|
||||
forState:UIControlStateNormal];
|
||||
self.typeButton.alpha = NSStringFromOPElementType(self.activeElement.type).length? 1: 0;
|
||||
self.typeButton.alpha = NSStringFromMPElementType(self.activeElement.type).length? 1: 0;
|
||||
|
||||
self.contentField.enabled = NO;
|
||||
|
||||
if ([self.activeElement isKindOfClass:[OPElementGeneratedEntity class]])
|
||||
self.passwordCounter.text = [NSString stringWithFormat:@"%d", ((OPElementGeneratedEntity *) self.activeElement).counter];
|
||||
if ([self.activeElement isKindOfClass:[MPElementGeneratedEntity class]])
|
||||
self.passwordCounter.text = [NSString stringWithFormat:@"%d", ((MPElementGeneratedEntity *) self.activeElement).counter];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
|
||||
NSString *description = self.activeElement.description;
|
||||
@@ -207,11 +207,11 @@
|
||||
if (hidden) {
|
||||
self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 373);
|
||||
self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 415);
|
||||
[OPConfig get].helpHidden = [NSNumber numberWithBool:YES];
|
||||
[MPConfig get].helpHidden = [NSNumber numberWithBool:YES];
|
||||
} else {
|
||||
self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 175);
|
||||
self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 216);
|
||||
[OPConfig get].helpHidden = [NSNumber numberWithBool:NO];
|
||||
[MPConfig get].helpHidden = [NSNumber numberWithBool:NO];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -223,7 +223,7 @@
|
||||
[NSURL URLWithString:[NSString stringWithFormat:@"#%@", chapter] relativeToURL:
|
||||
[[NSBundle mainBundle] URLForResource:@"help" withExtension:@"html"]]]];
|
||||
[self.helpView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setClass('%@');",
|
||||
ClassNameFromOPElementType(self.activeElement.type)]];
|
||||
ClassNameFromMPElementType(self.activeElement.type)]];
|
||||
}
|
||||
|
||||
- (void)showContentTip:(NSString *)message withIcon:(UIImageView *)icon {
|
||||
@@ -280,12 +280,12 @@
|
||||
|
||||
- (IBAction)incrementPasswordCounter {
|
||||
|
||||
if (![self.activeElement isKindOfClass:[OPElementGeneratedEntity class]])
|
||||
if (![self.activeElement isKindOfClass:[MPElementGeneratedEntity class]])
|
||||
// Not of a type that supports a password counter;
|
||||
return;
|
||||
|
||||
[self updateElement:^{
|
||||
++((OPElementGeneratedEntity *) self.activeElement).counter;
|
||||
++((MPElementGeneratedEntity *) self.activeElement).counter;
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@
|
||||
|
||||
- (IBAction)editPassword {
|
||||
|
||||
if (self.activeElement.type & OPElementTypeClassStored) {
|
||||
if (self.activeElement.type & MPElementTypeClassStored) {
|
||||
self.contentField.enabled = YES;
|
||||
[self.contentField becomeFirstResponder];
|
||||
}
|
||||
@@ -338,7 +338,7 @@
|
||||
[self setHelpHidden:NO animated:YES];
|
||||
break;
|
||||
case 2:
|
||||
[[OPAppDelegate get] showGuide];
|
||||
[[MPAppDelegate get] showGuide];
|
||||
break;
|
||||
case 3: {
|
||||
IASKAppSettingsViewController *settingsVC = [IASKAppSettingsViewController new];
|
||||
@@ -351,32 +351,32 @@
|
||||
otherTitles:[self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Tutorial", @"Settings", nil];
|
||||
}
|
||||
|
||||
- (void)didSelectType:(OPElementType)type {
|
||||
- (void)didSelectType:(MPElementType)type {
|
||||
|
||||
[self updateElement:^{
|
||||
// Update password type.
|
||||
if (ClassFromOPElementType(type) != ClassFromOPElementType(self.activeElement.type))
|
||||
if (ClassFromMPElementType(type) != ClassFromMPElementType(self.activeElement.type))
|
||||
// Type requires a different class of element. Recreate the element.
|
||||
[[OPAppDelegate managedObjectContext] performBlockAndWait:^{
|
||||
OPElementEntity *newElement = [NSEntityDescription insertNewObjectForEntityForName:ClassNameFromOPElementType(type)
|
||||
inManagedObjectContext:[OPAppDelegate managedObjectContext]];
|
||||
[[MPAppDelegate managedObjectContext] performBlockAndWait:^{
|
||||
MPElementEntity *newElement = [NSEntityDescription insertNewObjectForEntityForName:ClassNameFromMPElementType(type)
|
||||
inManagedObjectContext:[MPAppDelegate managedObjectContext]];
|
||||
newElement.name = self.activeElement.name;
|
||||
newElement.mpHashHex = self.activeElement.mpHashHex;
|
||||
newElement.uses = self.activeElement.uses;
|
||||
newElement.lastUsed = self.activeElement.lastUsed;
|
||||
|
||||
[[OPAppDelegate managedObjectContext] deleteObject:self.activeElement];
|
||||
[[MPAppDelegate managedObjectContext] deleteObject:self.activeElement];
|
||||
self.activeElement = newElement;
|
||||
}];
|
||||
|
||||
self.activeElement.type = type;
|
||||
|
||||
if (type & OPElementTypeClassStored && ![self.activeElement.description length])
|
||||
if (type & MPElementTypeClassStored && ![self.activeElement.description length])
|
||||
[self showContentTip:@"Tap to set a password." withIcon:self.contentTipEditIcon];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didSelectElement:(OPElementEntity *)element {
|
||||
- (void)didSelectElement:(MPElementEntity *)element {
|
||||
|
||||
self.activeElement = element;
|
||||
[self.activeElement use];
|
||||
@@ -404,16 +404,16 @@
|
||||
|
||||
if (textField == self.contentField) {
|
||||
self.contentField.enabled = NO;
|
||||
if (![self.activeElement isKindOfClass:[OPElementStoredEntity class]])
|
||||
if (![self.activeElement isKindOfClass:[MPElementStoredEntity class]])
|
||||
// Not of a type whose content can be edited.
|
||||
return;
|
||||
|
||||
if ([((OPElementStoredEntity *) self.activeElement).content isEqual:self.contentField.text])
|
||||
if ([((MPElementStoredEntity *) self.activeElement).content isEqual:self.contentField.text])
|
||||
// Content hasn't changed.
|
||||
return;
|
||||
|
||||
[self updateElement:^{
|
||||
((OPElementStoredEntity *) self.activeElement).content = self.contentField.text;
|
||||
((MPElementStoredEntity *) self.activeElement).content = self.contentField.text;
|
||||
}];
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPRecentViewController.h
|
||||
// MPRecentViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 27/11/11.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OPRecentViewController : UITableViewController
|
||||
@interface MPRecentViewController : UITableViewController
|
||||
|
||||
@property(nonatomic,retain) IBOutlet UITableView *tableView;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// OPRecentViewController.m
|
||||
// MPRecentViewController.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 27/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPRecentViewController.h"
|
||||
#import "MPRecentViewController.h"
|
||||
|
||||
@implementation OPRecentViewController
|
||||
@implementation MPRecentViewController
|
||||
@dynamic tableView;
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OPSearchDelegate.h
|
||||
// MPSearchDelegate.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 04/01/12.
|
||||
@@ -7,19 +7,19 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "OPElementEntity.h"
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
@protocol OPSearchResultsDelegate <NSObject>
|
||||
@protocol MPSearchResultsDelegate <NSObject>
|
||||
|
||||
- (void)didSelectElement:(OPElementEntity *)element;
|
||||
- (void)didSelectElement:(MPElementEntity *)element;
|
||||
|
||||
@end
|
||||
|
||||
@interface OPSearchDelegate : NSObject <UITableViewDelegate, UITableViewDataSource, UISearchDisplayDelegate, NSFetchedResultsControllerDelegate>
|
||||
@interface MPSearchDelegate : NSObject <UITableViewDelegate, UITableViewDataSource, UISearchDisplayDelegate, NSFetchedResultsControllerDelegate>
|
||||
|
||||
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet id<OPSearchResultsDelegate> delegate;
|
||||
@property (weak, nonatomic) IBOutlet id<MPSearchResultsDelegate> delegate;
|
||||
@property (weak, nonatomic) IBOutlet UISearchDisplayController *searchDisplayController;
|
||||
@property (weak, nonatomic) IBOutlet UIView *searchTipContainer;
|
||||
|
@@ -1,23 +1,23 @@
|
||||
//
|
||||
// OPSearchDelegate.m
|
||||
// MPSearchDelegate.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 04/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPSearchDelegate.h"
|
||||
#import "OPAppDelegate.h"
|
||||
#import "OPElementGeneratedEntity.h"
|
||||
#import "MPSearchDelegate.h"
|
||||
#import "MPAppDelegate.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
|
||||
@interface OPSearchDelegate (Private)
|
||||
@interface MPSearchDelegate (Private)
|
||||
|
||||
- (void)configureCell:(UITableViewCell *)cell inTableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath;
|
||||
- (void)update;
|
||||
|
||||
@end
|
||||
|
||||
@implementation OPSearchDelegate
|
||||
@implementation MPSearchDelegate
|
||||
@synthesize fetchedResultsController;
|
||||
@synthesize delegate;
|
||||
@synthesize searchDisplayController;
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView {
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:OPPersistentStoreDidChangeNotification
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIScreenModeDidChangeNotification
|
||||
object:nil queue:nil usingBlock:^(NSNotification *note) {
|
||||
NSError *error;
|
||||
if (![self.fetchedResultsController performFetch:&error])
|
||||
@@ -67,17 +67,17 @@
|
||||
if (!query)
|
||||
query = @"";
|
||||
|
||||
NSFetchRequest *fetchRequest = [[OPAppDelegate get].managedObjectModel
|
||||
fetchRequestFromTemplateWithName:@"OPSearchElement"
|
||||
NSFetchRequest *fetchRequest = [[MPAppDelegate get].managedObjectModel
|
||||
fetchRequestFromTemplateWithName:@"MPSearchElement"
|
||||
substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
query, @"query",
|
||||
[OPAppDelegate get].keyPhraseHashHex, @"mpHashHex",
|
||||
[MPAppDelegate get].keyPhraseHashHex, @"mpHashHex",
|
||||
nil]];
|
||||
[fetchRequest setSortDescriptors:
|
||||
[NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses" ascending:NO]]];
|
||||
|
||||
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
|
||||
managedObjectContext:[OPAppDelegate managedObjectContext]
|
||||
managedObjectContext:[MPAppDelegate managedObjectContext]
|
||||
sectionNameKeyPath:nil cacheName:nil];
|
||||
self.fetchedResultsController.delegate = self;
|
||||
|
||||
@@ -159,9 +159,9 @@
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OPElementSearch"];
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MPElementSearch"];
|
||||
if (!cell) {
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"OPElementSearch"];
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"MPElementSearch"];
|
||||
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"ui_list_middle"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)]];
|
||||
backgroundImageView.frame = CGRectMake(-5, 0, 330, 34);
|
||||
UIView *backgroundView = [[UIView alloc] initWithFrame:cell.frame];
|
||||
@@ -182,7 +182,7 @@
|
||||
- (void)configureCell:(UITableViewCell *)cell inTableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
if (indexPath.section < [[self.fetchedResultsController sections] count]) {
|
||||
OPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
|
||||
MPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
|
||||
|
||||
cell.textLabel.text = element.name;
|
||||
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", element.uses];
|
||||
@@ -209,12 +209,12 @@
|
||||
return;
|
||||
|
||||
[self.fetchedResultsController.managedObjectContext performBlock:^{
|
||||
OPElementEntity *element = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([OPElementGeneratedEntity class])
|
||||
MPElementEntity *element = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([MPElementGeneratedEntity class])
|
||||
inManagedObjectContext:self.fetchedResultsController.managedObjectContext];
|
||||
assert([element isKindOfClass:ClassFromOPElementType(element.type)]);
|
||||
assert([element isKindOfClass:ClassFromMPElementType(element.type)]);
|
||||
|
||||
element.name = siteName;
|
||||
element.mpHashHex = [OPAppDelegate get].keyPhraseHashHex;
|
||||
element.mpHashHex = [MPAppDelegate get].keyPhraseHashHex;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.delegate didSelectElement:element];
|
||||
@@ -250,7 +250,7 @@
|
||||
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete)
|
||||
[self.fetchedResultsController.managedObjectContext performBlock:^{
|
||||
OPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
|
||||
MPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
|
||||
[self.fetchedResultsController.managedObjectContext deleteObject:element];
|
||||
}];
|
||||
}
|
21
MasterPassword/MPTypeViewController.h
Normal file
21
MasterPassword/MPTypeViewController.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MPTypeViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 27/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol MPTypeDelegate <NSObject>
|
||||
|
||||
- (void)didSelectType:(MPElementType)type;
|
||||
|
||||
@end
|
||||
|
||||
@interface MPTypeViewController : UITableViewController
|
||||
|
||||
@property (nonatomic, weak) id<MPTypeDelegate> delegate;
|
||||
|
||||
@end
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// OPTypeViewController.m
|
||||
// MPTypeViewController.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 27/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPTypeViewController.h"
|
||||
#import "MPTypeViewController.h"
|
||||
|
||||
@implementation OPTypeViewController
|
||||
@implementation MPTypeViewController
|
||||
@synthesize delegate;
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
@@ -29,25 +29,25 @@
|
||||
|
||||
assert(self.navigationController.topViewController == self);
|
||||
|
||||
OPElementType type;
|
||||
MPElementType type;
|
||||
switch (indexPath.section) {
|
||||
case 0: {
|
||||
// Calculated
|
||||
switch (indexPath.row) {
|
||||
case 0:
|
||||
type = OPElementTypeCalculatedLong;
|
||||
type = MPElementTypeCalculatedLong;
|
||||
break;
|
||||
case 1:
|
||||
type = OPElementTypeCalculatedMedium;
|
||||
type = MPElementTypeCalculatedMedium;
|
||||
break;
|
||||
case 2:
|
||||
type = OPElementTypeCalculatedShort;
|
||||
type = MPElementTypeCalculatedShort;
|
||||
break;
|
||||
case 3:
|
||||
type = OPElementTypeCalculatedBasic;
|
||||
type = MPElementTypeCalculatedBasic;
|
||||
break;
|
||||
case 4:
|
||||
type = OPElementTypeCalculatedPIN;
|
||||
type = MPElementTypeCalculatedPIN;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -61,10 +61,10 @@
|
||||
// Stored
|
||||
switch (indexPath.row) {
|
||||
case 0:
|
||||
type = OPElementTypeStoredPersonal;
|
||||
type = MPElementTypeStoredPersonal;
|
||||
break;
|
||||
case 1:
|
||||
type = OPElementTypeStoredDevicePrivate;
|
||||
type = MPElementTypeStoredDevicePrivate;
|
||||
break;
|
||||
|
||||
default:
|
38
MasterPassword/MPTypes.h
Normal file
38
MasterPassword/MPTypes.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// MPTypes.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define MPPersistentStoreDidChangeNotification @"MPPersistentStoreDidChange"
|
||||
|
||||
typedef enum {
|
||||
MPElementContentTypePassword,
|
||||
MPElementContentTypeNote,
|
||||
MPElementContentTypePicture,
|
||||
} MPElementContentType;
|
||||
|
||||
typedef enum {
|
||||
MPElementTypeClassCalculated = 2 << 7,
|
||||
MPElementTypeClassStored = 2 << 8,
|
||||
} MPElementTypeClass;
|
||||
|
||||
typedef enum {
|
||||
MPElementTypeCalculatedLong = MPElementTypeClassCalculated | 0x01,
|
||||
MPElementTypeCalculatedMedium = MPElementTypeClassCalculated | 0x02,
|
||||
MPElementTypeCalculatedShort = MPElementTypeClassCalculated | 0x03,
|
||||
MPElementTypeCalculatedBasic = MPElementTypeClassCalculated | 0x04,
|
||||
MPElementTypeCalculatedPIN = MPElementTypeClassCalculated | 0x05,
|
||||
|
||||
MPElementTypeStoredPersonal = MPElementTypeClassStored | 0x01,
|
||||
MPElementTypeStoredDevicePrivate = MPElementTypeClassStored | 0x02,
|
||||
} MPElementType;
|
||||
|
||||
NSString *NSStringFromMPElementType(MPElementType type);
|
||||
NSString *ClassNameFromMPElementType(MPElementType type);
|
||||
Class ClassFromMPElementType(MPElementType type);
|
||||
NSString *MPCalculateContent(MPElementType type, NSString *name, NSString *keyPhrase, int counter);
|
@@ -1,41 +1,41 @@
|
||||
//
|
||||
// OPTypes.m
|
||||
// MPTypes.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OPTypes.h"
|
||||
#import "OPElementGeneratedEntity.h"
|
||||
#import "OPElementStoredEntity.h"
|
||||
#import "MPTypes.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
#import "MPElementStoredEntity.h"
|
||||
|
||||
|
||||
NSString *NSStringFromOPElementType(OPElementType type) {
|
||||
NSString *NSStringFromMPElementType(MPElementType type) {
|
||||
|
||||
if (!type)
|
||||
return nil;
|
||||
|
||||
switch (type) {
|
||||
case OPElementTypeCalculatedLong:
|
||||
case MPElementTypeCalculatedLong:
|
||||
return @"Long Password";
|
||||
|
||||
case OPElementTypeCalculatedMedium:
|
||||
case MPElementTypeCalculatedMedium:
|
||||
return @"Medium Password";
|
||||
|
||||
case OPElementTypeCalculatedShort:
|
||||
case MPElementTypeCalculatedShort:
|
||||
return @"Short Password";
|
||||
|
||||
case OPElementTypeCalculatedBasic:
|
||||
case MPElementTypeCalculatedBasic:
|
||||
return @"Basic Password";
|
||||
|
||||
case OPElementTypeCalculatedPIN:
|
||||
case MPElementTypeCalculatedPIN:
|
||||
return @"PIN";
|
||||
|
||||
case OPElementTypeStoredPersonal:
|
||||
case MPElementTypeStoredPersonal:
|
||||
return @"Personal Password";
|
||||
|
||||
case OPElementTypeStoredDevicePrivate:
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
return @"Device Private Password";
|
||||
|
||||
default:
|
||||
@@ -43,50 +43,50 @@ NSString *NSStringFromOPElementType(OPElementType type) {
|
||||
}
|
||||
}
|
||||
|
||||
Class ClassFromOPElementType(OPElementType type) {
|
||||
Class ClassFromMPElementType(MPElementType type) {
|
||||
|
||||
if (!type)
|
||||
return nil;
|
||||
|
||||
switch (type) {
|
||||
case OPElementTypeCalculatedLong:
|
||||
return [OPElementGeneratedEntity class];
|
||||
case MPElementTypeCalculatedLong:
|
||||
return [MPElementGeneratedEntity class];
|
||||
|
||||
case OPElementTypeCalculatedMedium:
|
||||
return [OPElementGeneratedEntity class];
|
||||
case MPElementTypeCalculatedMedium:
|
||||
return [MPElementGeneratedEntity class];
|
||||
|
||||
case OPElementTypeCalculatedShort:
|
||||
return [OPElementGeneratedEntity class];
|
||||
case MPElementTypeCalculatedShort:
|
||||
return [MPElementGeneratedEntity class];
|
||||
|
||||
case OPElementTypeCalculatedBasic:
|
||||
return [OPElementGeneratedEntity class];
|
||||
case MPElementTypeCalculatedBasic:
|
||||
return [MPElementGeneratedEntity class];
|
||||
|
||||
case OPElementTypeCalculatedPIN:
|
||||
return [OPElementGeneratedEntity class];
|
||||
case MPElementTypeCalculatedPIN:
|
||||
return [MPElementGeneratedEntity class];
|
||||
|
||||
case OPElementTypeStoredPersonal:
|
||||
return [OPElementStoredEntity class];
|
||||
case MPElementTypeStoredPersonal:
|
||||
return [MPElementStoredEntity class];
|
||||
|
||||
case OPElementTypeStoredDevicePrivate:
|
||||
return [OPElementStoredEntity class];
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
return [MPElementStoredEntity class];
|
||||
|
||||
default:
|
||||
[NSException raise:NSInternalInconsistencyException format:@"Type not supported: %d", type];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *ClassNameFromOPElementType(OPElementType type) {
|
||||
NSString *ClassNameFromMPElementType(MPElementType type) {
|
||||
|
||||
return NSStringFromClass(ClassFromOPElementType(type));
|
||||
return NSStringFromClass(ClassFromMPElementType(type));
|
||||
}
|
||||
|
||||
static NSDictionary *OPTypes_ciphers = nil;
|
||||
NSString *OPCalculateContent(OPElementType type, NSString *name, NSString *keyPhrase, int counter) {
|
||||
static NSDictionary *MPTypes_ciphers = nil;
|
||||
NSString *MPCalculateContent(MPElementType type, NSString *name, NSString *keyPhrase, int counter) {
|
||||
|
||||
assert(type & OPElementTypeClassCalculated);
|
||||
assert(type & MPElementTypeClassCalculated);
|
||||
|
||||
if (OPTypes_ciphers == nil)
|
||||
OPTypes_ciphers = [NSDictionary dictionaryWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"ciphers"
|
||||
if (MPTypes_ciphers == nil)
|
||||
MPTypes_ciphers = [NSDictionary dictionaryWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"ciphers"
|
||||
withExtension:@"plist"]];
|
||||
|
||||
// Determine the hash whose bytes will be used for calculating a password: md4(name-keyPhrase)
|
||||
@@ -96,8 +96,8 @@ NSString *OPCalculateContent(OPElementType type, NSString *name, NSString *keyPh
|
||||
|
||||
// Determine the cipher from the first hash byte.
|
||||
assert([keyHash length]);
|
||||
NSArray *typeCiphers = [[OPTypes_ciphers valueForKey:ClassNameFromOPElementType(type)]
|
||||
valueForKey:NSStringFromOPElementType(type)];
|
||||
NSArray *typeCiphers = [[MPTypes_ciphers valueForKey:ClassNameFromMPElementType(type)]
|
||||
valueForKey:NSStringFromMPElementType(type)];
|
||||
NSString *cipher = [typeCiphers objectAtIndex:keyBytes[0] % [typeCiphers count]];
|
||||
|
||||
// Encode the content, character by character, using subsequent hash bytes and the cipher.
|
||||
@@ -106,7 +106,7 @@ NSString *OPCalculateContent(OPElementType type, NSString *name, NSString *keyPh
|
||||
for (NSUInteger c = 0; c < [cipher length]; ++c) {
|
||||
const char keyByte = keyBytes[c + 1];
|
||||
NSString *cipherClass = [cipher substringWithRange:NSMakeRange(c, 1)];
|
||||
NSString *cipherClassCharacters = [[OPTypes_ciphers valueForKey:@"OPCharacterClasses"] valueForKey:cipherClass];
|
||||
NSString *cipherClassCharacters = [[MPTypes_ciphers valueForKey:@"MPCharacterClasses"] valueForKey:cipherClass];
|
||||
|
||||
[content appendString:[cipherClassCharacters substringWithRange:NSMakeRange(keyByte % [cipherClassCharacters length], 1)]];
|
||||
}
|
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1906" systemVersion="11A511" targetRuntime="iOS.CocoaTouch.iPad" nextObjectID="24" propertyAccessControl="none" initialViewController="2">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="902"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<scene sceneID="4">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3" sceneMemberID="firstResponder"/>
|
||||
<viewController id="2" customClass="OPMainViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8">
|
||||
<rect key="frame" x="0.0" y="20" width="768" height="1004"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<navigationBar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" barStyle="blackOpaque" id="13">
|
||||
<rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<items>
|
||||
<navigationItem title="Title" id="14">
|
||||
<barButtonItem key="rightBarButtonItem" title="Info" id="15">
|
||||
<connections>
|
||||
<action selector="togglePopover:" destination="2" id="23"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.25" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<connections>
|
||||
<segue destination="5" kind="popover" identifier="showAlternate" popoverAnchorBarButtonItem="15" id="22">
|
||||
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
|
||||
<popoverPassthroughViews/>
|
||||
</segue>
|
||||
</connections>
|
||||
</viewController>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-286" y="15"/>
|
||||
</scene>
|
||||
<scene sceneID="7">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6" sceneMemberID="firstResponder"/>
|
||||
<viewController id="5" customClass="OPFlipsideViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<navigationBar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" barStyle="blackOpaque" id="17">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<items>
|
||||
<navigationItem title="Title" id="18">
|
||||
<barButtonItem key="leftBarButtonItem" systemItem="done" id="19">
|
||||
<connections>
|
||||
<action selector="done:" destination="5" id="21"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.25" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<splitViewMasterSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
</viewController>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="836" y="101"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<classes>
|
||||
<class className="OPFlipsideViewController" superclassName="UIViewController">
|
||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/OPFlipsideViewController.h"/>
|
||||
<relationships>
|
||||
<relationship kind="action" name="done:"/>
|
||||
<relationship kind="outlet" name="delegate"/>
|
||||
</relationships>
|
||||
</class>
|
||||
<class className="OPMainViewController" superclassName="UIViewController">
|
||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/OPMainViewController.h"/>
|
||||
<relationships/>
|
||||
</class>
|
||||
</classes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
@@ -8,7 +8,7 @@
|
||||
<scene sceneID="WkW-SR-cr2">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="jZj-N1-rhF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<tableViewController id="NKe-nv-566" customClass="OPTypeViewController" sceneMemberID="viewController">
|
||||
<tableViewController id="NKe-nv-566" customClass="MPTypeViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="btl-G4-V0S">
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -311,7 +311,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
|
||||
<scene sceneID="U26-Zf-euQ">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="mK2-p1-3zC" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<customObject id="0QO-2P-OhD" customClass="OPSearchDelegate">
|
||||
<customObject id="0QO-2P-OhD" customClass="MPSearchDelegate">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="PQa-Xl-A3x" id="O2f-mW-ab8"/>
|
||||
<outlet property="searchDisplayController" destination="P8c-gf-nN3" id="exk-dS-Ui3"/>
|
||||
@@ -327,7 +327,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
|
||||
<outlet property="searchResultsDelegate" destination="0QO-2P-OhD" id="Bm8-Q3-lLA"/>
|
||||
</connections>
|
||||
</searchDisplayController>
|
||||
<viewController id="PQa-Xl-A3x" customClass="OPMainViewController" sceneMemberID="viewController">
|
||||
<viewController id="PQa-Xl-A3x" customClass="MPMainViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ep0-Hn-5TR">
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -443,7 +443,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<segue destination="NKe-nv-566" kind="push" identifier="OP_Main_ChooseType" id="vw4-Vd-O6q"/>
|
||||
<segue destination="NKe-nv-566" kind="push" identifier="MP_Main_ChooseType" id="vw4-Vd-O6q"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view userInteractionEnabled="NO" alpha="0.0" contentMode="scaleToFill" id="v2m-Gf-pEV">
|
||||
@@ -604,7 +604,7 @@ L4m3P4sSw0rD</string>
|
||||
<scene sceneID="Rt1-b4-sUB">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="7yf-G7-kVy" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<viewController id="qz3-eG-aEi" customClass="OPGuideViewController" sceneMemberID="viewController">
|
||||
<viewController id="qz3-eG-aEi" customClass="MPGuideViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="cwa-ct-2DY">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -682,7 +682,7 @@ L4m3P4sSw0rD</string>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="PQa-Xl-A3x" kind="relationship" relationship="rootViewController" id="LUg-eF-JQd"/>
|
||||
<segue destination="qz3-eG-aEi" kind="modal" identifier="OP_Guide" id="vyG-wN-8hU"/>
|
||||
<segue destination="qz3-eG-aEi" kind="modal" identifier="MP_Guide" id="vyG-wN-8hU"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
</objects>
|
||||
@@ -717,4 +717,4 @@ L4m3P4sSw0rD</string>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
||||
</document>
|
||||
|
@@ -22,5 +22,5 @@
|
||||
#import "Pearl-Crypto.h"
|
||||
#import "Pearl-UIKit.h"
|
||||
|
||||
#import "OPTypes.h"
|
||||
#import "OPConfig.h"
|
||||
#import "MPTypes.h"
|
||||
#import "MPConfig.h"
|
||||
|
@@ -1,22 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="872" systemVersion="11C74" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
|
||||
<entity name="OPElementEntity" representedClassName="OPElementEntity" isAbstract="YES" syncable="YES">
|
||||
<entity name="MPElementEntity" representedClassName="MPElementEntity" isAbstract="YES" syncable="YES">
|
||||
<attribute name="lastUsed" attributeType="Date" syncable="YES"/>
|
||||
<attribute name="mpHashHex" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="name" attributeType="String" indexed="YES" syncable="YES"/>
|
||||
<attribute name="type" attributeType="Integer 16" defaultValueString="257" syncable="YES"/>
|
||||
<attribute name="uses" attributeType="Integer 16" defaultValueString="0" syncable="YES"/>
|
||||
</entity>
|
||||
<entity name="OPElementGeneratedEntity" representedClassName="OPElementGeneratedEntity" parentEntity="OPElementEntity" syncable="YES">
|
||||
<entity name="MPElementGeneratedEntity" representedClassName="MPElementGeneratedEntity" parentEntity="MPElementEntity" syncable="YES">
|
||||
<attribute name="counter" optional="YES" attributeType="Integer 16" defaultValueString="1" syncable="YES"/>
|
||||
</entity>
|
||||
<entity name="OPElementStoredEntity" representedClassName="OPElementStoredEntity" parentEntity="OPElementEntity" syncable="YES">
|
||||
<entity name="MPElementStoredEntity" representedClassName="MPElementStoredEntity" parentEntity="MPElementEntity" syncable="YES">
|
||||
<attribute name="contentObject" optional="YES" attributeType="Transformable" storedInTruthFile="YES" syncable="YES"/>
|
||||
</entity>
|
||||
<fetchRequest name="OPSearchElement" entity="OPElementEntity" predicateString="name BEGINSWITH[cd] $query AND mpHashHex == $mpHashHex"/>
|
||||
<fetchRequest name="MPSearchElement" entity="MPElementEntity" predicateString="name BEGINSWITH[cd] $query AND mpHashHex == $mpHashHex"/>
|
||||
<elements>
|
||||
<element name="OPElementEntity" positionX="160" positionY="192" width="128" height="135"/>
|
||||
<element name="OPElementGeneratedEntity" positionX="160" positionY="192" width="128" height="60"/>
|
||||
<element name="OPElementStoredEntity" positionX="160" positionY="192" width="128" height="60"/>
|
||||
<element name="MPElementEntity" positionX="160" positionY="192" width="128" height="135"/>
|
||||
<element name="MPElementGeneratedEntity" positionX="160" positionY="192" width="128" height="60"/>
|
||||
<element name="MPElementStoredEntity" positionX="160" positionY="192" width="128" height="60"/>
|
||||
</elements>
|
||||
</model>
|
||||
</model>
|
||||
|
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// OPContentViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 03/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "OPElementEntity.h"
|
||||
|
||||
@interface OPContentViewController : UIViewController
|
||||
|
||||
@property (nonatomic, weak) OPElementEntity *activeElement;
|
||||
|
||||
@end
|
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// OPTypeViewController.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 27/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol OPTypeDelegate <NSObject>
|
||||
|
||||
- (void)didSelectType:(OPElementType)type;
|
||||
|
||||
@end
|
||||
|
||||
@interface OPTypeViewController : UITableViewController
|
||||
|
||||
@property (nonatomic, weak) id<OPTypeDelegate> delegate;
|
||||
|
||||
@end
|
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// OPTypes.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define OPPersistentStoreDidChangeNotification @"OPPersistentStoreDidChange"
|
||||
|
||||
typedef enum {
|
||||
OPElementContentTypePassword,
|
||||
OPElementContentTypeNote,
|
||||
OPElementContentTypePicture,
|
||||
} OPElementContentType;
|
||||
|
||||
typedef enum {
|
||||
OPElementTypeClassCalculated = 2 << 7,
|
||||
OPElementTypeClassStored = 2 << 8,
|
||||
} OPElementTypeClass;
|
||||
|
||||
typedef enum {
|
||||
OPElementTypeCalculatedLong = OPElementTypeClassCalculated | 0x01,
|
||||
OPElementTypeCalculatedMedium = OPElementTypeClassCalculated | 0x02,
|
||||
OPElementTypeCalculatedShort = OPElementTypeClassCalculated | 0x03,
|
||||
OPElementTypeCalculatedBasic = OPElementTypeClassCalculated | 0x04,
|
||||
OPElementTypeCalculatedPIN = OPElementTypeClassCalculated | 0x05,
|
||||
|
||||
OPElementTypeStoredPersonal = OPElementTypeClassStored | 0x01,
|
||||
OPElementTypeStoredDevicePrivate = OPElementTypeClassStored | 0x02,
|
||||
} OPElementType;
|
||||
|
||||
NSString *NSStringFromOPElementType(OPElementType type);
|
||||
NSString *ClassNameFromOPElementType(OPElementType type);
|
||||
Class ClassFromOPElementType(OPElementType type);
|
||||
NSString *OPCalculateContent(OPElementType type, NSString *name, NSString *keyPhrase, int counter);
|
@@ -78,18 +78,18 @@
|
||||
Tap it to <i>copy the password</i>. Once copied, you can switch to another application and paste it into a password field.
|
||||
</p>
|
||||
|
||||
<p class="Class OPElementStoredEntity">
|
||||
<p class="Class MPElementStoredEntity">
|
||||
<b>To change</b> the password for this site, tap the <i>edit icon</i> <img src="icon_edit.png" />.
|
||||
</p>
|
||||
<p>
|
||||
<b>Below the password</b> you can set the <i>password type</i>. Some types <i>create a password for you</i>,
|
||||
others let you <i>choose your own</i>.
|
||||
</p>
|
||||
<p class="Class OPElementGeneratedEntity">
|
||||
<p class="Class MPElementGeneratedEntity">
|
||||
<b>If the site complains</b> when you try to set or update the password, try changing the password type.
|
||||
</p>
|
||||
|
||||
<p class="Class OPElementGeneratedEntity">
|
||||
<p class="Class MPElementGeneratedEntity">
|
||||
<b>To create another</b> password for this site, you can increment the <i>password counter</i> <img src="icon_plus.png" />.
|
||||
This is useful, for example, when you've had to share the password with somebody else.
|
||||
</p>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>OPElementGeneratedEntity</key>
|
||||
<key>MPElementGeneratedEntity</key>
|
||||
<dict>
|
||||
<key>Long Password</key>
|
||||
<array>
|
||||
@@ -30,7 +30,7 @@
|
||||
<string>nnnn</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>OPCharacterClasses</key>
|
||||
<key>MPCharacterClasses</key>
|
||||
<dict>
|
||||
<key>V</key>
|
||||
<string>AEIOU</string>
|
||||
|
@@ -8,11 +8,11 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "OPAppDelegate.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([OPAppDelegate class]));
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MPAppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
//
|
||||
// types.c
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 02/01/12.
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
Reference in New Issue
Block a user