aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppTrustLevel.h
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-06-18 12:41:31 +0200
committerLinus Jahn <lnj@kaidan.im>2022-06-18 13:08:07 +0200
commit32ccc6358ba6433e6b870b238fba20ccf1862fe2 (patch)
tree81c4f8d5a1af484b7aad52ad2dcef4da556360ad /src/client/QXmppTrustLevel.h
parentcb1c0ac7ba16590304c8fe7bd6d87b69dffe5c67 (diff)
downloadqxmpp-32ccc6358ba6433e6b870b238fba20ccf1862fe2.tar.gz
Move SecurityPolicy, TrustLevel intro extra headers
This avoids the need to include the whole TrustStorage in files like SendStanzaParams.h.
Diffstat (limited to 'src/client/QXmppTrustLevel.h')
-rw-r--r--src/client/QXmppTrustLevel.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/client/QXmppTrustLevel.h b/src/client/QXmppTrustLevel.h
new file mode 100644
index 00000000..2cff9e2a
--- /dev/null
+++ b/src/client/QXmppTrustLevel.h
@@ -0,0 +1,48 @@
+// SPDX-FileCopyrightText: 2021 Melvin Keskin <melvo@olomono.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef QXMPPTRUSTLEVEL_H
+#define QXMPPTRUSTLEVEL_H
+
+#include <QFlags>
+#include <QHashFunctions>
+
+namespace QXmpp {
+
+///
+/// Trust level of public long-term keys used by end-to-end encryption
+/// protocols
+///
+/// \since QXmpp 1.5
+///
+enum class TrustLevel {
+ /// The key's trust is not decided.
+ Undecided = 1,
+ /// The key is automatically distrusted (e.g., by the security policy TOAKAFA).
+ /// \see SecurityPolicy
+ AutomaticallyDistrusted = 2,
+ /// The key is manually distrusted (e.g., by clicking a button or \xep{0450, Automatic Trust
+ /// Management (ATM)}).
+ ManuallyDistrusted = 4,
+ /// The key is automatically trusted (e.g., by the client for all keys of a bare JID until one
+ /// of it is authenticated).
+ AutomaticallyTrusted = 8,
+ /// The key is manually trusted (e.g., by clicking a button).
+ ManuallyTrusted = 16,
+ /// The key is authenticated (e.g., by QR code scanning or \xep{0450, Automatic Trust
+ /// Management (ATM)}).
+ Authenticated = 32,
+};
+
+Q_DECLARE_FLAGS(TrustLevels, TrustLevel)
+Q_DECLARE_OPERATORS_FOR_FLAGS(TrustLevels)
+
+} // namespace QXmpp
+
+/// \cond
+// Scoped enums (enum class) are not implicitly converted to int
+inline uint qHash(QXmpp::TrustLevel key, uint seed) noexcept { return qHash(std::underlying_type_t<QXmpp::TrustLevel>(key), seed); }
+/// \endcond
+
+#endif // QXMPPTRUSTLEVEL_H