diff options
| author | Melvin Keskin <melvo@olomono.de> | 2022-01-15 13:55:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-15 13:55:18 +0100 |
| commit | 6491c55011d8c677b776a7ba66c21031f689c2d2 (patch) | |
| tree | 3ed2a7d577351e56b923de1bbc36794f5bb997e0 /src/client/QXmppTrustStorage.h | |
| parent | 282bac5d1d6190381dddaf3aa2c49fd2e5711393 (diff) | |
| download | qxmpp-6491c55011d8c677b776a7ba66c21031f689c2d2.tar.gz | |
Split up ATM parts of trust storage and refactor (#388)
QXmppTrustStorage is now the base class for all trust storages used by
end-to-end encryption managers.
QXmppAtmTrustStorage is used by QXmppAtmManager.
QXmppTrustMemoryStorage is now the base class for all trust storages
that use the memory for storing data.
QXmppAtmTrustMemoryStorage can be used by QXmppAtmManager.
Methods needed by the upcoming OMEMO implementation are added.
Some existing methods are refactored.
Diffstat (limited to 'src/client/QXmppTrustStorage.h')
| -rw-r--r-- | src/client/QXmppTrustStorage.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/client/QXmppTrustStorage.h b/src/client/QXmppTrustStorage.h index 2c7b593e..dffbcfae 100644 --- a/src/client/QXmppTrustStorage.h +++ b/src/client/QXmppTrustStorage.h @@ -9,8 +9,6 @@ #include <QFuture> -class QXmppTrustMessageKeyOwner; - class QXMPP_EXPORT QXmppTrustStorage { public: @@ -20,7 +18,7 @@ public: /// enum SecurityPolicy { NoSecurityPolicy, ///< New keys must be trusted manually. - Toakafa, ///< New keys are trusted automatically until the first authentication but automatically distrusted afterwards. + Toakafa, ///< New keys are trusted automatically until the first authentication but automatically distrusted afterwards. \see \xep{0450, Automatic Trust Management (ATM)} }; /// @@ -28,35 +26,38 @@ public: /// 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). + Undecided = 1, ///< The key's trust is not decided. + AutomaticallyDistrusted = 2, ///< The key is automatically distrusted (e.g., by the security policy TOAKAFA). \see SecurityPolicy + ManuallyDistrusted = 4, ///< The key is manually distrusted (e.g., by clicking a button or \xep{0450, Automatic Trust Management (ATM)}). + AutomaticallyTrusted = 8, ///< The key is automatically trusted (e.g., by the client for all keys of a bare JID until one of it is authenticated). + ManuallyTrusted = 16, ///< The key is manually trusted (e.g., by clicking a button). + Authenticated = 32, ///< The key is authenticated (e.g., by QR code scanning or \xep{0450, Automatic Trust Management (ATM)}). }; Q_DECLARE_FLAGS(TrustLevels, TrustLevel) virtual ~QXmppTrustStorage() = default; - virtual QFuture<void> setSecurityPolicies(const QString &encryption = {}, SecurityPolicy securityPolicy = SecurityPolicy::NoSecurityPolicy) = 0; + virtual QFuture<void> setSecurityPolicy(const QString &encryption, SecurityPolicy securityPolicy) = 0; + virtual QFuture<void> resetSecurityPolicy(const QString &encryption) = 0; virtual QFuture<SecurityPolicy> securityPolicy(const QString &encryption) = 0; - virtual QFuture<void> addOwnKey(const QString &encryption, const QByteArray &keyId) = 0; - virtual QFuture<void> removeOwnKey(const QString &encryption) = 0; + virtual QFuture<void> setOwnKey(const QString &encryption, const QByteArray &keyId) = 0; + virtual QFuture<void> resetOwnKey(const QString &encryption) = 0; virtual QFuture<QByteArray> ownKey(const QString &encryption) = 0; virtual QFuture<void> addKeys(const QString &encryption, const QString &keyOwnerJid, const QList<QByteArray> &keyIds, TrustLevel trustLevel = TrustLevel::AutomaticallyDistrusted) = 0; - virtual QFuture<void> removeKeys(const QString &encryption = {}, const QList<QByteArray> &keyIds = {}) = 0; + virtual QFuture<void> removeKeys(const QString &encryption, const QList<QByteArray> &keyIds) = 0; + virtual QFuture<void> removeKeys(const QString &encryption, const QString &keyOwnerJid) = 0; + virtual QFuture<void> removeKeys(const QString &encryption) = 0; virtual QFuture<QHash<TrustLevel, QMultiHash<QString, QByteArray>>> keys(const QString &encryption, TrustLevels trustLevels = {}) = 0; + virtual QFuture<QHash<QString, QHash<QByteArray, TrustLevel>>> keys(const QString &encryption, const QList<QString> &keyOwnerJids, TrustLevels trustLevels = {}) = 0; + virtual QFuture<bool> hasKey(const QString &encryption, const QString &keyOwnerJid, TrustLevels trustLevels) = 0; virtual QFuture<void> setTrustLevel(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds, TrustLevel trustLevel) = 0; virtual QFuture<void> setTrustLevel(const QString &encryption, const QList<QString> &keyOwnerJids, TrustLevel oldTrustLevel, TrustLevel newTrustLevel) = 0; virtual QFuture<TrustLevel> trustLevel(const QString &encryption, const QByteArray &keyId) = 0; - virtual QFuture<void> addKeysForPostponedTrustDecisions(const QString &encryption, const QByteArray &senderKeyId, const QList<QXmppTrustMessageKeyOwner> &keyOwners) = 0; - virtual QFuture<void> removeKeysForPostponedTrustDecisions(const QString &encryption, const QList<QByteArray> &keyIdsForAuthentication, const QList<QByteArray> &keyIdsForDistrusting) = 0; - virtual QFuture<void> removeKeysForPostponedTrustDecisions(const QString &encryption = {}, const QList<QByteArray> &senderKeyIds = {}) = 0; - virtual QFuture<QHash<bool, QMultiHash<QString, QByteArray>>> keysForPostponedTrustDecisions(const QString &encryption, const QList<QByteArray> &senderKeyIds = {}) = 0; + virtual QFuture<void> resetAll(const QString &encryption) = 0; }; Q_DECLARE_METATYPE(QXmppTrustStorage::SecurityPolicy) |
