diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-08-24 09:41:51 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-08-24 09:41:51 +0200 |
commit | 82f4efb0227e7e22e831733fae3952818b063ac2 (patch) | |
tree | 3b154a16f9d355996a59c611230d0e010edab57f /lib/e2ee/qolmoutboundsession.h | |
parent | 16d4f4e48304543a0ab59b235edba07f5f2c2204 (diff) | |
parent | 6308bff3336ca7680eee54d9bd125f780fa9f033 (diff) | |
download | libquotient-82f4efb0227e7e22e831733fae3952818b063ac2.tar.gz libquotient-82f4efb0227e7e22e831733fae3952818b063ac2.zip |
Merge branch 'dev' into device-verification
# Conflicts:
# autotests/testfilecrypto.cpp
# lib/connection.cpp
# lib/connection.h
# lib/database.cpp
# lib/database.h
# lib/e2ee/qolmoutboundsession.cpp
# lib/e2ee/qolmoutboundsession.h
# lib/eventitem.h
# lib/events/encryptedevent.cpp
# lib/events/encryptedevent.h
# lib/events/encryptedfile.cpp
# lib/events/encryptedfile.h
# lib/events/keyverificationevent.cpp
# lib/events/keyverificationevent.h
# lib/events/roomkeyevent.h
# lib/room.cpp
# lib/room.h
Diffstat (limited to 'lib/e2ee/qolmoutboundsession.h')
-rw-r--r-- | lib/e2ee/qolmoutboundsession.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/e2ee/qolmoutboundsession.h b/lib/e2ee/qolmoutboundsession.h index 10ca35c0..9a82d22a 100644 --- a/lib/e2ee/qolmoutboundsession.h +++ b/lib/e2ee/qolmoutboundsession.h @@ -4,10 +4,10 @@ #pragma once -#include "olm/olm.h" -#include "e2ee/qolmerrors.h" #include "e2ee/e2ee.h" + #include <memory> +#include <olm/olm.h> namespace Quotient { @@ -19,15 +19,16 @@ public: ~QOlmOutboundGroupSession(); //! Creates a new instance of `QOlmOutboundGroupSession`. //! Throw OlmError on errors - static std::unique_ptr<QOlmOutboundGroupSession> create(); + static QOlmOutboundGroupSessionPtr create(); //! Serialises a `QOlmOutboundGroupSession` to encrypted Base64. - std::variant<QByteArray, QOlmError> pickle(const PicklingMode &mode); + QOlmExpected<QByteArray> pickle(const PicklingMode &mode) const; //! Deserialises from encrypted Base64 that was previously obtained by //! pickling a `QOlmOutboundGroupSession`. - static std::variant<std::unique_ptr<QOlmOutboundGroupSession>, QOlmError> - unpickle(const QByteArray& pickled, const PicklingMode& mode); + static QOlmExpected<QOlmOutboundGroupSessionPtr> unpickle( + const QByteArray& pickled, const PicklingMode& mode); + //! Encrypts a plaintext message using the session. - std::variant<QByteArray, QOlmError> encrypt(const QString &plaintext); + QOlmExpected<QByteArray> encrypt(const QString& plaintext) const; //! Get the current message index for this session. //! @@ -42,7 +43,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. - std::variant<QByteArray, QOlmError> sessionKey() const; + QOlmExpected<QByteArray> sessionKey() const; QOlmOutboundGroupSession(OlmOutboundGroupSession *groupSession); int messageCount() const; @@ -56,5 +57,4 @@ private: QDateTime m_creationTime = QDateTime::currentDateTime(); }; -using QOlmOutboundGroupSessionPtr = std::unique_ptr<QOlmOutboundGroupSession>; -} +} // namespace Quotient |