aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-05-16 20:46:34 +0200
committerTobias Fella <fella@posteo.de>2022-05-16 20:46:34 +0200
commit3eb7ad8b0a1ac0f6f9cda679108937a01268f184 (patch)
tree65ff603d112a01bc1057e3b7eaaf4e7530b948cc /lib/connection.cpp
parent20bd96ac67c06617e619460c4cd07b5e15cc74d7 (diff)
downloadlibquotient-3eb7ad8b0a1ac0f6f9cda679108937a01268f184.tar.gz
libquotient-3eb7ad8b0a1ac0f6f9cda679108937a01268f184.zip
Save and load outgoing megolm session
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index a66a4168..b11ec731 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -2247,7 +2247,6 @@ bool Connection::hasOlmSession(User* user, const QString& deviceId) const
QPair<QOlmMessage::Type, QByteArray> Connection::olmEncryptMessage(User* user, const QString& device, const QByteArray& message)
{
//TODO be smarter about choosing a session; see e2ee impl guide
- //TODO create session?
const auto& curveKey = curveKeyForUserDevice(user->id(), device);
QOlmMessage::Type type = d->olmSessions[curveKey][0]->encryptMessageType();
auto result = d->olmSessions[curveKey][0]->encrypt(message);
@@ -2266,4 +2265,14 @@ void Connection::createOlmSession(const QString& theirIdentityKey, const QString
d->olmSessions[theirIdentityKey].push_back(std::move(std::get<std::unique_ptr<QOlmSession>>(session)));
}
+QOlmOutboundGroupSessionPtr Connection::loadCurrentOutboundMegolmSession(Room* room)
+{
+ return d->database->loadCurrentOutboundMegolmSession(room->id(), d->picklingMode);
+}
+
+void Connection::saveCurrentOutboundMegolmSession(Room *room, const QOlmOutboundGroupSessionPtr& data)
+{
+ d->database->saveCurrentOutboundMegolmSession(room->id(), d->picklingMode, data);
+}
+
#endif