aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-03-02 00:54:49 +0100
committerTobias Fella <fella@posteo.de>2022-05-16 20:41:50 +0200
commit20bd96ac67c06617e619460c4cd07b5e15cc74d7 (patch)
treef825cd1be86530954ff4c04da2c8b639a981cde3 /lib/connection.h
parentff54bf2d0979dc6b9b3b77bba827ae7f3baa9f58 (diff)
downloadlibquotient-20bd96ac67c06617e619460c4cd07b5e15cc74d7.tar.gz
libquotient-20bd96ac67c06617e619460c4cd07b5e15cc74d7.zip
Implement sending encrypted messages
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/connection.h b/lib/connection.h
index b75bd5b5..afa4a657 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -24,6 +24,7 @@
#ifdef Quotient_E2EE_ENABLED
#include "e2ee/e2ee.h"
+#include "e2ee/qolmmessage.h"
#endif
Q_DECLARE_METATYPE(Quotient::GetLoginFlowsJob::LoginFlow)
@@ -132,7 +133,7 @@ class QUOTIENT_API Connection : public QObject {
public:
using UsersToDevicesToEvents =
- UnorderedMap<QString, UnorderedMap<QString, const Event&>>;
+ UnorderedMap<QString, UnorderedMap<QString, std::unique_ptr<Event>>>;
enum RoomVisibility {
PublishRoom,
@@ -321,6 +322,12 @@ public:
const Room* room);
void saveMegolmSession(const Room* room,
const QOlmInboundGroupSession& session);
+ bool hasOlmSession(User* user, const QString& deviceId) const;
+
+ //This currently assumes that an olm session with (user, device) exists
+ //TODO make this return an event?
+ QPair<QOlmMessage::Type, QByteArray> olmEncryptMessage(User* user, const QString& device, const QByteArray& message);
+ void createOlmSession(const QString& theirIdentityKey, const QString& theirOneTimeKey);
#endif // Quotient_E2EE_ENABLED
Q_INVOKABLE Quotient::SyncJob* syncJob() const;
Q_INVOKABLE int millisToReconnect() const;