From 02b3fc2945b451d0894c5ade9ae8caed4fdd7c2b Mon Sep 17 00:00:00 2001 From: Julius Zint Date: Mon, 19 Oct 2020 20:13:22 +0200 Subject: [PATCH] Fixed errors while rebasing to latest master --- MacPass/MPDocument.m | 10 +--------- MacPass/MPPasswordInputController.m | 6 +++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index aaf10707..1cf3f172 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -432,10 +432,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou completionHandler:^BOOL(KPKCompositeKey *compositeKey, NSURL* keyURL, BOOL didCancel, NSError *__autoreleasing *error) { [self.windowForSheet endSheet:sheet returnCode:(didCancel ? NSModalResponseCancel : NSModalResponseOK)]; if(!didCancel) { - NSData *keyFileData = keyURL ? [NSData dataWithContentsOfURL:keyURL] : nil; - 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! @@ -503,11 +499,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou - (BOOL)unlockWithPassword:(KPKCompositeKey *)compositeKey keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error{ // TODO: Make this API asynchronous - NSData *keyFileData = keyFileURL ? [NSData dataWithContentsOfURL:keyFileURL] : nil; - - self.compositeKey = [[KPKCompositeKey alloc] init]; - [self.compositeKey addKey:[KPKKey keyWithPassword:password]]; - [self.compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]]; + self.compositeKey = compositeKey; self.tree = [[KPKTree alloc] initWithData:self.encryptedData key:self.compositeKey error:error]; BOOL isUnlocked = (nil != self.tree); diff --git a/MacPass/MPPasswordInputController.m b/MacPass/MPPasswordInputController.m index 6fc90b59..0241b151 100644 --- a/MacPass/MPPasswordInputController.m +++ b/MacPass/MPPasswordInputController.m @@ -140,7 +140,11 @@ static NSMutableDictionary* touchIDSecuredPasswords; BOOL cancel = (sender == self.cancelButton); NSURL* keyURL = self.keyPathControl.URL; NSData *keyFileData = keyURL ? [NSData dataWithContentsOfURL:keyURL] : nil; - KPKCompositeKey *compositeKey = [[KPKCompositeKey alloc] initWithPassword:password keyFileData:keyFileData]; + KPKKey* passwordKey = [KPKKey keyWithPassword:password]; + KPKKey* fileKey = [KPKKey keyWithKeyFileData:keyFileData]; + KPKCompositeKey* compositeKey = [[KPKCompositeKey alloc] init]; + [compositeKey addKey:passwordKey]; + [compositeKey addKey:fileKey]; BOOL result = self.completionHandler(compositeKey, keyURL, cancel, &error); [self _touchIdHandleUnlockAttempt:compositeKey withResult:result]; if(cancel || result) {