aboutsummaryrefslogtreecommitdiff
path: root/lib/olm/qolmaccount.cpp
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-01-24 01:45:43 +0100
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commit8706c055e69b01097b702403aaa0d222e5ab0d29 (patch)
tree063534b589d598a14af2018c516ce5eb992399ff /lib/olm/qolmaccount.cpp
parentc8d67f737e84bbec98a54fc19a8aa56dbc39d542 (diff)
downloadlibquotient-8706c055e69b01097b702403aaa0d222e5ab0d29.tar.gz
libquotient-8706c055e69b01097b702403aaa0d222e5ab0d29.zip
Implement outboundsession
Diffstat (limited to 'lib/olm/qolmaccount.cpp')
-rw-r--r--lib/olm/qolmaccount.cpp27
1 files changed, 1 insertions, 26 deletions
diff --git a/lib/olm/qolmaccount.cpp b/lib/olm/qolmaccount.cpp
index bde9b712..89d82832 100644
--- a/lib/olm/qolmaccount.cpp
+++ b/lib/olm/qolmaccount.cpp
@@ -4,6 +4,7 @@
#ifdef Quotient_E2EE_ENABLED
#include "qolmaccount.h"
+#include "olm/utils.h"
#include <QJsonObject>
#include <QJsonDocument>
#include <QDebug>
@@ -24,37 +25,11 @@ std::optional<QMap<QString, QString>> OneTimeKeys::get(QString keyType) const
return keys[keyType];
}
-// Convert PicklingMode to key
-QByteArray toKey(const PicklingMode &mode)
-{
- if (std::holds_alternative<Unencrypted>(mode)) {
- return "";
- }
- return std::get<Encrypted>(mode).key;
-}
-
bool operator==(const IdentityKeys& lhs, const IdentityKeys& rhs)
{
return lhs.curve25519 == rhs.curve25519 &&& lhs.ed25519 == rhs.ed25519;
}
-// TODO use impl from errors.cpp
-OlmError fromString(const std::string &error_raw) {
- if (error_raw.compare("BAD_ACCOUNT_KEY")) {
- return OlmError::BadAccountKey;
- } else if (error_raw.compare("BAD_MESSAGE_KEY_ID")) {
- return OlmError::BadMessageKeyId;
- } else if (error_raw.compare("INVALID_BASE64")) {
- return OlmError::InvalidBase64;
- } else if (error_raw.compare("NOT_ENOUGH_RANDOM")) {
- return OlmError::NotEnoughRandom;
- } else if (error_raw.compare("OUTPUT_BUFFER_TOO_SMALL")) {
- return OlmError::OutputBufferTooSmall;
- } else {
- return OlmError::Unknown;
- }
-}
-
// Conver olm error to enum
OlmError lastError(OlmAccount *account) {
const std::string error_raw = olm_account_last_error(account);