aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmoutboundsession.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/qolmoutboundsession.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/qolmoutboundsession.h')
-rw-r--r--lib/e2ee/qolmoutboundsession.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/e2ee/qolmoutboundsession.h b/lib/e2ee/qolmoutboundsession.h
index 9a82d22a..d36fbf69 100644
--- a/lib/e2ee/qolmoutboundsession.h
+++ b/lib/e2ee/qolmoutboundsession.h
@@ -6,8 +6,7 @@
#include "e2ee/e2ee.h"
-#include <memory>
-#include <olm/olm.h>
+struct OlmOutboundGroupSession;
namespace Quotient {
@@ -21,14 +20,14 @@ public:
//! Throw OlmError on errors
static QOlmOutboundGroupSessionPtr create();
//! Serialises a `QOlmOutboundGroupSession` 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 `QOlmOutboundGroupSession`.
static QOlmExpected<QOlmOutboundGroupSessionPtr> unpickle(
- const QByteArray& pickled, const PicklingMode& mode);
+ QByteArray&& pickled, const PicklingMode& mode);
//! Encrypts a plaintext message using the session.
- QOlmExpected<QByteArray> encrypt(const QString& plaintext) const;
+ QByteArray encrypt(const QByteArray& plaintext) const;
//! Get the current message index for this session.
//!
@@ -43,7 +42,7 @@ public:
//!
//! Each message is sent with a different ratchet key. This function returns the
//! ratchet key that will be used for the next message.
- QOlmExpected<QByteArray> sessionKey() const;
+ QByteArray sessionKey() const;
QOlmOutboundGroupSession(OlmOutboundGroupSession *groupSession);
int messageCount() const;
@@ -51,6 +50,10 @@ public:
QDateTime creationTime() const;
void setCreationTime(const QDateTime& creationTime);
+
+ OlmErrorCode lastErrorCode() const;
+ const char* lastError() const;
+
private:
OlmOutboundGroupSession *m_groupSession;
int m_messageCount = 0;