|
@@ -847,8 +847,9 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
|
|
|
#pragma mark - End-to-End Encryption
|
|
|
|
|
|
-- (void)getEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
- failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
+// curl -X GET http://<user>:<password>@nextcloud/ocs/v2.php/apps/end_to_end_encryption/api/v1/public-key -H "OCS-APIRequest:true"
|
|
|
+- (void)getEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
+ failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
|
|
|
_requestMethod = @"GET";
|
|
|
|
|
@@ -862,7 +863,8 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
[operation resume];
|
|
|
}
|
|
|
|
|
|
-- (void)getEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
+// curl -X GET http://<user>:<password>@nextcloud/ocs/v2.php/apps/end_to_end_encryption/api/v1/private-key -H "OCS-APIRequest:true"
|
|
|
+- (void)getEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
|
|
|
_requestMethod = @"GET";
|
|
@@ -899,6 +901,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
[operation resume];
|
|
|
}
|
|
|
|
|
|
+// curl -X POST http://<user>:<password>@nextcloud/ocs/v2.php/apps/end_to_end_encryption/api/v1/private-key -d privateKey="<urlencoded-private-key>" -H "OCS-APIRequest:true"
|
|
|
- (void)storeEndToEndPrivateKey:(NSString*)serverPath privateKey:(NSString *)privateKey onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
|
|
@@ -920,6 +923,38 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
[operation resume];
|
|
|
}
|
|
|
|
|
|
+// curl -X DELETE http://<user>:<password>@nextcloud/ocs/v2.php/apps/end_to_end_encryption/api/v1/public-key -H "OCS-APIRequest:true"
|
|
|
+- (void)deleteEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
+ failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
+
|
|
|
+ _requestMethod = @"DELETE";
|
|
|
+
|
|
|
+ NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
|
|
|
+ serverPath = [serverPath stringByAppendingString:jsonQuery];
|
|
|
+
|
|
|
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
|
|
|
+
|
|
|
+ OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
|
|
|
+ [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
|
|
|
+ [operation resume];
|
|
|
+}
|
|
|
+
|
|
|
+// curl -X DELETE http://<user>:<password>@nextcloud/ocs/v2.php/apps/end_to_end_encryption/api/v1/private-key -H "OCS-APIRequest:true"
|
|
|
+- (void)deleteEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
|
|
|
+ failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
|
|
|
+
|
|
|
+ _requestMethod = @"DELETE";
|
|
|
+
|
|
|
+ NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
|
|
|
+ serverPath = [serverPath stringByAppendingString:jsonQuery];
|
|
|
+
|
|
|
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
|
|
|
+
|
|
|
+ OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
|
|
|
+ [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
|
|
|
+ [operation resume];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Manage Redirections
|
|
|
|
|
|
- (void) setRedirectionBlockOnDatataskWithOCCommunication: (OCCommunication *) sharedOCCommunication andSessionManager:(AFURLSessionManager *) sessionManager{
|