aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-08-20 19:18:17 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-08-25 19:48:33 +0200
commit2e1f179bf75da9705963be9305ab6db34afa4d6d (patch)
treed650fd4fc50c75c2e3571ad39103e25c84fe0ac7 /lib/events
parent1c94d1b41eb352b31b2dc915fea95e26f6138284 (diff)
downloadlibquotient-2e1f179bf75da9705963be9305ab6db34afa4d6d.tar.gz
libquotient-2e1f179bf75da9705963be9305ab6db34afa4d6d.zip
Connection::Private::assembleEncryptedContent()
What was partially factored out before into encryptSessionKeyEvent() is now the complete algorithm converting any event json into encrypted content.
Diffstat (limited to 'lib/events')
-rw-r--r--lib/events/roomkeyevent.cpp21
-rw-r--r--lib/events/roomkeyevent.h3
2 files changed, 10 insertions, 14 deletions
diff --git a/lib/events/roomkeyevent.cpp b/lib/events/roomkeyevent.cpp
index 68962950..3a8601d1 100644
--- a/lib/events/roomkeyevent.cpp
+++ b/lib/events/roomkeyevent.cpp
@@ -5,21 +5,18 @@
using namespace Quotient;
-RoomKeyEvent::RoomKeyEvent(const QJsonObject &obj) : Event(typeId(), obj)
+RoomKeyEvent::RoomKeyEvent(const QJsonObject &obj) : Event(TypeId, obj)
{
if (roomId().isEmpty())
qCWarning(E2EE) << "Room key event has empty room id";
}
-RoomKeyEvent::RoomKeyEvent(const QString& algorithm, const QString& roomId, const QString& sessionId, const QString& sessionKey, const QString& senderId)
- : Event(typeId(), {
- {"content", QJsonObject{
- {"algorithm", algorithm},
- {"room_id", roomId},
- {"session_id", sessionId},
- {"session_key", sessionKey},
- }},
- {"sender", senderId},
- {"type", "m.room_key"},
- })
+RoomKeyEvent::RoomKeyEvent(const QString& algorithm, const QString& roomId,
+ const QString& sessionId, const QString& sessionKey)
+ : Event(TypeId, basicJson(TypeId, {
+ { "algorithm", algorithm },
+ { "room_id", roomId },
+ { "session_id", sessionId },
+ { "session_key", sessionKey },
+ }))
{}
diff --git a/lib/events/roomkeyevent.h b/lib/events/roomkeyevent.h
index 9eb2854b..0dfdf383 100644
--- a/lib/events/roomkeyevent.h
+++ b/lib/events/roomkeyevent.h
@@ -13,8 +13,7 @@ public:
explicit RoomKeyEvent(const QJsonObject& obj);
explicit RoomKeyEvent(const QString& algorithm, const QString& roomId,
- const QString& sessionId, const QString& sessionKey,
- const QString& senderId);
+ const QString& sessionId, const QString& sessionKey);
QUO_CONTENT_GETTER(QString, algorithm)
QUO_CONTENT_GETTER(QString, roomId)