libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
qolmsession.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021 Alexey Andreyev <aa13q@ya.ru>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#pragma once
6
7#include <Quotient/e2ee/e2ee_common.h>
8#include <Quotient/e2ee/qolmmessage.h>
9
10struct OlmSession;
11
12namespace Quotient {
13
14class QOlmAccount;
15
16//! Either an outbound or inbound session for secure communication.
18{
19public:
20 //! Serialises an `QOlmSession` to encrypted Base64.
22
23 //! Deserialises from encrypted Base64 previously made with pickle()
25 const PicklingKey& key);
26
27 //! Encrypts a plaintext message using the session.
29
30 //! Decrypts a message using this session. Decoding is lossy, meaning if
31 //! the decrypted plaintext contains invalid UTF-8 symbols, they will
32 //! be returned as `U+FFFD`.
34
35 //! Get a base64-encoded identifier for this session.
37
38 //! Checker for any received messages for this session.
39 bool hasReceivedMessage() const;
40
41 //! Checks if the 'prekey' message is for this in-bound session.
43
44 //! Checks if the 'prekey' message is for this in-bound session.
46 const QOlmMessage& preKeyMessage) const;
47
48 friend bool operator<(const QOlmSession& lhs, const QOlmSession& rhs)
49 {
50 return lhs.sessionId() < rhs.sessionId();
51 }
52
54 const char* lastError() const;
55
56private:
60
61 friend class QOlmAccount;
62};
63} //namespace Quotient
Either an outbound or inbound session for secure communication.
Definition qolmsession.h:18
#define QUOTIENT_API