Created
May 11, 2023 14:25
-
-
Save marcinwasowicz/0a43950fb202f03b3c5b92fe17dd5272 to your computer and use it in GitHub Desktop.
NSE decrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/native/ios/NotificationService/NotificationService.mm b/native/ios/NotificationService/NotificationService.mm | |
index 7a8474632..7d7111261 100644 | |
--- a/native/ios/NotificationService/NotificationService.mm | |
+++ b/native/ios/NotificationService/NotificationService.mm | |
@@ -1,5 +1,6 @@ | |
#import "NotificationService.h" | |
#import "Logger.h" | |
+#import "NotificationsCryptoModule.h" | |
#import "TemporaryMessageStorage.h" | |
NSString *const backgroundNotificationTypeKey = @"backgroundNotifType"; | |
@@ -26,6 +27,34 @@ CFStringRef newMessageInfosDarwinNotification = | |
self.contentHandler = contentHandler; | |
self.bestAttemptContent = [request.content mutableCopy]; | |
+ const std::string encryptedBody = | |
+ std::string([self.bestAttemptContent.body UTF8String]); | |
+ std::string decryptedBody = | |
+ comm::NotificationsCryptoModule::decrypt(encryptedBody, 1, "NSE"); | |
+ self.bestAttemptContent.body = | |
+ [NSString stringWithUTF8String:decryptedBody.c_str()]; | |
+ | |
+ const std::string encryptedThreadID = | |
+ std::string([self.bestAttemptContent.threadIdentifier UTF8String]); | |
+ std::string decryptedThreadID = | |
+ comm::NotificationsCryptoModule::decrypt(encryptedThreadID, 1, "NSE"); | |
+ self.bestAttemptContent.threadIdentifier = | |
+ [NSString stringWithUTF8String:decryptedThreadID.c_str()]; | |
+ | |
+ const std::string encryptedMessageInfos = std::string( | |
+ [self.bestAttemptContent.userInfo[@"messageInfos"] UTF8String]); | |
+ std::string decryptedMessageInfos = | |
+ comm::NotificationsCryptoModule::decrypt(encryptedMessageInfos, 1, "NSE"); | |
+ NSMutableDictionary *mutableUserInfo = | |
+ [self.bestAttemptContent.userInfo mutableCopy]; | |
+ mutableUserInfo[@"messageInfos"] = | |
+ [NSString stringWithUTF8String:decryptedMessageInfos.c_str()]; | |
+ self.bestAttemptContent.userInfo = mutableUserInfo; | |
+ | |
+ comm::Logger::log(encryptedBody); | |
+ comm::Logger::log(encryptedThreadID); | |
+ comm::Logger::log(encryptedMessageInfos); | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment