Skip to content

Commit

Permalink
Remove custom job implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasFella committed Aug 8, 2023
1 parent 62b85bc commit 4585628
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions Quotient/e2ee/sssshandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,14 @@
#include "../qt_connection_util.h"
#include "database.h"
#include "../events/event.h"
#include "../csapi/key_backup.h"

using namespace Quotient;

SSSSHandler::SSSSHandler(QObject* parent)
: QObject(parent)
{}

namespace Quotient {
class QUOTIENT_API GetRoomKeysVersionJob : public BaseJob {
public:
using BaseJob::makeRequestUrl;
static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri,
QSize requestedSize);

GetRoomKeysVersionJob()
: BaseJob(HttpVerb::Get, {},
"/_matrix/client/v3/room_keys/version")
{}
};

class QUOTIENT_API GetRoomKeysJob : public BaseJob {
public:
using BaseJob::makeRequestUrl;
static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri,
QSize requestedSize);

explicit GetRoomKeysJob(const QString& version)
: BaseJob(HttpVerb::Get, {},
"/_matrix/client/v3/room_keys/keys")
{
QUrlQuery query;
addParam<>(query, QStringLiteral("version"), version);
setRequestQuery(query);
}
};
} // namespace Quotient

DEFINE_SIMPLE_EVENT(SecretStorageDefaultKeyEvent, Event, "m.secret_storage.default_key", QString, key, "key");

QByteArray SSSSHandler::decryptKey(const QString& name, const QByteArray& decryptionKey) const
Expand Down Expand Up @@ -129,7 +100,7 @@ void SSSSHandler::setConnection(Connection* connection)

void SSSSHandler::loadMegolmBackup(const QByteArray& megolmDecryptionKey)
{
auto job = m_connection->callApi<GetRoomKeysVersionJob>();
auto job = m_connection->callApi<GetRoomKeysVersionCurrentJob>();
connect(job, &BaseJob::finished, this, [this, job, megolmDecryptionKey](){
auto authData = job->jsonData()["auth_data"_ls].toObject();
for (const auto& key : authData["signatures"_ls].toObject()[m_connection->userId()].toObject().keys()) {
Expand Down

0 comments on commit 4585628

Please sign in to comment.