aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmsession.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-26 15:20:53 +0200
committerGitHub <noreply@github.com>2022-09-26 15:20:53 +0200
commit4c8dcbc308eb0f4900e416e698f5f30e71daaad8 (patch)
treeaa5fdaa81234a21c6919fac4958f84d7c26cd397 /lib/e2ee/qolmsession.h
parent5904a61c59f0eef00aef07ef998658fd791ff139 (diff)
parent15b840d82d4794358fbf1271ea76e446b47db7e5 (diff)
downloadlibquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.tar.gz
libquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.zip
Merge #571: Unify reporting and handling of Olm errors
Diffstat (limited to 'lib/e2ee/qolmsession.h')
-rw-r--r--lib/e2ee/qolmsession.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/e2ee/qolmsession.h b/lib/e2ee/qolmsession.h
index 021092c7..400fb854 100644
--- a/lib/e2ee/qolmsession.h
+++ b/lib/e2ee/qolmsession.h
@@ -6,7 +6,6 @@
#include "e2ee/e2ee.h"
#include "e2ee/qolmmessage.h"
-#include "e2ee/qolmerrors.h"
#include "e2ee/qolmaccount.h"
struct OlmSession;
@@ -27,18 +26,18 @@ public:
const QOlmMessage& preKeyMessage);
static QOlmExpected<QOlmSessionPtr> createOutboundSession(
- QOlmAccount* account, const QString& theirIdentityKey,
- const QString& theirOneTimeKey);
+ QOlmAccount* account, const QByteArray& theirIdentityKey,
+ const QByteArray& theirOneTimeKey);
//! Serialises an `QOlmSession` to encrypted Base64.
- QOlmExpected<QByteArray> pickle(const PicklingMode &mode) const;
+ QByteArray pickle(const PicklingMode &mode) const;
- //! Deserialises from encrypted Base64 that was previously obtained by pickling a `QOlmSession`.
- static QOlmExpected<QOlmSessionPtr> unpickle(
- const QByteArray& pickled, const PicklingMode& mode);
+ //! Deserialises from encrypted Base64 previously made with pickle()
+ static QOlmExpected<QOlmSessionPtr> unpickle(QByteArray&& pickled,
+ const PicklingMode& mode);
//! Encrypts a plaintext message using the session.
- QOlmMessage encrypt(const QString &plaintext);
+ QOlmMessage encrypt(const QByteArray& plaintext);
//! Decrypts a message using this session. Decoding is lossy, meaning if
//! the decrypted plaintext contains invalid UTF-8 symbols, they will
@@ -48,9 +47,6 @@ public:
//! Get a base64-encoded identifier for this session.
QByteArray sessionId() const;
- //! The type of the next message that will be returned from encryption.
- QOlmMessage::Type encryptMessageType();
-
//! Checker for any received messages for this session.
bool hasReceivedMessage() const;
@@ -71,6 +67,9 @@ public:
return *lhs < *rhs;
}
+ OlmErrorCode lastErrorCode() const;
+ const char* lastError() const;
+
OlmSession* raw() const { return m_session; }
QOlmSession(OlmSession* session);