aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/e2ee.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/e2ee/e2ee.h')
-rw-r--r--lib/e2ee/e2ee.h36
1 files changed, 10 insertions, 26 deletions
diff --git a/lib/e2ee/e2ee.h b/lib/e2ee/e2ee.h
index 0772b70a..51ceff67 100644
--- a/lib/e2ee/e2ee.h
+++ b/lib/e2ee/e2ee.h
@@ -6,21 +6,20 @@
#pragma once
#include "converters.h"
-#include "expected.h"
-#include "qolmerrors.h"
#include <QtCore/QMetaType>
#include <QtCore/QStringBuilder>
#include <array>
-#include <variant>
-namespace Quotient {
+#ifdef Quotient_E2EE_ENABLED
+# include "expected.h"
+
+# include <olm/error.h>
+# include <variant>
+#endif
-constexpr auto CiphertextKeyL = "ciphertext"_ls;
-constexpr auto SenderKeyKeyL = "sender_key"_ls;
-constexpr auto DeviceIdKeyL = "device_id"_ls;
-constexpr auto SessionIdKeyL = "session_id"_ls;
+namespace Quotient {
constexpr auto AlgorithmKeyL = "algorithm"_ls;
constexpr auto RotationPeriodMsKeyL = "rotation_period_ms"_ls;
@@ -47,6 +46,7 @@ inline bool isSupportedAlgorithm(const QString& algorithm)
!= SupportedAlgorithms.cend();
}
+#ifdef Quotient_E2EE_ENABLED
struct Unencrypted {};
struct Encrypted {
QByteArray key;
@@ -64,7 +64,8 @@ class QOlmOutboundGroupSession;
using QOlmOutboundGroupSessionPtr = std::unique_ptr<QOlmOutboundGroupSession>;
template <typename T>
-using QOlmExpected = Expected<T, QOlmError>;
+using QOlmExpected = Expected<T, OlmErrorCode>;
+#endif
struct IdentityKeys
{
@@ -133,23 +134,6 @@ private:
using OneTimeKeys = QHash<QString, std::variant<QString, SignedOneTimeKey>>;
-template <typename T>
-class asKeyValueRange
-{
-public:
- asKeyValueRange(T& data)
- : m_data { data }
- {}
-
- auto begin() { return m_data.keyValueBegin(); }
- auto end() { return m_data.keyValueEnd(); }
-
-private:
- T &m_data;
-};
-template <typename T>
-asKeyValueRange(T&) -> asKeyValueRange<T>;
-
} // namespace Quotient
Q_DECLARE_METATYPE(Quotient::SignedOneTimeKey)