Share historical keys
We share all keys with our devices and ones created by us to other users.
This commit is contained in:
parent
9fadd14871
commit
3f0aa13cb6
4 changed files with 56 additions and 23 deletions
|
|
@ -582,6 +582,25 @@ Cache::getOutboundMegolmSession(const std::string &room_id)
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<GroupSessionData>
|
||||
Cache::getMegolmSessionData(const MegolmSessionIndex &index)
|
||||
{
|
||||
try {
|
||||
using namespace mtx::crypto;
|
||||
|
||||
auto txn = ro_txn(env_);
|
||||
|
||||
std::string_view value;
|
||||
if (megolmSessionDataDb_.get(txn, json(index).dump(), value)) {
|
||||
return nlohmann::json::parse(value).get<GroupSessionData>();
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
} catch (std::exception &e) {
|
||||
nhlog::db()->error("Failed to retrieve Megolm Session Data: {}", e.what());
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
//
|
||||
// OLM sessions.
|
||||
//
|
||||
|
|
@ -4622,6 +4641,11 @@ inboundMegolmSessionExists(const MegolmSessionIndex &index)
|
|||
{
|
||||
return instance_->inboundMegolmSessionExists(index);
|
||||
}
|
||||
std::optional<GroupSessionData>
|
||||
getMegolmSessionData(const MegolmSessionIndex &index)
|
||||
{
|
||||
return instance_->getMegolmSessionData(index);
|
||||
}
|
||||
|
||||
//
|
||||
// Olm Sessions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue