aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index cd4c9838..6ed116c4 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -837,7 +837,6 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents)
qCDebug(E2EE) << "Unsupported algorithm" << event.id() << "for event" << event.algorithm();
return;
}
- qWarning() << event.fullJson();
const auto decryptedEvent = sessionDecryptMessage(event);
if(!decryptedEvent) {
qCWarning(E2EE) << "Failed to decrypt event" << event.id();
@@ -2062,3 +2061,14 @@ QString Connection::e2eeDataDir() const
dir.mkpath(path);
return path;
}
+
+QJsonObject Connection::decryptNotification(const QJsonObject &notification)
+{
+ auto room = provideRoom(notification["room_id"].toString());
+ auto event = makeEvent<EncryptedEvent>(notification["event"].toObject());
+ auto decrypted = room->decryptMessage(*event);
+ if(!decrypted) {
+ return QJsonObject();
+ }
+ return decrypted->fullJson();
+}