aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-08-26 08:34:09 +0200
committerGitHub <noreply@github.com>2022-08-26 08:34:09 +0200
commitb257cf4e38d540a0063f06ebdb51dcd2574cc809 (patch)
tree68e43acc8a0577110c0d03b8d04265622a895a3e /lib/connection.h
parent4ad2f6e165a4eb486155eae652e187dc4d6b7d99 (diff)
parent6404b8cd4d57468b810538da04f8017fb13ccc37 (diff)
downloadlibquotient-b257cf4e38d540a0063f06ebdb51dcd2574cc809.tar.gz
libquotient-b257cf4e38d540a0063f06ebdb51dcd2574cc809.zip
Merge #547: Implement device verification
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/connection.h b/lib/connection.h
index 0e0abc39..39921938 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -23,8 +23,9 @@
#ifdef Quotient_E2EE_ENABLED
#include "e2ee/e2ee.h"
-#include "e2ee/qolmmessage.h"
#include "e2ee/qolmoutboundsession.h"
+#include "keyverificationsession.h"
+#include "events/keyverificationevent.h"
#endif
Q_DECLARE_METATYPE(Quotient::GetLoginFlowsJob::LoginFlow)
@@ -319,17 +320,27 @@ public:
QOlmAccount* olmAccount() const;
Database* database() const;
PicklingMode picklingMode() const;
+
UnorderedMap<QString, QOlmInboundGroupSessionPtr> loadRoomMegolmSessions(
const Room* room) const;
void saveMegolmSession(const Room* room,
const QOlmInboundGroupSession& session) const;
- bool hasOlmSession(const QString& user, const QString& deviceId) const;
-
QOlmOutboundGroupSessionPtr loadCurrentOutboundMegolmSession(
const QString& roomId) const;
void saveCurrentOutboundMegolmSession(
const QString& roomId, const QOlmOutboundGroupSession& session) const;
+ QString edKeyForUserDevice(const QString& userId,
+ const QString& deviceId) const;
+ bool hasOlmSession(const QString& user, const QString& deviceId) const;
+
+ // This assumes that an olm session already exists. If it doesn't, no message is sent.
+ void sendToDevice(const QString& targetUserId, const QString& targetDeviceId,
+ Event event, bool encrypted);
+
+ /// Returns true if this megolm session comes from a verified device
+ bool isVerifiedSession(const QString& megolmSessionId) const;
+
void sendSessionKeyToDevices(const QString& roomId,
const QByteArray& sessionId,
const QByteArray& sessionKey,
@@ -689,6 +700,8 @@ public Q_SLOTS:
virtual LeaveRoomJob* leaveRoom(Room* room);
#ifdef Quotient_E2EE_ENABLED
+ void startKeyVerificationSession(const QString& deviceId);
+
void encryptionUpdate(Room *room);
#endif
@@ -850,6 +863,19 @@ Q_SIGNALS:
void turnServersChanged(const QJsonObject& servers);
void devicesListLoaded();
+#ifdef Quotient_E2EE_ENABLED
+ void incomingKeyVerificationReady(const KeyVerificationReadyEvent& event);
+ void incomingKeyVerificationStart(const KeyVerificationStartEvent& event);
+ void incomingKeyVerificationAccept(const KeyVerificationAcceptEvent& event);
+ void incomingKeyVerificationKey(const KeyVerificationKeyEvent& event);
+ void incomingKeyVerificationMac(const KeyVerificationMacEvent& event);
+ void incomingKeyVerificationDone(const KeyVerificationDoneEvent& event);
+ void incomingKeyVerificationCancel(const KeyVerificationCancelEvent& event);
+
+ void newKeyVerificationSession(KeyVerificationSession* session);
+ void sessionVerified(const QString& userId, const QString& deviceId);
+#endif
+
protected:
/**
* @brief Access the underlying ConnectionData class