From cddab50ca80944203930255e37e825abb47a272b Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 10 Jun 2021 15:22:15 +0200 Subject: Finish writing TestOlmAccount::signatureValid --- autotests/testolmaccount.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/autotests/testolmaccount.cpp b/autotests/testolmaccount.cpp index 1c296db9..1bd63a48 100644 --- a/autotests/testolmaccount.cpp +++ b/autotests/testolmaccount.cpp @@ -4,6 +4,7 @@ #include "testolmaccount.h" #include "crypto/qolmaccount.h" +#include "crypto/qolmutility.h" #include "connection.h" #include "events/encryptedfile.h" #include "networkaccessmanager.h" @@ -47,12 +48,12 @@ void TestOlmAccount::signatureValid() const auto signature = olmAccount.sign(message); QVERIFY(QByteArray::fromBase64Encoding(signature).decodingStatus == QByteArray::Base64DecodingStatus::Ok); - //let utility = OlmUtility::new(); - //let identity_keys = olm_account.parsed_identity_keys(); - //let ed25519_key = identity_keys.ed25519(); - //assert!(utility - // .ed25519_verify(&ed25519_key, message, &signature) - // .unwrap()); + QOlmUtility utility; + const auto identityKeys = olmAccount.identityKeys(); + const auto ed25519Key = identityKeys.ed25519; + const auto verify = utility.ed25519Verify(ed25519Key, message, signature); + QVERIFY(std::holds_alternative(verify)); + QVERIFY(std::get(verify) == true); } void TestOlmAccount::oneTimeKeysValid() @@ -341,7 +342,7 @@ void TestOlmAccount::claimKeys() QVariantMap varMap = oneTimeKey.toMap(); bool found = false; - for (const auto key : varMap.keys()) { + for (const auto &key : varMap.keys()) { if (key.startsWith(QStringLiteral("signed_curve25519"))) { found = true; } -- cgit v1.2.3