2021-09-18 00:21:14 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class SelfVerificationStatus : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
|
2021-10-30 00:22:47 +02:00
|
|
|
Q_PROPERTY(bool hasSSSS READ hasSSSS NOTIFY hasSSSSChanged)
|
2021-09-18 00:21:14 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
SelfVerificationStatus(QObject *o = nullptr);
|
|
|
|
enum Status
|
|
|
|
{
|
|
|
|
AllVerified,
|
|
|
|
NoMasterKey,
|
|
|
|
UnverifiedMasterKey,
|
|
|
|
UnverifiedDevices,
|
|
|
|
};
|
|
|
|
Q_ENUM(Status)
|
|
|
|
|
|
|
|
Q_INVOKABLE void setupCrosssigning(bool useSSSS, QString password, bool useOnlineKeyBackup);
|
|
|
|
Q_INVOKABLE void verifyMasterKey();
|
2021-10-30 00:22:47 +02:00
|
|
|
Q_INVOKABLE void verifyMasterKeyWithPassphrase();
|
2021-09-18 00:21:14 +02:00
|
|
|
Q_INVOKABLE void verifyUnverifiedDevices();
|
|
|
|
|
|
|
|
Status status() const { return status_; }
|
2021-10-30 00:22:47 +02:00
|
|
|
bool hasSSSS() const { return hasSSSS_; }
|
2021-09-18 00:21:14 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void statusChanged();
|
2021-10-30 00:22:47 +02:00
|
|
|
void hasSSSSChanged();
|
2021-09-18 00:21:14 +02:00
|
|
|
void setupCompleted();
|
|
|
|
void showRecoveryKey(QString key);
|
|
|
|
void setupFailed(QString message);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void invalidate();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Status status_ = AllVerified;
|
2021-10-30 00:22:47 +02:00
|
|
|
bool hasSSSS_ = true;
|
2021-09-18 00:21:14 +02:00
|
|
|
};
|