mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 04:19:32 +00:00
Updated to current KeePassKit
This commit is contained in:
2
Cartfile
2
Cartfile
@@ -1,4 +1,4 @@
|
||||
github "sparkle-project/Sparkle" ~> 1.22
|
||||
github "MacPass/TransformerKit" "b28de3a7de9249dd886979cae4985092523b6dd1"
|
||||
github "MacPass/KeePassKit" ~> 2.4
|
||||
github "MacPass/KeePassKit" "86266c8211b19f50a55bfdfd293adc783fb0a7b1"
|
||||
github "mstarke/HNHUi" ~> 3.0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
github "MacPass/KeePassKit" "2.4.7"
|
||||
github "MacPass/KeePassKit" "86266c8211b19f50a55bfdfd293adc783fb0a7b1"
|
||||
github "MacPass/TransformerKit" "b28de3a7de9249dd886979cae4985092523b6dd1"
|
||||
github "mstarke/HNHUi" "3.0"
|
||||
github "robbiehanson/KissXML" "5.3.1"
|
||||
github "sparkle-project/Sparkle" "1.22.0"
|
||||
github "sparkle-project/Sparkle" "v1.23.0"
|
||||
|
||||
@@ -227,7 +227,7 @@ typedef NS_OPTIONS(NSInteger, MPAppStartupState) {
|
||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||
if(menu == self.saveMenuItem.menu) {
|
||||
MPDocument *document = NSDocumentController.sharedDocumentController.currentDocument;
|
||||
BOOL displayDots = (document.fileURL == nil || !document.compositeKey.hasPasswordOrKeyFile);
|
||||
BOOL displayDots = (document.fileURL == nil || !document.compositeKey.hasKeys);
|
||||
NSString *saveTitle = displayDots ? NSLocalizedString(@"SAVE_WITH_DOTS", "Save file menu item title when save will prompt for a location to save or ask for a password/key") : NSLocalizedString(@"SAVE", "Save file menu item title when save will just save the file");
|
||||
self.saveMenuItem.title = saveTitle;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
if(self.encryptedData) {
|
||||
return YES;
|
||||
}
|
||||
if(self.compositeKey.hasPasswordOrKeyFile) {
|
||||
if(self.compositeKey.hasKeys) {
|
||||
return YES; // key is set, so autosave should be save
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
NSLog(@"%@ should not be called on locked databases!", NSStringFromSelector(_cmd));
|
||||
return self.encryptedData;
|
||||
}
|
||||
if(!self.compositeKey.hasPasswordOrKeyFile) {
|
||||
if(!self.compositeKey.hasKeys) {
|
||||
if(outError != NULL) {
|
||||
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(@"WARNING_ON_SAVE_NO_PASSWORD_OR_KEY_SET", "") };
|
||||
*outError = [NSError errorWithDomain:MPDefaultErrorDomain code:0 userInfo:userInfo];
|
||||
@@ -421,7 +421,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
[self.windowForSheet endSheet:sheet returnCode:(didCancel ? NSModalResponseCancel : NSModalResponseOK)];
|
||||
if(!didCancel) {
|
||||
NSData *keyFileData = keyURL ? [NSData dataWithContentsOfURL:keyURL] : nil;
|
||||
KPKCompositeKey *compositeKey = [[KPKCompositeKey alloc] initWithPassword:password keyFileData:keyFileData];
|
||||
KPKCompositeKey *compositeKey = [[KPKCompositeKey alloc] init];
|
||||
[compositeKey addKey:[KPKKey keyWithPassword:password]];
|
||||
[compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]];
|
||||
[self _mergeWithContentsFromURL:url key:compositeKey options:options];
|
||||
}
|
||||
// just return yes regardless since we will display the sheet again if needed!
|
||||
@@ -490,7 +492,10 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error{
|
||||
// TODO: Make this API asynchronous
|
||||
NSData *keyFileData = keyFileURL ? [NSData dataWithContentsOfURL:keyFileURL] : nil;
|
||||
self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password keyFileData:keyFileData];
|
||||
|
||||
self.compositeKey = [[KPKCompositeKey alloc] init];
|
||||
[self.compositeKey addKey:[KPKKey keyWithPassword:password]];
|
||||
[self.compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]];
|
||||
self.tree = [[KPKTree alloc] initWithData:self.encryptedData key:self.compositeKey error:error];
|
||||
|
||||
BOOL isUnlocked = (nil != self.tree);
|
||||
@@ -514,13 +519,11 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
return NO;
|
||||
}
|
||||
NSData *keyFileData = keyFileURL ? [NSData dataWithContentsOfURL:keyFileURL] : nil;
|
||||
if(!self.compositeKey) {
|
||||
self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password keyFileData:keyFileData];
|
||||
}
|
||||
else {
|
||||
[self.compositeKey setPassword:password andKeyFileData:keyFileData];
|
||||
}
|
||||
self.tree.metaData.masterKeyChanged = [NSDate date];
|
||||
self.compositeKey = [[KPKCompositeKey alloc] init];
|
||||
[self.compositeKey addKey:[KPKKey keyWithPassword:password]];
|
||||
[self.compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]];
|
||||
|
||||
self.tree.metaData.masterKeyChanged = NSDate.date;
|
||||
/* Key change is not undoable so just recored the change as done */
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user