From 56db0dbc7d0878ce1621a4dc998024d470d200a5 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 17 Aug 2021 03:23:51 +0200 Subject: Allow downloading keys from key backup --- src/CacheCryptoStructs.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/CacheCryptoStructs.h') diff --git a/src/CacheCryptoStructs.h b/src/CacheCryptoStructs.h index 6c402674..80dd1046 100644 --- a/src/CacheCryptoStructs.h +++ b/src/CacheCryptoStructs.h @@ -47,6 +47,11 @@ struct GroupSessionData uint64_t message_index = 0; uint64_t timestamp = 0; + // If we got the session via key sharing or forwarding, we can usually trust it. + // If it came from asymmetric key backup, it is not trusted. + // TODO(Nico): What about forwards? They might come from key backup? + bool trusted = true; + std::string sender_claimed_ed25519_key; std::vector forwarding_curve25519_key_chain; @@ -83,6 +88,13 @@ from_json(const nlohmann::json &obj, DevicePublicKeys &msg); //! Represents a unique megolm session identifier. struct MegolmSessionIndex { + MegolmSessionIndex() = default; + MegolmSessionIndex(std::string room_id_, const mtx::events::msg::Encrypted &e) + : room_id(std::move(room_id_)) + , session_id(e.session_id) + , sender_key(e.sender_key) + {} + //! The room in which this session exists. std::string room_id; //! The session_id of the megolm session. @@ -167,3 +179,16 @@ void to_json(nlohmann::json &j, const VerificationCache &info); void from_json(const nlohmann::json &j, VerificationCache &info); + +struct OnlineBackupVersion +{ + //! the version of the online backup currently enabled + std::string version; + //! the algorithm used by the backup + std::string algorithm; +}; + +void +to_json(nlohmann::json &j, const OnlineBackupVersion &info); +void +from_json(const nlohmann::json &j, OnlineBackupVersion &info); -- cgit 1.5.1