Browse Source

Merge branch 'APPLEMAIL-35'

* APPLEMAIL-35:
  APPLEMAIL-35 Delete unused code.
  APPLEMAIL-35 Delete unused code.
  APPLEMAIL-35 Small refactor.
  APPLEMAIL-35 Add decrypt method to service.
APPLEMAIL-55
David Alarcon 1 year ago
parent
commit
1d7e5033fb
3 changed files with 61 additions and 0 deletions
  1. +26
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/XPCService/PEPObjCAdapterXPCApiClientService.m
  2. +30
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCService/XPCService/PEPObjCAdapterXPCApi.m
  3. +5
    -0
      Subprojects/PEPObjCAdapterXPCService/Shared/PEPObjCAdapterXpcApiProtocol.h

+ 26
- 0
Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/XPCService/PEPObjCAdapterXPCApiClientService.m View File

@ -129,4 +129,30 @@ successCallback:(nonnull void (^)(PEPIdentity * _Nonnull))successCallback {
return color;
}
- (void)decryptMessage:(PEPMessage *)message
flags:(PEPDecryptFlags)flags
extraKeys:(PEPStringList *_Nullable)extraKeys
errorCallback:(void (^)(NSError *error))errorCallback
successCallback:(void (^)(PEPMessage *srcMessage,
PEPMessage *dstMessage,
PEPStringList *keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] decryptMessage:message
flags:flags
extraKeys:extraKeys
resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
PEPMessage *srcMessage = result.result[0];
PEPMessage *dstMessage = result.result[1];
PEPStringList *keyList = result.result[2];
PEPRating rating = [(NSNumber *)result.result[3] intValue];
PEPDecryptFlags flags = [(NSNumber *)result.result[4] intValue];
BOOL isFormerlyEncryptedReuploadedMessage = [(NSNumber *)result.result[5] intValue];
successCallback(srcMessage, dstMessage, keyList, rating, flags, isFormerlyEncryptedReuploadedMessage);
}];
}
@end

+ 30
- 0
Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCService/XPCService/PEPObjCAdapterXPCApi.m View File

@ -95,4 +95,34 @@
}];
}
- (void)decryptMessage:(PEPMessage *)message
flags:(PEPDecryptFlags)flags
extraKeys:(PEPStringList *)extraKeys
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
PEPSession *session = [PEPSession new];
[session decryptMessage:message flags:flags extraKeys:extraKeys errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^(PEPMessage * _Nonnull srcMessage,
PEPMessage * _Nonnull dstMessage,
PEPStringList * _Nonnull keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[srcMessage,
dstMessage,
keyList,
@(rating),
@(flags),
@(isFormerlyEncryptedReuploadedMessage)]
error:nil];
resultCallback(result);
}];
}
@end

+ 5
- 0
Subprojects/PEPObjCAdapterXPCService/Shared/PEPObjCAdapterXpcApiProtocol.h View File

@ -35,6 +35,11 @@ NS_ASSUME_NONNULL_BEGIN
extraKeys:(PEPStringList *_Nullable)extraKeys
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)decryptMessage:(PEPMessage *)message
flags:(PEPDecryptFlags)flags
extraKeys:(PEPStringList *_Nullable)extraKeys
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
@end
NS_ASSUME_NONNULL_END

Loading…
Cancel
Save