aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmutility.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-16 17:38:34 +0200
committerGitHub <noreply@github.com>2022-05-16 17:38:34 +0200
commit77b190d822c1e980b98b84999f0cfb609ed05a49 (patch)
tree049fc3936343a7af957c0bca20dd1531ae2e5f81 /lib/e2ee/qolmutility.cpp
parent0599ef6e603dce219b2ba000d7322e8d937753b9 (diff)
parentdecc676f1e469dc26c80c33da64fad15805de8f2 (diff)
downloadlibquotient-77b190d822c1e980b98b84999f0cfb609ed05a49.tar.gz
libquotient-77b190d822c1e980b98b84999f0cfb609ed05a49.zip
Merge #550: Quotient::Expected and QOlmExpected
Diffstat (limited to 'lib/e2ee/qolmutility.cpp')
-rw-r--r--lib/e2ee/qolmutility.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/e2ee/qolmutility.cpp b/lib/e2ee/qolmutility.cpp
index 9f09a37f..84559085 100644
--- a/lib/e2ee/qolmutility.cpp
+++ b/lib/e2ee/qolmutility.cpp
@@ -3,8 +3,8 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "e2ee/qolmutility.h"
-#include "olm/olm.h"
-#include <QDebug>
+
+#include <olm/olm.h>
using namespace Quotient;
@@ -40,8 +40,9 @@ QString QOlmUtility::sha256Utf8Msg(const QString &message) const
return sha256Bytes(message.toUtf8());
}
-std::variant<bool, QOlmError> QOlmUtility::ed25519Verify(const QByteArray &key,
- const QByteArray &message, const QByteArray &signature)
+QOlmExpected<bool> QOlmUtility::ed25519Verify(const QByteArray& key,
+ const QByteArray& message,
+ const QByteArray& signature)
{
QByteArray signatureBuf(signature.length(), '0');
std::copy(signature.begin(), signature.end(), signatureBuf.begin());
@@ -57,8 +58,5 @@ std::variant<bool, QOlmError> QOlmUtility::ed25519Verify(const QByteArray &key,
return error;
}
- if (ret != 0) {
- return false;
- }
- return true;
+ return !ret; // ret == 0 means success
}