/* * Copyright (C) 2008-2021 The QXmpp developers * * Author: * Melvin Keskin * * 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 QXMPPTRUSTSTORAGE_H #define QXMPPTRUSTSTORAGE_H #include "QXmppGlobal.h" #include class QXmppTrustMessageKeyOwner; class QXMPP_EXPORT QXmppTrustStorage { public: /// /// trust level of public long-term keys used by end-to-end encryption /// protocols /// enum TrustLevel { AutomaticallyDistrusted = 1, ///< The key is automatically distrusted (e.g., by ATM's security policy). ManuallyDistrusted = 2, ///< The key is manually distrusted (e.g., by clicking a button or ATM). AutomaticallyTrusted = 4, ///< The key is automatically trusted (e.g., by the client for all keys of a bare JID until one of it is authenticated). ManuallyTrusted = 8, ///< The key is manually trusted (e.g., by clicking a button). Authenticated = 16, ///< The key is authenticated (e.g., by QR code scanning or ATM). }; Q_DECLARE_FLAGS(TrustLevels, TrustLevel) virtual QFuture addOwnKey(const QString &encryption, const QString &keyId) = 0; virtual QFuture removeOwnKey(const QString &encryption) = 0; virtual QFuture ownKey(const QString &encryption) const = 0; virtual QFuture addKeys(const QString &encryption, const QString &keyOwnerJid, const QList &keyIds, TrustLevel trustLevel = TrustLevel::AutomaticallyDistrusted) = 0; virtual QFuture removeKeys(const QString &encryption = {}, const QList &keyIds = {}) = 0; virtual QFuture>> keys(const QString &encryption, TrustLevels trustLevels = {}) const = 0; virtual QFuture setTrustLevel(const QString &encryption, const QMultiHash &keyIds, TrustLevel trustLevel) = 0; virtual QFuture setTrustLevel(const QString &encryption, const QList &keyOwnerJids, TrustLevel oldTrustLevel, TrustLevel newTrustLevel) = 0; virtual QFuture trustLevel(const QString &encryption, const QString &keyId) const = 0; virtual QFuture addKeysForPostponedTrustDecisions(const QString &encryption, const QString &senderKeyId, const QList &keyOwners) = 0; virtual QFuture removeKeysForPostponedTrustDecisions(const QString &encryption, const QList &keyIdsForAuthentication, const QList &keyIdsForDistrusting) = 0; virtual QFuture removeKeysForPostponedTrustDecisions(const QString &encryption = {}, const QList &senderKeyIds = {}) = 0; virtual QFuture>> keysForPostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds = {}) = 0; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QXmppTrustStorage::TrustLevels) #endif // QXMPPTRUSTSTORAGE_H