mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-18 02:39:30 +00:00
Some documentation added for KeePassHttp stuff
This commit is contained in:
@@ -48,11 +48,11 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="StringCell" id="269">
|
<tableCellView identifier="StringCell" id="269">
|
||||||
<rect key="frame" x="1" y="1" width="105" height="17"/>
|
<rect key="frame" x="1" y="1" width="104.5" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270">
|
||||||
<rect key="frame" x="1" y="0.0" width="103" height="17"/>
|
<rect key="frame" x="1" y="0.0" width="102.5" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="ImageCell" id="297">
|
<tableCellView identifier="ImageCell" id="297">
|
||||||
<rect key="frame" x="109" y="1" width="144" height="17"/>
|
<rect key="frame" x="108.5" y="1" width="144" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="298">
|
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="298">
|
||||||
@@ -136,11 +136,11 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="PasswordCell" id="428">
|
<tableCellView identifier="PasswordCell" id="428">
|
||||||
<rect key="frame" x="256" y="1" width="119" height="17"/>
|
<rect key="frame" x="255.5" y="1" width="118.5" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField">
|
||||||
<rect key="frame" x="1" y="0.0" width="117" height="17"/>
|
<rect key="frame" x="1" y="0.0" width="116.5" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView id="421">
|
<tableCellView id="421">
|
||||||
<rect key="frame" x="378" y="1" width="113" height="17"/>
|
<rect key="frame" x="377" y="1" width="113" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422">
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView id="616">
|
<tableCellView id="616">
|
||||||
<rect key="frame" x="494" y="1" width="198" height="17"/>
|
<rect key="frame" x="493" y="1" width="198" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617">
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
#import "HTTPConnection.h"
|
#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
|
@interface MPConnection : HTTPConnection
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ NSString *const MPRequestTypeKey = @"RequestType";
|
|||||||
|
|
||||||
|
|
||||||
- (void)_parseRequest:(NSDictionary *)aRequest {
|
- (void)_parseRequest:(NSDictionary *)aRequest {
|
||||||
|
/* TODO: generate a response */
|
||||||
NSString *requestType = aRequest[MPRequestTypeKey];
|
NSString *requestType = aRequest[MPRequestTypeKey];
|
||||||
if(!requestType) {
|
if(!requestType) {
|
||||||
NSLog(@"Malformed Request. Missing request type");
|
NSLog(@"Malformed Request. Missing request type");
|
||||||
|
|||||||
@@ -10,17 +10,30 @@
|
|||||||
|
|
||||||
@class KPKEntry;
|
@class KPKEntry;
|
||||||
@class MPDocument;
|
@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
|
@interface MPDocumentQueryService : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The MPDocument we currently use for our queries
|
||||||
|
*/
|
||||||
@property (readonly, weak) MPDocument *queryDocument;
|
@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;
|
+ (MPDocumentQueryService *)sharedService;
|
||||||
|
|
||||||
- (KPKEntry *)configurationEntry;
|
|
||||||
- (KPKEntry *)createConfigurationEntry;
|
- (KPKEntry *)createConfigurationEntry;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static NSUUID *_rootUuid = nil;
|
|||||||
@interface MPDocumentQueryService ()
|
@interface MPDocumentQueryService ()
|
||||||
|
|
||||||
@property (weak) MPDocument *queryDocument;
|
@property (weak) MPDocument *queryDocument;
|
||||||
@property (weak) KPKEntry *configEntry;
|
@property (nonatomic, weak) KPKEntry *configurationEntry;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -46,8 +46,9 @@ static NSUUID *_rootUuid = nil;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (KPKEntry *)configurationEntry {
|
- (KPKEntry *)configurationEntry {
|
||||||
if(nil != _configEntry) {
|
/* TODO: lazy getter or do something differen like init at first call? */
|
||||||
return _configEntry;
|
if(nil != _configurationEntry) {
|
||||||
|
return _configurationEntry;
|
||||||
}
|
}
|
||||||
/* no config entry there, start looking for it */
|
/* no config entry there, start looking for it */
|
||||||
NSArray *documents = [[NSDocumentController sharedDocumentController] documents];
|
NSArray *documents = [[NSDocumentController sharedDocumentController] documents];
|
||||||
@@ -59,9 +60,9 @@ static NSUUID *_rootUuid = nil;
|
|||||||
}
|
}
|
||||||
KPKEntry *configEntry = [document findEntry:_rootUuid];
|
KPKEntry *configEntry = [document findEntry:_rootUuid];
|
||||||
if(nil != configEntry) {
|
if(nil != configEntry) {
|
||||||
_configEntry = configEntry;
|
self.configurationEntry = configEntry;
|
||||||
_queryDocument = document;
|
self.queryDocument = document;
|
||||||
return _configEntry;
|
return _configurationEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
@@ -8,10 +8,23 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protocol for request handling of KeePassHttp request
|
||||||
|
*/
|
||||||
@protocol MPServerRequestHandling <NSObject>
|
@protocol MPServerRequestHandling <NSObject>
|
||||||
|
|
||||||
@required
|
@required
|
||||||
|
/**
|
||||||
|
* A unique identifier for the request handler
|
||||||
|
*
|
||||||
|
* @return NSString representing the identifier
|
||||||
|
*/
|
||||||
- (NSString *)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;
|
- (void)respondTo:(NSDictionary *)data;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user