diff --git a/src/encryption/DeviceVerificationFlow.cpp b/src/encryption/DeviceVerificationFlow.cpp
index f0c7ed52..8c7204be 100644
--- a/src/encryption/DeviceVerificationFlow.cpp
+++ b/src/encryption/DeviceVerificationFlow.cpp
@@ -944,3 +944,33 @@ DeviceVerificationFlow::InitiateDeviceVerification(QObject *parent_,
return flow;
}
+template<typename T>
+void
+DeviceVerificationFlow::send(T msg)
+{
+ if (this->type == DeviceVerificationFlow::Type::ToDevice) {
+ mtx::requests::ToDeviceMessages<T> body;
+ msg.transaction_id = this->transaction_id;
+ for (const auto &d : deviceIds)
+ body[this->toClient][d.toStdString()] = msg;
+
+ http::client()->send_to_device<T>(
+ http::client()->generate_txn_id(), body, [](mtx::http::RequestErr err) {
+ if (err)
+ nhlog::net()->warn("failed to send verification to_device message: {} {}",
+ err->matrix_error.error,
+ static_cast<int>(err->status_code));
+ });
+ } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) {
+ if constexpr (!std::is_same_v<T, mtx::events::msg::KeyVerificationRequest>) {
+ msg.relations.relations.push_back(this->relation);
+ // Set synthesized to surpress the nheko relation extensions
+ msg.relations.synthesized = true;
+ }
+ (model_)->sendMessageEvent(msg, mtx::events::to_device_content_to_type<T>);
+ }
+
+ nhlog::net()->debug("Sent verification step: {} in state: {}",
+ mtx::events::to_string(mtx::events::to_device_content_to_type<T>),
+ state().toStdString());
+}
diff --git a/src/encryption/DeviceVerificationFlow.h b/src/encryption/DeviceVerificationFlow.h
index 6b1776e0..e64eab96 100644
--- a/src/encryption/DeviceVerificationFlow.h
+++ b/src/encryption/DeviceVerificationFlow.h
@@ -7,13 +7,14 @@
#include <QObject>
#include <mtx/responses/crypto.hpp>
+#include <mtxclient/crypto/client.hpp>
#include "CacheCryptoStructs.h"
#include "Logging.h"
#include "MatrixClient.h"
-#include "timeline/TimelineModel.h"
class QTimer;
+class TimelineModel;
using sas_ptr = std::unique_ptr<mtx::crypto::SAS>;
@@ -230,32 +231,5 @@ private:
bool keySent = false, macSent = false, acceptSent = false, startSent = false;
template<typename T>
- void send(T msg)
- {
- if (this->type == DeviceVerificationFlow::Type::ToDevice) {
- mtx::requests::ToDeviceMessages<T> body;
- msg.transaction_id = this->transaction_id;
- for (const auto &d : deviceIds)
- body[this->toClient][d.toStdString()] = msg;
-
- http::client()->send_to_device<T>(
- http::client()->generate_txn_id(), body, [](mtx::http::RequestErr err) {
- if (err)
- nhlog::net()->warn("failed to send verification to_device message: {} {}",
- err->matrix_error.error,
- static_cast<int>(err->status_code));
- });
- } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) {
- if constexpr (!std::is_same_v<T, mtx::events::msg::KeyVerificationRequest>) {
- msg.relations.relations.push_back(this->relation);
- // Set synthesized to surpress the nheko relation extensions
- msg.relations.synthesized = true;
- }
- (model_)->sendMessageEvent(msg, mtx::events::to_device_content_to_type<T>);
- }
-
- nhlog::net()->debug("Sent verification step: {} in state: {}",
- mtx::events::to_string(mtx::events::to_device_content_to_type<T>),
- state().toStdString());
- }
+ void send(T msg);
};
diff --git a/src/encryption/Olm.cpp b/src/encryption/Olm.cpp
index aaa7e43f..0352d8d3 100644
--- a/src/encryption/Olm.cpp
+++ b/src/encryption/Olm.cpp
@@ -1665,10 +1665,10 @@ request_cross_signing_keys()
});
};
- request(mtx::secret_storage::secrets::cross_signing_master);
- request(mtx::secret_storage::secrets::cross_signing_self_signing);
- request(mtx::secret_storage::secrets::cross_signing_user_signing);
- request(mtx::secret_storage::secrets::megolm_backup_v1);
+ request(std::string(mtx::secret_storage::secrets::cross_signing_master));
+ request(std::string(mtx::secret_storage::secrets::cross_signing_self_signing));
+ request(std::string(mtx::secret_storage::secrets::cross_signing_user_signing));
+ request(std::string(mtx::secret_storage::secrets::megolm_backup_v1));
}
namespace {
@@ -1725,22 +1725,22 @@ download_cross_signing_keys()
if (backup_key && !backup_key->encrypted.empty())
secrets[backup_key->encrypted.begin()->first]
- [secrets::megolm_backup_v1] =
+ [std::string(secrets::megolm_backup_v1)] =
backup_key->encrypted.begin()->second;
if (master_key && !master_key->encrypted.empty())
secrets[master_key->encrypted.begin()->first]
- [secrets::cross_signing_master] =
+ [std::string(secrets::cross_signing_master)] =
master_key->encrypted.begin()->second;
if (self_signing_key && !self_signing_key->encrypted.empty())
secrets[self_signing_key->encrypted.begin()->first]
- [secrets::cross_signing_self_signing] =
+ [std::string(secrets::cross_signing_self_signing)] =
self_signing_key->encrypted.begin()->second;
if (user_signing_key && !user_signing_key->encrypted.empty())
secrets[user_signing_key->encrypted.begin()->first]
- [secrets::cross_signing_user_signing] =
+ [std::string(secrets::cross_signing_user_signing)] =
user_signing_key->encrypted.begin()->second;
for (const auto &[key, secret_] : secrets)
diff --git a/src/encryption/SelfVerificationStatus.cpp b/src/encryption/SelfVerificationStatus.cpp
index 8981244d..29711716 100644
--- a/src/encryption/SelfVerificationStatus.cpp
+++ b/src/encryption/SelfVerificationStatus.cpp
@@ -110,7 +110,7 @@ SelfVerificationStatus::setupCrosssigning(bool useSSSS,
http::client()->set_secret_storage_default_key(ssss->keyDescription.name,
[](mtx::http::RequestErr) {});
- auto uploadSecret = [ssss](const std::string &key_name, const std::string &secret) {
+ auto uploadSecret = [ssss](std::string_view key_name, const std::string &secret) {
mtx::secret_storage::Secret s;
s.encrypted[ssss->keyDescription.name] =
mtx::crypto::encrypt(secret, ssss->privateKey, key_name);
|