diff --git a/src/CacheCryptoStructs.h b/src/CacheCryptoStructs.h
index 6256dcf9..eb2cc445 100644
--- a/src/CacheCryptoStructs.h
+++ b/src/CacheCryptoStructs.h
@@ -6,12 +6,28 @@
#include <mtx/responses/crypto.hpp>
#include <mtxclient/crypto/objects.hpp>
+struct DeviceAndMasterKeys
+{
+ // map from device id or master key id to message_index
+ std::map<std::string, uint64_t> devices, master_keys;
+};
+
+struct SharedWithUsers
+{
+ // userid to keys
+ std::map<std::string, DeviceAndMasterKeys> keys;
+};
+
// Extra information associated with an outbound megolm session.
struct OutboundGroupSessionData
{
std::string session_id;
std::string session_key;
uint64_t message_index = 0;
+
+ // who has access to this session.
+ // Rotate, when a user leaves the room and share, when a user gets added.
+ SharedWithUsers initially, currently;
};
void
@@ -21,7 +37,7 @@ from_json(const nlohmann::json &obj, OutboundGroupSessionData &msg);
struct OutboundGroupSessionDataRef
{
- OlmOutboundGroupSession *session;
+ mtx::crypto::OutboundGroupSessionPtr session;
OutboundGroupSessionData data;
};
@@ -52,18 +68,6 @@ to_json(nlohmann::json &obj, const MegolmSessionIndex &msg);
void
from_json(const nlohmann::json &obj, MegolmSessionIndex &msg);
-struct OlmSessionStorage
-{
- // Megolm sessions
- std::map<std::string, mtx::crypto::InboundGroupSessionPtr> group_inbound_sessions;
- std::map<std::string, mtx::crypto::OutboundGroupSessionPtr> group_outbound_sessions;
- std::map<std::string, OutboundGroupSessionData> group_outbound_session_data;
-
- // Guards for accessing megolm sessions.
- std::mutex group_outbound_mtx;
- std::mutex group_inbound_mtx;
-};
-
struct StoredOlmSession
{
std::uint64_t last_message_ts = 0;
|