summary refs log tree commit diff
path: root/src/CacheCryptoStructs.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-08 20:08:38 +0200
committerGitHub <noreply@github.com>2020-10-08 20:08:38 +0200
commit517a126a4427972668a97b21fc8684f7160976b9 (patch)
tree27142d719f848abe685897cd367e8d69a9bed719 /src/CacheCryptoStructs.h
parentMerge pull request #294 from trilene/master (diff)
parentTry to fix windows build (diff)
downloadnheko-517a126a4427972668a97b21fc8684f7160976b9.tar.xz
Merge pull request #270 from Chethan2k1/device-verification
Device verification and Cross-Signing
Diffstat (limited to 'src/CacheCryptoStructs.h')
-rw-r--r--src/CacheCryptoStructs.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/CacheCryptoStructs.h b/src/CacheCryptoStructs.h

index 14c9c86b..935d6493 100644 --- a/src/CacheCryptoStructs.h +++ b/src/CacheCryptoStructs.h
@@ -65,3 +65,53 @@ struct OlmSessionStorage std::mutex group_outbound_mtx; std::mutex group_inbound_mtx; }; + +//! Verification status of a single user +struct VerificationStatus +{ + //! True, if the users master key is verified + bool user_verified = false; + //! List of all devices marked as verified + std::vector<std::string> verified_devices; +}; + +//! In memory cache of verification status +struct VerificationStorage +{ + //! mapping of user to verification status + std::map<std::string, VerificationStatus> status; + std::mutex verification_storage_mtx; +}; + +// this will store the keys of the user with whom a encrypted room is shared with +struct UserKeyCache +{ + //! Device id to device keys + std::map<std::string, mtx::crypto::DeviceKeys> device_keys; + //! corss signing keys + mtx::crypto::CrossSigningKeys master_keys, user_signing_keys, self_signing_keys; + //! Sync token when nheko last fetched the keys + std::string updated_at; + //! Sync token when the keys last changed. updated != last_changed means they are outdated. + std::string last_changed; +}; + +void +to_json(nlohmann::json &j, const UserKeyCache &info); +void +from_json(const nlohmann::json &j, UserKeyCache &info); + +// the reason these are stored in a seperate cache rather than storing it in the user cache is +// UserKeyCache stores only keys of users with which encrypted room is shared +struct VerificationCache +{ + //! list of verified device_ids with device-verification + std::vector<std::string> device_verified; + //! list of devices the user blocks + std::vector<std::string> device_blocked; +}; + +void +to_json(nlohmann::json &j, const VerificationCache &info); +void +from_json(const nlohmann::json &j, VerificationCache &info);