libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
keyverificationsession.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
7
8#include <QtCore/QObject>
9#include <QtCore/QPointer>
10#include <QtQmlIntegration/qqmlintegration.h>
11
12#include "util.h"
13
14class QTimer;
15
16namespace Quotient {
17class Connection;
18class Room;
19
22 //! \brief Unicode of the emoji
24 //! \brief Textual description of the emoji
25 //! This follows https://spec.matrix.org/v1.11/client-server-api/#sas-method-emoji
27
28public:
31 friend bool operator==(const EmojiEntry&, const EmojiEntry&) = default;
32};
33
34/** A key verification session. Listen for incoming sessions by connecting to Connection::newKeyVerificationSession.
35 Start a new session using Connection::startKeyVerificationSession.
36 The object is delete after finished is emitted.
37*/
39{
43
44public:
45 enum State {
46 CREATED, //! The verification request has been newly created by us
48 REQUESTED, //! The verification request was received from the other party
50 READY, //! The verification request is ready to start a verification flow
51 TRANSITIONED, //! The verification request has transitioned into a concrete verification flow, e.g. into the emoji based SAS verification
52 DONE, //! The verification flow that was started with this request has finished
53 CANCELLED, //! The verification process has been cancelled
55 NOTFOUND, //! The verification session was not found
56 };
58
59 enum SasState {
60 SASSTARTED, //! The verification has been started, the protocols that should be used have been proposed and can be accepted
61 SASACCEPTED, //! The verification has been accepted and both sides agreed to a set of protocols that will be used for the verification process
62 SASKEYSEXCHANGED, //! The public keys have been exchanged and the short auth string can be presented to the user
63 SASCONFIRMED, //! The verification process has been confirmed from our side, we’re waiting for the other side to confirm as well
64 SASDONE, //! The verification process has been successfully concluded
65 SASCANCELLED, //! The verification process has been cancelled
66 SASNOTFOUND, //! The verification session is not found / not transitioned to SAS
67 };
69
70 //! \brief The matrix id of the user we're verifying.
71 //! For device verification this is our own id.
73
74 //! \brief The device id of the device we're verifying
75 //! Does not have a specified value when verifying a different user
77
78 //! \brief The current state of the verification session
79 //! Clients should use this to adapt their UI to the current stage of the verification
81
82 //! \brief The current state of the sas verification
83 //! Clients should use this to adapt their UI to the current stage of the verification
85
86 //! \brief The sas emoji that should be shown to the user.
87 //! Only has a specified value when the session is in TRANSITIONED state
89
92
93 //! \brief Accept an incoming verification session
95 //! \deprecated Use KeyVerificationSession::accept instead
97
98 //! \brief Confirm that the emojis shown to the user match
99 //! This will mark the remote session / user as verified and send an m.key.verification.mac event
100 //! Only call this after the user has confirmed the correctness of the emoji!
102 //! \deprecated Use KeyVerificationSession::confirm instead
104
105 //! \brief Start a SAS verification
107 //! \deprecated Use KeyVerificationSession::startSas instead
109
111
116
120
122
123 Quotient::Room* room() const;
124
125 //! \internal
127
128private:
136 bool weStarted = false;
137 QTimer *m_processTimer = nullptr;
138
139 void setState(State state);
142 bool sasMonitorStarted = false;
143
144 friend class Quotient::Connection;
149};
150
151} // namespace Quotient
#define QUOTIENT_API
#define DECL_DEPRECATED_ENUMERATOR(Deprecated, Recommended)
Definition util.h:22