Skip to content

Commit

Permalink
Fixed errors while rebasing to latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius Zint committed Feb 14, 2021
1 parent 484b5e4 commit 02b3fc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 1 addition & 9 deletions MacPass/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ - (void)_mergeWithContentsFromURL:(NSURL *)url key:(KPKCompositeKey *)key option
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!
Expand Down Expand Up @@ -503,11 +499,7 @@ - (void)_lockDatabaseForDocument:(NSDocument *)document didSave:(BOOL)didSave co

- (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);
Expand Down
6 changes: 5 additions & 1 deletion MacPass/MPPasswordInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ - (IBAction)_submit:(id)sender {
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) {
Expand Down

0 comments on commit 02b3fc2

Please sign in to comment.