2021-10-15 03:44:48 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2023-01-02 06:25:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2023 Nheko Contributors
|
2021-10-15 03:44:48 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
#include <mtx/events.hpp>
|
|
|
|
#include <mtx/events/encrypted.hpp>
|
|
|
|
|
|
|
|
class DeviceVerificationFlow;
|
|
|
|
class TimelineModel;
|
|
|
|
class TimelineModel;
|
|
|
|
class TimelineViewManager;
|
|
|
|
class RoomlistModel;
|
|
|
|
|
2022-10-10 15:38:29 +03:00
|
|
|
class VerificationManager final : public QObject
|
2021-10-15 03:44:48 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
VerificationManager(TimelineViewManager *o = nullptr);
|
|
|
|
|
|
|
|
Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow);
|
|
|
|
void verifyUser(QString userid);
|
|
|
|
void verifyDevice(QString userid, QString deviceid);
|
2021-10-30 01:22:47 +03:00
|
|
|
void verifyOneOfDevices(QString userid, std::vector<QString> deviceids);
|
2021-10-15 03:44:48 +03:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void newDeviceVerificationRequest(DeviceVerificationFlow *flow);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void receivedRoomDeviceVerificationRequest(
|
|
|
|
const mtx::events::RoomEvent<mtx::events::msg::KeyVerificationRequest> &message,
|
|
|
|
TimelineModel *model);
|
|
|
|
void receivedDeviceVerificationRequest(const mtx::events::msg::KeyVerificationRequest &msg,
|
|
|
|
std::string sender);
|
|
|
|
void receivedDeviceVerificationStart(const mtx::events::msg::KeyVerificationStart &msg,
|
|
|
|
std::string sender);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QHash<QString, QSharedPointer<DeviceVerificationFlow>> dvList;
|
|
|
|
bool isInitialSync_ = false;
|
|
|
|
RoomlistModel *rooms_;
|
|
|
|
};
|