summary refs log tree commit diff
path: root/src/CacheCryptoStructs.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-07 12:19:46 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-07 17:01:57 +0200
commit0d0709ccd37ef2f689c9d22a20994ce8d423e18b (patch)
tree110a1e0692184d34a3535dce1f8d3d99c1d70194 /src/CacheCryptoStructs.h
parentTranslated using Weblate (Spanish) (diff)
downloadnheko-0d0709ccd37ef2f689c9d22a20994ce8d423e18b.tar.xz
Show verification status next to messages
Diffstat (limited to 'src/CacheCryptoStructs.h')
-rw-r--r--src/CacheCryptoStructs.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/CacheCryptoStructs.h b/src/CacheCryptoStructs.h
index c884107e..b665be86 100644
--- a/src/CacheCryptoStructs.h
+++ b/src/CacheCryptoStructs.h
@@ -4,12 +4,28 @@
 
 #pragma once
 
+#include <QObject>
+
 #include <map>
 #include <mutex>
 
+#include <mtx/events/encrypted.hpp>
 #include <mtx/responses/crypto.hpp>
 #include <mtxclient/crypto/objects.hpp>
 
+namespace crypto {
+Q_NAMESPACE
+//! How much a participant is trusted.
+enum Trust
+{
+        Unverified, //! Device unverified or master key changed.
+        TOFU,       //! Device is signed by the sender, but the user is not verified, but they never
+                    //! changed the master key.
+        Verified,   //! User was verified and has crosssigned this device or device is verified.
+};
+Q_ENUM_NS(Trust)
+}
+
 struct DeviceAndMasterKeys
 {
         // map from device id or master key id to message_index
@@ -87,9 +103,11 @@ from_json(const nlohmann::json &obj, StoredOlmSession &msg);
 struct VerificationStatus
 {
         //! True, if the users master key is verified
-        bool user_verified = false;
+        crypto::Trust user_verified = crypto::Trust::Unverified;
         //! List of all devices marked as verified
         std::vector<std::string> verified_devices;
+        //! Map from sender key/curve25519 to trust status
+        std::map<std::string, crypto::Trust> verified_device_keys;
 };
 
 //! In memory cache of verification status