QXmpp: QXmppTrustManager.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
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
15class QXmppTrustStorage;
16
17 class QXMPP_EXPORT QXmppTrustManager : public QXmppClientExtension
18{
19 Q_OBJECT
20
21public:
22 QXmppTrustManager(QXmppTrustStorage *trustStorage);
23 ~QXmppTrustManager();
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
QXmppClientExtension::QXmppClientExtension
QXmppClientExtension()
Definition QXmppClientExtension.cpp:12
QXmppTask
Definition QXmppTask.h:46
QXmppTrustManager::hasKey
QXmppTask< bool > hasKey(const QString &encryption, const QString &keyOwnerJid, QXmpp::TrustLevels trustLevels)
Definition QXmppTrustManager.cpp:196
QXmppTrustManager::resetOwnKey
QXmppTask< void > resetOwnKey(const QString &encryption)
Definition QXmppTrustManager.cpp:89
QXmppTrustManager::setTrustLevel
QXmppTask< void > setTrustLevel(const QString &encryption, const QMultiHash< QString, QByteArray > &keyIds, QXmpp::TrustLevel trustLevel)
Definition QXmppTrustManager.cpp:210
QXmppTrustManager::ownKey
QXmppTask< QByteArray > ownKey(const QString &encryption)
Definition QXmppTrustManager.cpp:102
QXmppTrustManager::keys
QXmppTask< QHash< QXmpp::TrustLevel, QMultiHash< QString, QByteArray > > > keys(const QString &encryption, QXmpp::TrustLevels trustLevels={})
Definition QXmppTrustManager.cpp:163
QXmppTrustManager::setSecurityPolicy
QXmppTask< void > setSecurityPolicy(const QString &encryption, QXmpp::TrustSecurityPolicy securityPolicy)
Definition QXmppTrustManager.cpp:44
QXmppTrustManager::trustLevel
QXmppTask< QXmpp::TrustLevel > trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId)
Definition QXmppTrustManager.cpp:254
QXmppTrustManager::QXmppTrustManager
QXmppTrustManager(QXmppTrustStorage *trustStorage)
Definition QXmppTrustManager.cpp:31
QXmppTrustManager::trustLevelsChanged
Q_SIGNAL void trustLevelsChanged(const QHash< QString, QMultiHash< QString, QByteArray > > &modifiedKeys)
QXmppTrustManager::addKeys
QXmppTask< void > addKeys(const QString &encryption, const QString &keyOwnerJid, const QList< QByteArray > &keyIds, QXmpp::TrustLevel trustLevel=QXmpp::TrustLevel::AutomaticallyDistrusted)
Definition QXmppTrustManager.cpp:115
QXmppTrustManager::resetSecurityPolicy
QXmppTask< void > resetSecurityPolicy(const QString &encryption)
Definition QXmppTrustManager.cpp:54
QXmppTrustManager::resetAll
QXmppTask< void > resetAll(const QString &encryption)
Definition QXmppTrustManager.cpp:264
QXmppTrustManager::removeKeys
QXmppTask< void > removeKeys(const QString &encryption, const QList< QByteArray > &keyIds)
Definition QXmppTrustManager.cpp:126
QXmppTrustManager::setOwnKey
QXmppTask< void > setOwnKey(const QString &encryption, const QByteArray &keyId)
Definition QXmppTrustManager.cpp:78
QXmppTrustManager::securityPolicy
QXmppTask< QXmpp::TrustSecurityPolicy > securityPolicy(const QString &encryption)
Definition QXmppTrustManager.cpp:66
QXmppTrustStorage
The QXmppTrustStorage class stores end-to-end encryption trust data.
Definition QXmppTrustStorage.h:16
QXmpp::TrustLevel
TrustLevel
Definition QXmppTrustLevel.h:19
QXmpp::TrustLevel::AutomaticallyDistrusted
@ AutomaticallyDistrusted
Definition QXmppTrustLevel.h:24
QXmpp::TrustSecurityPolicy
TrustSecurityPolicy
Definition QXmppTrustSecurityPolicy.h:18