diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-07-31 17:33:31 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-31 17:33:31 +0900 |
commit | f5083ee71e6fad9f28c4b835899f3ad574b426f1 (patch) | |
tree | 32039492751db53d89188a403f112e6c3e068af4 /lib/events/encryptionevent.cpp | |
parent | 0df1cdcf40fd639f039f0c0e7165c8c40f6efd79 (diff) | |
parent | 2737dc00334ad3a56c1b311435dbe84453ee389e (diff) | |
download | libquotient-f5083ee71e6fad9f28c4b835899f3ad574b426f1.tar.gz libquotient-f5083ee71e6fad9f28c4b835899f3ad574b426f1.zip |
Merge pull request #335 from quotient-im/aa13q-e2ee-encrypted-msg
E2EE: introduce EncryptedEvent
Diffstat (limited to 'lib/events/encryptionevent.cpp')
-rw-r--r-- | lib/events/encryptionevent.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/events/encryptionevent.cpp b/lib/events/encryptionevent.cpp index b8e2b575..ee6c92b1 100644 --- a/lib/events/encryptionevent.cpp +++ b/lib/events/encryptionevent.cpp @@ -7,11 +7,12 @@ #include "converters.h" #include "logging.h" +#include "e2ee.h" #include <array> static const std::array<QString, 1> encryptionStrings = { { - QStringLiteral("m.megolm.v1.aes-sha2") + QMatrixClient::MegolmV1AesSha2AlgoKey } }; namespace QMatrixClient { @@ -36,9 +37,9 @@ using namespace QMatrixClient; EncryptionEventContent::EncryptionEventContent(const QJsonObject& json) : encryption(fromJson<EncryptionType>(json["algorithm"_ls])) - , algorithm(sanitized(json["algorithm"_ls].toString())) - , rotationPeriodMs(json["rotation_period_ms"_ls].toInt(604800000)) - , rotationPeriodMsgs(json["rotation_period_msgs"_ls].toInt(100)) + , algorithm(sanitized(json[AlgorithmKeyL].toString())) + , rotationPeriodMs(json[RotationPeriodMsKeyL].toInt(604800000)) + , rotationPeriodMsgs(json[RotationPeriodMsgsKeyL].toInt(100)) { } void EncryptionEventContent::fillJson(QJsonObject* o) const @@ -47,7 +48,7 @@ void EncryptionEventContent::fillJson(QJsonObject* o) const Q_ASSERT_X(encryption != EncryptionType::Undefined, __FUNCTION__, "The key 'algorithm' must be explicit in EncryptionEventContent"); if (encryption != EncryptionType::Undefined) - o->insert(QStringLiteral("algorithm"), algorithm); - o->insert(QStringLiteral("rotation_period_ms"), rotationPeriodMs); - o->insert(QStringLiteral("rotation_period_msgs"), rotationPeriodMsgs); + o->insert(AlgorithmKey, algorithm); + o->insert(RotationPeriodMsKey, rotationPeriodMs); + o->insert(RotationPeriodMsgsKey, rotationPeriodMsgs); } |