aboutsummaryrefslogtreecommitdiff
path: root/autotests/testolmsession.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'autotests/testolmsession.cpp')
-rw-r--r--autotests/testolmsession.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/autotests/testolmsession.cpp b/autotests/testolmsession.cpp
index 6fa2a380..2f7a82e9 100644
--- a/autotests/testolmsession.cpp
+++ b/autotests/testolmsession.cpp
@@ -26,7 +26,7 @@ std::pair<std::unique_ptr<QOlmSession>, std::unique_ptr<QOlmSession>> createSess
const auto preKey = outbound->encrypt(""); // Payload does not matter for PreKey
- if (preKey.type() != Message::General) {
+ if (preKey.type() != Message::PreKey) {
throw "Wrong first message type received, can't create session";
}
auto inbound = std::get<std::unique_ptr<QOlmSession>>(accountB.createInboundSession(preKey));
@@ -42,4 +42,20 @@ void TestOlmSession::olmOutboundSessionCreation()
#endif
}
+void TestOlmSession::olmEncryptDecrypt()
+{
+#ifdef Quotient_E2EE_ENABLED
+ const auto [inboundSession, outboundSession] = createSessionPair();
+ const auto encrypted = outboundSession->encrypt("Hello world!");
+ if (encrypted.type() == Message::PreKey) {
+ Message m(encrypted); // clone
+ QVERIFY(std::get<bool>(inboundSession->matchesInboundSession(m)));
+ }
+
+ //const auto decrypted = inboundSession->decrypt(encrypted);
+
+ //QCOMPARE(decrypted, "Hello world!");
+#endif
+}
+
QTEST_MAIN(TestOlmSession)