aboutsummaryrefslogtreecommitdiff
path: root/lib/crypto/qolmerrors.cpp
diff options
context:
space:
mode:
authorAlexey Andreyev <aa13q@ya.ru>2021-01-28 23:51:56 +0300
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commitd72f220e3e3a3b243fdafd93d1405f8207dc516a (patch)
treef4306b6397e39d6842a29f9a31fe5c858be8a4af /lib/crypto/qolmerrors.cpp
parent9f71b2a79fba7c5d5ce09ebfdd482c8c470203d9 (diff)
downloadlibquotient-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/qolmerrors.cpp')
-rw-r--r--lib/crypto/qolmerrors.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/crypto/qolmerrors.cpp b/lib/crypto/qolmerrors.cpp
new file mode 100644
index 00000000..f407383e
--- /dev/null
+++ b/lib/crypto/qolmerrors.cpp
@@ -0,0 +1,21 @@
+// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
+// SPDX-License-Identifier: LGPL-2.1-or-later
+#ifdef Quotient_E2EE_ENABLED
+#include "qolmerrors.h"
+
+Quotient::QOlmError Quotient::fromString(const std::string &error_raw) {
+ if (error_raw.compare("BAD_ACCOUNT_KEY")) {
+ return QOlmError::BadAccountKey;
+ } else if (error_raw.compare("BAD_MESSAGE_KEY_ID")) {
+ return QOlmError::BadMessageKeyId;
+ } else if (error_raw.compare("INVALID_BASE64")) {
+ return QOlmError::InvalidBase64;
+ } else if (error_raw.compare("NOT_ENOUGH_RANDOM")) {
+ return QOlmError::NotEnoughRandom;
+ } else if (error_raw.compare("OUTPUT_BUFFER_TOO_SMALL")) {
+ return QOlmError::OutputBufferTooSmall;
+ } else {
+ return QOlmError::Unknown;
+ }
+}
+#endif