Handle Device Verification related to_device messages
This commit is contained in:
parent
cd5dd0e39b
commit
1eb162cb6f
7 changed files with 153 additions and 14 deletions
23
src/Olm.cpp
23
src/Olm.cpp
|
|
@ -1,11 +1,15 @@
|
|||
#include <QObject>
|
||||
#include <variant>
|
||||
|
||||
#include "Olm.h"
|
||||
|
||||
#include "Cache.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "Utils.h"
|
||||
#include <DeviceVerificationFlow.h>
|
||||
#include <iostream> // only for debugging
|
||||
|
||||
static const std::string STORAGE_SECRET_KEY("secret");
|
||||
constexpr auto MEGOLM_ALGO = "m.megolm.v1.aes-sha2";
|
||||
|
|
@ -27,7 +31,6 @@ handle_to_device_messages(const std::vector<mtx::events::collections::DeviceEven
|
|||
{
|
||||
if (msgs.empty())
|
||||
return;
|
||||
|
||||
nhlog::crypto()->info("received {} to_device messages", msgs.size());
|
||||
nlohmann::json j_msg;
|
||||
|
||||
|
|
@ -74,6 +77,24 @@ handle_to_device_messages(const std::vector<mtx::events::collections::DeviceEven
|
|||
e.what(),
|
||||
j_msg.dump(2));
|
||||
}
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationAccept)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationAccept(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationRequest)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationRequest(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationCancel)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationCancel(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationKey)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationKey(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationMac)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationMac(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else if (msg_type == to_string(mtx::events::EventType::KeyVerificationStart)) {
|
||||
ChatPage::instance()->recievedDeviceVerificationStart(msg);
|
||||
std::cout << j_msg.dump(2) << std::endl;
|
||||
} else {
|
||||
nhlog::crypto()->warn("unhandled event: {}", j_msg.dump(2));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue