diff options
author | Alexey Andreyev <aa13q@ya.ru> | 2021-01-28 23:51:56 +0300 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:34:52 +0100 |
commit | d72f220e3e3a3b243fdafd93d1405f8207dc516a (patch) | |
tree | f4306b6397e39d6842a29f9a31fe5c858be8a4af /lib/crypto/qolmmessage.cpp | |
parent | 9f71b2a79fba7c5d5ce09ebfdd482c8c470203d9 (diff) | |
download | libquotient-d72f220e3e3a3b243fdafd93d1405f8207dc516a.tar.gz libquotient-d72f220e3e3a3b243fdafd93d1405f8207dc516a.zip |
E2EE: initial port to internal olm wrapper
Remove qtolm git module. Update CMakeLists.txt.
Rename olm to crypto subdir to prevent disambiguation. Rename internal
files accordingly. Comment out not ported E2EE API usage.
Diffstat (limited to 'lib/crypto/qolmmessage.cpp')
-rw-r--r-- | lib/crypto/qolmmessage.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/crypto/qolmmessage.cpp b/lib/crypto/qolmmessage.cpp new file mode 100644 index 00000000..ae98d52f --- /dev/null +++ b/lib/crypto/qolmmessage.cpp @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2021 Alexey Andreyev <aa13q@ya.ru> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifdef Quotient_E2EE_ENABLED +#include "qolmmessage.h" + +using namespace Quotient; + +QOlmMessage::QOlmMessage(const QByteArray &ciphertext, QOlmMessage::Type type) + : QByteArray(std::move(ciphertext)) + , m_messageType(type) +{ + Q_ASSERT_X(!ciphertext.isEmpty(), "olm message", "Ciphertext is empty"); +} + +QOlmMessage::QOlmMessage(const QOlmMessage &message) + : QByteArray(message) + , m_messageType(message.type()) +{ +} + +QOlmMessage::Type QOlmMessage::type() const +{ + return m_messageType; +} + +QByteArray QOlmMessage::toCiphertext() const +{ + return QByteArray(*this); +} + +QOlmMessage QOlmMessage::fromCiphertext(const QByteArray &ciphertext) +{ + return QOlmMessage(ciphertext, QOlmMessage::General); +} + + +#endif // Quotient_E2EE_ENABLED + + + |