12#include <immer/array.hpp>
16 namespace VerificationCancelCodes
20 inline const std::string
timeout =
"m.timeout";
40 namespace VerificationProcessStates
99 immer::flex_vector<std::pair<Party, Event>>
events;
155 [[nodiscard]] std::string
txnId()
const;
163 struct ValidateResult
172 static ValidateResult ok();
180 [[nodiscard]] ValidateResult validateEvent(
Event incomingEvent)
const;
190 [[nodiscard]]
Event makeEvent(std::string type,
json content)
const;
195 [[nodiscard]]
Event makeCancelEvent(std::string code)
const;
203 [[nodiscard]]
Event makeReadyEvent()
const;
213 [[nodiscard]]
Event makeStartEvent(std::string method)
const;
222 [[nodiscard]]
Event makeSasAcceptEvent();
231 [[nodiscard]]
Event makeSasKeyEvent();
240 [[nodiscard]]
Event makeSasMacEvent();
248 [[nodiscard]] std::pair<Party, Event> getStartEvent()
const;
251 [[nodiscard]]
Party getStartingParty()
const;
254 [[nodiscard]]
json addCommitmentToAcceptContent(
json content,
Event startEvent);
257 [[nodiscard]]
bool verifySasCommitment();
264 [[nodiscard]] std::string getTheirKey()
const;
267 [[nodiscard]] std::pair<VerificationProcessState, EventList> verifyKeyMac(
Event macEvent);
Definition sas-desc.hpp:16
const std::string mismatchedSas
Definition verification-process.hpp:26
const std::string userCancel
Definition verification-process.hpp:19
const std::string mismatchedCommitment
Definition verification-process.hpp:25
const std::string invalidMessage
Definition verification-process.hpp:23
const std::string timeout
Definition verification-process.hpp:20
const std::string keyMismatch
Definition verification-process.hpp:22
const std::string unknownMethod
Definition verification-process.hpp:21
const std::string acceptedElsewhere
Definition verification-process.hpp:24
const std::string unexpectedMessage
Definition verification-process.hpp:18
Definition location.hpp:10
std::variant< std::monostate, VerificationProcessStates::WeRequested, VerificationProcessStates::TheyRequested, VerificationProcessStates::WeReady, VerificationProcessStates::TheyReady, VerificationProcessStates::WeStartedSas, VerificationProcessStates::TheyStartedSas, VerificationProcessStates::WeAcceptedSas, VerificationProcessStates::TheyAcceptedSas, VerificationProcessStates::ReceivedSasKey, VerificationProcessStates::ReceivedSasMac, VerificationProcessStates::VerifiedThem, VerificationProcessStates::VerifiedBoth, VerificationProcessStates::Cancelled > VerificationProcessState
Definition verification-process.hpp:77
nlohmann::json json
Definition jsonwrap.hpp:20
std::int_fast64_t Timestamp
Definition event.hpp:18
immer::flex_vector< Event > EventList
Definition types.hpp:107
Definition verification-process.hpp:30
immer::array< int > emojiIndices
The indices of emojis to display They can be converted to emojis using the table at https://spec....
Definition verification-process.hpp:34
friend bool operator==(const SasDisplayCodes &a, const SasDisplayCodes &b)=default
immer::array< int > decimalCode
The numbers to display.
Definition verification-process.hpp:36
Definition verification-process.hpp:56
std::string reasonCode
Definition verification-process.hpp:57
std::string reasonString
Definition verification-process.hpp:58
Definition verification-process.hpp:51
Definition verification-process.hpp:52
Definition verification-process.hpp:49
Definition verification-process.hpp:45
Definition verification-process.hpp:43
Definition verification-process.hpp:47
Definition verification-process.hpp:54
Definition verification-process.hpp:53
Definition verification-process.hpp:48
Definition verification-process.hpp:44
Definition verification-process.hpp:42
Definition verification-process.hpp:46
Definition verification-process.hpp:85
Definition verification-process.hpp:80
void addOutgoing(Event e)
Add an outgoing event to the process.
Definition verification-process.cpp:287
void setTheirDeviceKey(std::string key)
Set the device key of the other party.
Definition verification-process.cpp:81
std::string theirDeviceKey
Definition verification-process.hpp:102
static const immer::flex_vector< std::string > supportedKeyAgreementProtocols
Definition verification-process.hpp:88
EventList userCancel()
Signal that the user wants to cancel the verification.
Definition verification-process.cpp:310
EventList userReady()
Signal that the user is ready for an incoming verification.
Definition verification-process.cpp:299
EventList makeRequest(Timestamp now)
Make an outgoing verification request to the other party.
Definition verification-process.cpp:360
Party
Definition verification-process.hpp:81
@ Them
Definition verification-process.hpp:83
@ Us
Definition verification-process.hpp:82
static const immer::flex_vector< std::string > supportedHashes
Definition verification-process.hpp:87
static const immer::flex_vector< std::string > supportedMessageAuthenticationCodes
Definition verification-process.hpp:89
VerificationProcessState state
Definition verification-process.hpp:105
bool confirmedMatch
Definition verification-process.hpp:100
Timestamp requestTimestamp() const
Get the request timestamp for this process.
Definition verification-process.cpp:387
EventList processIncoming(Event e)
Process an incoming event.
Definition verification-process.cpp:177
std::string theirDeviceId
Definition verification-process.hpp:97
std::string theirUserId
Definition verification-process.hpp:96
std::string ourDeviceKey
Definition verification-process.hpp:101
static const immer::flex_vector< std::string > supportedMethods
Definition verification-process.hpp:86
static const immer::flex_vector< std::string > defaultShortAuthenticationString
Definition verification-process.hpp:90
SasDesc sas
Definition verification-process.hpp:104
SasDisplayCodes codes
Definition verification-process.hpp:106
std::string txnId() const
Get the transaction id for this process.
Definition verification-process.cpp:378
EventList userConfirmMatch()
Signal that the user has confirmed that the codes match.
Definition verification-process.cpp:321
std::string ourUserId
Definition verification-process.hpp:94
immer::flex_vector< std::pair< Party, Event > > events
A list of events that have been transmitted between the parties.
Definition verification-process.hpp:99
std::string ourDeviceId
Definition verification-process.hpp:95
EventList userDenyMatch()
Signal that the user has noticed that the codes do not match.
Definition verification-process.cpp:346