aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-10-17 16:14:35 +0200
committerLinus Jahn <lnj@kaidan.im>2022-10-18 21:12:51 +0200
commitbdc2b00a1d89c20f6fe87bdb6f9eb792afeea2bb (patch)
treeb6a63721a19ebd731a65442258bf4bf4535488df /src/client
parent3b111ee6b66cf4d0f82d2a245f59fb130728cae7 (diff)
E2eeExtension: Add isEncrypted() and decryptMessage() functions
Diffstat (limited to 'src/client')
-rw-r--r--src/client/QXmppE2eeExtension.cpp25
-rw-r--r--src/client/QXmppE2eeExtension.h6
2 files changed, 30 insertions, 1 deletions
diff --git a/src/client/QXmppE2eeExtension.cpp b/src/client/QXmppE2eeExtension.cpp
index 9e98a566..52cebb48 100644
--- a/src/client/QXmppE2eeExtension.cpp
+++ b/src/client/QXmppE2eeExtension.cpp
@@ -28,6 +28,12 @@
///
///
+/// \typedef QXmppE2eeExtension::MessageDecryptResult
+///
+/// Contains the decrypted QXmppMessage, NotEncrypted or an QXmppError.
+///
+
+///
/// \typedef QXmppE2eeExtension::IqEncryptResult
///
/// Contains the XML serialized IQ stanza with encrypted contents or a
@@ -53,6 +59,13 @@
///
///
+/// \fn QXmppE2eeExtension::decryptMessage
+///
+/// Decrypts a QXmppMessage and returns the decrypted QXmppMessage. In case the message was not
+/// encrypted, QXmppE2eeExtension::NotEncrypted should be returned.
+///
+
+///
/// \fn QXmppE2eeExtension::encryptIq
///
/// Encrypts a QXmppIq and returns the serialized XML stanza with encrypted
@@ -70,3 +83,15 @@
/// element via QFuture. If the input was not encrypted,
/// QXmppE2eeExtension::NotEncrypted should be returned.
///
+
+///
+/// \fn QXmppE2eeExtension::isEncrypted(const QDomElement &)
+///
+/// Returns whether the DOM element of an IQ or message stanza is encrypted with this encryption.
+///
+
+///
+/// \fn QXmppE2eeExtension::isEncrypted(const QXmppMessage &)
+///
+/// Returns whether the message is encrypted with this encryption.
+///
diff --git a/src/client/QXmppE2eeExtension.h b/src/client/QXmppE2eeExtension.h
index 6c3556f2..295de1a3 100644
--- a/src/client/QXmppE2eeExtension.h
+++ b/src/client/QXmppE2eeExtension.h
@@ -5,6 +5,7 @@
#ifndef QXMPPE2EEEXTENSION_H
#define QXMPPE2EEEXTENSION_H
+#include "QXmppError.h"
#include "QXmppExtension.h"
#include "QXmppSendResult.h"
#include "QXmppSendStanzaParams.h"
@@ -25,13 +26,16 @@ public:
};
using MessageEncryptResult = std::variant<QByteArray, QXmpp::SendError>;
+ using MessageDecryptResult = std::variant<QXmppMessage, NotEncrypted, QXmppError>;
using IqEncryptResult = std::variant<QByteArray, QXmpp::SendError>;
using IqDecryptResult = std::variant<QDomElement, NotEncrypted, QXmpp::SendError>;
virtual QFuture<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) = 0;
-
+ virtual QFuture<MessageDecryptResult> decryptMessage(QXmppMessage &&) = 0;
virtual QFuture<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) = 0;
virtual QFuture<IqDecryptResult> decryptIq(const QDomElement &) = 0;
+ virtual bool isEncrypted(const QDomElement &) = 0;
+ virtual bool isEncrypted(const QXmppMessage &) = 0;
};
#endif // QXMPPE2EEEXTENSION_H