Created
May 18, 2023 16:02
-
-
Save marcinwasowicz/b90db78cb695e658ca3e2b1e1fd85c75 to your computer and use it in GitHub Desktop.
Decrypt encrypted field in Android notification
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/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java | |
index ca11afb8e..063be32bd 100644 | |
--- a/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java | |
+++ b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java | |
@@ -21,6 +21,7 @@ import app.comm.android.fbjni.CommSecureStore; | |
import app.comm.android.fbjni.GlobalDBSingleton; | |
import app.comm.android.fbjni.MessageOperationsUtilities; | |
import app.comm.android.fbjni.NetworkModule; | |
+import app.comm.android.fbjni.NotificationsCryptoModule; | |
import app.comm.android.fbjni.ThreadOperations; | |
import com.google.firebase.messaging.FirebaseMessagingService; | |
import com.google.firebase.messaging.RemoteMessage; | |
@@ -112,6 +113,16 @@ public class CommNotificationsHandler extends FirebaseMessagingService { | |
Log.w("COMM", "Database not existing yet. Skipping notification"); | |
} | |
+ String encryptedSample = message.getData().get("encryptedSample"); | |
+ if (encryptedSample != null) { | |
+ String decryptedSample = NotificationsCryptoModule.decrypt( | |
+ encryptedSample, | |
+ NotificationsCryptoModule.olmEncryptedTypeMessage(), | |
+ "CommNotificationsHandler"); | |
+ Log.w("COMM", "Encrypted sample: " + encryptedSample); | |
+ Log.w("COMM", "Decrypted sample: " + decryptedSample); | |
+ } | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment