blob: b651394bab79fba89dee89c70d529618b3f8f5f0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#pragma once
#include "Olm.h"
#include <MatrixClient.h>
#include <QObject>
class QTimer;
class DeviceVerificationFlow : public QObject
{
Q_OBJECT
// Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
Q_PROPERTY(QString tranId READ getTransactionId WRITE setTransactionId)
Q_PROPERTY(bool sender READ getSender WRITE setSender)
Q_PROPERTY(QString userId READ getUserId WRITE setUserId)
Q_PROPERTY(QString deviceId READ getDeviceId WRITE setDeviceId)
Q_PROPERTY(Method method READ getMethod WRITE setMethod)
public:
enum Method
{
Decimal,
Emoji
};
Q_ENUM(Method)
DeviceVerificationFlow(QObject *parent = nullptr);
QString getTransactionId();
QString getUserId();
QString getDeviceId();
Method getMethod();
void setTransactionId(QString transaction_id_);
bool getSender();
void setUserId(QString userID);
void setDeviceId(QString deviceID);
void setMethod(Method method_);
void setSender(bool sender_);
public slots:
//! sends a verification request
void sendVerificationRequest();
//! accepts a verification
void acceptVerificationRequest();
//! starts the verification flow
void startVerificationRequest();
//! cancels a verification flow
void cancelVerification();
//! sends the verification key
void sendVerificationKey();
//! sends the mac of the keys
void sendVerificationMac();
//! Completes the verification flow
void acceptDevice();
signals:
void verificationRequestAccepted(Method method);
void deviceVerified();
void timedout();
void verificationCanceled();
private:
QString userId;
QString deviceId;
Method method;
bool sender;
QTimer *timeout = nullptr;
std::string transaction_id;
mtx::identifiers::User toClient;
};
|