summary refs log tree commit diff
path: root/src/DeviceVerificationFlow.h
blob: 71c40cd5e97e8ae69dffcb1d7d5fb71af92eeff4 (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
#pragma once

#include <QObject>

class QTimer;

class DeviceVerificationFlow : public QObject
{
        Q_OBJECT
        // Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")

public:
        enum Method
        {
                Decimal,
                Emoji
        };
        Q_ENUM(Method)

        DeviceVerificationFlow(QObject *parent = nullptr);

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();
        //! Completes the verification flow
        void acceptDevice();

signals:
        void verificationRequestAccepted(Method method);
        void deviceVerified();
        void timedout();
        void verificationCanceled();

private:
        //! generates a unique transaction id
        std::string generate_txn_id();

        QTimer *timeout = nullptr;
        std::string transaction_id;
};