QXmpp Version: 1.10.0
QXmppTrustManager.h
1// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPTRUSTMANAGER_H
6#define QXMPPTRUSTMANAGER_H
7
8#include "QXmppClientExtension.h"
9#include "QXmppTrustLevel.h"
10#include "QXmppTrustSecurityPolicy.h"
11
12template<typename T>
13class QXmppTask;
14
16
17class QXMPP_EXPORT QXmppTrustManager : public QXmppClientExtension
18{
19 Q_OBJECT
20
21public:
24
25 QXmppTask<void> setSecurityPolicy(const QString &encryption, QXmpp::TrustSecurityPolicy securityPolicy);
26 QXmppTask<void> resetSecurityPolicy(const QString &encryption);
27 QXmppTask<QXmpp::TrustSecurityPolicy> securityPolicy(const QString &encryption);
28
29 QXmppTask<void> setOwnKey(const QString &encryption, const QByteArray &keyId);
30 QXmppTask<void> resetOwnKey(const QString &encryption);
31 QXmppTask<QByteArray> ownKey(const QString &encryption);
32
33 QXmppTask<void> addKeys(const QString &encryption, const QString &keyOwnerJid, const QList<QByteArray> &keyIds, QXmpp::TrustLevel trustLevel = QXmpp::TrustLevel::AutomaticallyDistrusted);
34 QXmppTask<void> removeKeys(const QString &encryption, const QList<QByteArray> &keyIds);
35 QXmppTask<void> removeKeys(const QString &encryption, const QString &keyOwnerJid);
36 QXmppTask<void> removeKeys(const QString &encryption);
37 QXmppTask<QHash<QXmpp::TrustLevel, QMultiHash<QString, QByteArray>>> keys(const QString &encryption, QXmpp::TrustLevels trustLevels = {});
38 QXmppTask<QHash<QString, QHash<QByteArray, QXmpp::TrustLevel>>> keys(const QString &encryption, const QList<QString> &keyOwnerJids, QXmpp::TrustLevels trustLevels = {});
39 QXmppTask<bool> hasKey(const QString &encryption, const QString &keyOwnerJid, QXmpp::TrustLevels trustLevels);
40
41 QXmppTask<void> setTrustLevel(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds, QXmpp::TrustLevel trustLevel);
42 QXmppTask<void> setTrustLevel(const QString &encryption, const QList<QString> &keyOwnerJids, QXmpp::TrustLevel oldTrustLevel, QXmpp::TrustLevel newTrustLevel);
43 QXmppTask<QXmpp::TrustLevel> trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId);
44
45 QXmppTask<void> resetAll(const QString &encryption);
46
47 Q_SIGNAL void trustLevelsChanged(const QHash<QString, QMultiHash<QString, QByteArray>> &modifiedKeys);
48
49protected:
51 inline QXmppTrustStorage *trustStorage() const
52 {
53 return m_trustStorage;
54 }
56
57private:
58 QXmppTrustStorage *m_trustStorage;
59};
60
61#endif // QXMPPTRUSTMANAGER_H
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:32
Definition: QXmppTask.h:62
The QXmppTrustManager manages end-to-end encryption trust decisions.
Definition: QXmppTrustManager.h:18
Q_SIGNAL void trustLevelsChanged(const QHash< QString, QMultiHash< QString, QByteArray > > &modifiedKeys)
The QXmppTrustStorage class stores end-to-end encryption trust data.
Definition: QXmppTrustStorage.h:16
TrustLevel
Definition: QXmppTrustLevel.h:19
TrustSecurityPolicy
Definition: QXmppTrustSecurityPolicy.h:18