1 files changed, 15 insertions, 1 deletions
diff --git a/src/Olm.cpp b/src/Olm.cpp
index 1d86b4d7..059733c6 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -9,6 +9,7 @@
#include "DeviceVerificationFlow.h"
#include "Logging.h"
#include "MatrixClient.h"
+#include "UserSettingsPage.h"
#include "Utils.h"
static const std::string STORAGE_SECRET_KEY("secret");
@@ -519,7 +520,20 @@ handle_key_request_message(const mtx::events::DeviceEvent<mtx::events::msg::KeyR
return;
}
- if (!utils::respondsToKeyRequests(req.content.room_id)) {
+ // check if device is verified
+ auto verificationStatus = cache::verificationStatus(req.sender);
+ bool verifiedDevice = false;
+ if (verificationStatus &&
+ ChatPage::instance()->userSettings()->shareKeysWithTrustedUsers()) {
+ for (const auto &dev : verificationStatus->verified_devices) {
+ if (dev == req.content.requesting_device_id) {
+ verifiedDevice = true;
+ break;
+ }
+ }
+ }
+
+ if (!utils::respondsToKeyRequests(req.content.room_id) && !verifiedDevice) {
nhlog::crypto()->debug("ignoring all key requests for room {}",
req.content.room_id);
return;
|