diff --git a/MacPass/EntryView.xib b/MacPass/EntryView.xib index bc11ac8f..4f82d068 100644 --- a/MacPass/EntryView.xib +++ b/MacPass/EntryView.xib @@ -48,11 +48,11 @@ - + - + @@ -86,7 +86,7 @@ - + @@ -136,11 +136,11 @@ - + - + @@ -174,7 +174,7 @@ - + @@ -212,7 +212,7 @@ - + diff --git a/MacPass/MPConnection.h b/MacPass/MPConnection.h index 6334de25..f17ec8e4 100644 --- a/MacPass/MPConnection.h +++ b/MacPass/MPConnection.h @@ -8,6 +8,10 @@ #import "HTTPConnection.h" +/** + * Default Connection to handle the KeepassHttp POST requests. The Connection doesn't do anything, + * besides using the MPRequestHandlerService to handle any request from KeePassHttp and send's back the replies + */ @interface MPConnection : HTTPConnection @end diff --git a/MacPass/MPConnection.m b/MacPass/MPConnection.m index 7dfb38ce..c7efc0a4 100644 --- a/MacPass/MPConnection.m +++ b/MacPass/MPConnection.m @@ -63,6 +63,7 @@ NSString *const MPRequestTypeKey = @"RequestType"; - (void)_parseRequest:(NSDictionary *)aRequest { + /* TODO: generate a response */ NSString *requestType = aRequest[MPRequestTypeKey]; if(!requestType) { NSLog(@"Malformed Request. Missing request type"); diff --git a/MacPass/MPDocumentQueryService.h b/MacPass/MPDocumentQueryService.h index e7bc792e..f36a9d18 100644 --- a/MacPass/MPDocumentQueryService.h +++ b/MacPass/MPDocumentQueryService.h @@ -10,17 +10,30 @@ @class KPKEntry; @class MPDocument; + /** - * Service to querey for entries + * Service for querying for resultis withing a request + * This shared instance handles creating of config entries, + * and abstracts all open documents for the KeePassHttp interface. */ @interface MPDocumentQueryService : NSObject +/** + * The MPDocument we currently use for our queries + */ @property (readonly, weak) MPDocument *queryDocument; -@property (readonly, weak) KPKEntry *configEntry; +/** + * The Config entry we did find in our query document + */ +@property (nonatomic, readonly, weak) KPKEntry *configurationEntry; +/** + * Access the shared instance of the service + * + * @return shared MPDocumentQueryService instance + */ + (MPDocumentQueryService *)sharedService; -- (KPKEntry *)configurationEntry; - (KPKEntry *)createConfigurationEntry; @end diff --git a/MacPass/MPDocumentQueryService.m b/MacPass/MPDocumentQueryService.m index 3a8985a4..3de4fd53 100644 --- a/MacPass/MPDocumentQueryService.m +++ b/MacPass/MPDocumentQueryService.m @@ -18,7 +18,7 @@ static NSUUID *_rootUuid = nil; @interface MPDocumentQueryService () @property (weak) MPDocument *queryDocument; -@property (weak) KPKEntry *configEntry; +@property (nonatomic, weak) KPKEntry *configurationEntry; @end @@ -46,8 +46,9 @@ static NSUUID *_rootUuid = nil; } - (KPKEntry *)configurationEntry { - if(nil != _configEntry) { - return _configEntry; + /* TODO: lazy getter or do something differen like init at first call? */ + if(nil != _configurationEntry) { + return _configurationEntry; } /* no config entry there, start looking for it */ NSArray *documents = [[NSDocumentController sharedDocumentController] documents]; @@ -59,9 +60,9 @@ static NSUUID *_rootUuid = nil; } KPKEntry *configEntry = [document findEntry:_rootUuid]; if(nil != configEntry) { - _configEntry = configEntry; - _queryDocument = document; - return _configEntry; + self.configurationEntry = configEntry; + self.queryDocument = document; + return _configurationEntry; } } return nil; diff --git a/MacPass/MPServerRequestHandling.h b/MacPass/MPServerRequestHandling.h index 62d53923..3b1e4025 100644 --- a/MacPass/MPServerRequestHandling.h +++ b/MacPass/MPServerRequestHandling.h @@ -8,10 +8,23 @@ #import +/** + * Protocol for request handling of KeePassHttp request + */ @protocol MPServerRequestHandling @required +/** + * A unique identifier for the request handler + * + * @return NSString representing the identifier + */ - (NSString *)identifier; +/** + * Formulate a response to the request passed in as Dictionary + * + * @param data An NSDictionary containing the parsed JSON reuest + */ - (void)respondTo:(NSDictionary *)data; @end