aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppE2eeExtension.h
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2021-08-22 22:00:46 +0200
committerLinus Jahn <lnj@kaidan.im>2021-09-28 17:08:08 +0200
commit5849459af181d686c6e0b8ccca3a685e44a81582 (patch)
tree821308f9c162ec9127ddf51d1406ab8e0283d136 /src/client/QXmppE2eeExtension.h
parent48d3eb28ab8f115ce999c2264303925f9c7ce2a7 (diff)
downloadqxmpp-5849459af181d686c6e0b8ccca3a685e44a81582.tar.gz
QXmppClient: Add encryption hooks
Diffstat (limited to 'src/client/QXmppE2eeExtension.h')
-rw-r--r--src/client/QXmppE2eeExtension.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/client/QXmppE2eeExtension.h b/src/client/QXmppE2eeExtension.h
new file mode 100644
index 00000000..763a9b28
--- /dev/null
+++ b/src/client/QXmppE2eeExtension.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008-2021 The QXmpp developers
+ *
+ * Authors:
+ * Linus Jahn
+ *
+ * Source:
+ * https://github.com/qxmpp-project/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#ifndef QXMPPE2EEEXTENSION_H
+#define QXMPPE2EEEXTENSION_H
+
+#include "QXmppSendResult.h"
+
+class QDomElement;
+class QXmppMessage;
+class QXmppIq;
+template<typename T>
+class QFuture;
+
+class QXmppE2eeExtension
+{
+public:
+ struct NotEncrypted {};
+
+ using EncryptMessageResult = std::variant<QByteArray, QXmpp::SendError>;
+ using IqEncryptResult = std::variant<QByteArray, QXmpp::SendError>;
+ using IqDecryptResult = std::variant<QDomElement, NotEncrypted, QXmpp::SendError>;
+
+ virtual QFuture<EncryptMessageResult> encryptMessage(QXmppMessage &&) = 0;
+
+ virtual QFuture<IqEncryptResult> encryptIq(QXmppIq &&) = 0;
+ virtual QFuture<IqDecryptResult> decryptIq(const QDomElement &) = 0;
+};
+
+#endif // QXMPPE2EEEXTENSION_H