diff options
author | Tobias Fella <fella@posteo.de> | 2022-03-02 00:54:49 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2022-03-10 19:45:45 +0100 |
commit | 658e6db49364862be1ab8e264b03dc04a7bed721 (patch) | |
tree | 26015547f170b4bd9691fb88d2befd023c7bfe63 /lib/connection.h | |
parent | 4f137493f026afba2299ae5b65ef6eb17939aece (diff) | |
download | libquotient-658e6db49364862be1ab8e264b03dc04a7bed721.tar.gz libquotient-658e6db49364862be1ab8e264b03dc04a7bed721.zip |
Implement sending encrypted messages
Diffstat (limited to 'lib/connection.h')
-rw-r--r-- | lib/connection.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/connection.h b/lib/connection.h index a4986b06..5ea7c5f1 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, @@ -319,6 +320,12 @@ public: Database* database(); UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> loadRoomMegolmSessions(Room* room); void saveMegolmSession(Room* room, const QString& senderKey, QOlmInboundGroupSession* session, const QString& ed25519Key); + 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; |