diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-09-26 15:20:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 15:20:53 +0200 |
commit | 4c8dcbc308eb0f4900e416e698f5f30e71daaad8 (patch) | |
tree | aa5fdaa81234a21c6919fac4958f84d7c26cd397 /lib/e2ee/qolmaccount.h | |
parent | 5904a61c59f0eef00aef07ef998658fd791ff139 (diff) | |
parent | 15b840d82d4794358fbf1271ea76e446b47db7e5 (diff) | |
download | libquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.tar.gz libquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.zip |
Merge #571: Unify reporting and handling of Olm errors
Diffstat (limited to 'lib/e2ee/qolmaccount.h')
-rw-r--r-- | lib/e2ee/qolmaccount.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/e2ee/qolmaccount.h b/lib/e2ee/qolmaccount.h index f2a31314..a5faa82a 100644 --- a/lib/e2ee/qolmaccount.h +++ b/lib/e2ee/qolmaccount.h @@ -24,7 +24,8 @@ class QUOTIENT_API QOlmAccount : public QObject { Q_OBJECT public: - QOlmAccount(const QString &userId, const QString &deviceId, QObject *parent = nullptr); + QOlmAccount(QStringView userId, QStringView deviceId, + QObject* parent = nullptr); ~QOlmAccount() override; //! Creates a new instance of OlmAccount. During the instantiation @@ -36,10 +37,11 @@ public: //! Deserialises from encrypted Base64 that was previously obtained by pickling a `QOlmAccount`. //! This needs to be called before any other action or use createNewAccount() instead. - void unpickle(QByteArray &pickled, const PicklingMode &mode); + [[nodiscard]] OlmErrorCode unpickle(QByteArray&& pickled, + const PicklingMode& mode); //! Serialises an OlmAccount to encrypted Base64. - QOlmExpected<QByteArray> pickle(const PicklingMode &mode); + QByteArray pickle(const PicklingMode &mode); //! Returns the account's public identity keys already formatted as JSON IdentityKeys identityKeys() const; @@ -69,12 +71,11 @@ public: DeviceKeys deviceKeys() const; //! Remove the one time key used to create the supplied session. - [[nodiscard]] std::optional<QOlmError> removeOneTimeKeys( - const QOlmSession& session); + [[nodiscard]] OlmErrorCode removeOneTimeKeys(const QOlmSession& session); //! Creates an inbound session for sending/receiving messages from a received 'prekey' message. //! - //! \param message An Olm pre-key message that was encrypted for this account. + //! \param preKeyMessage An Olm pre-key message that was encrypted for this account. QOlmExpected<QOlmSessionPtr> createInboundSession( const QOlmMessage& preKeyMessage); @@ -92,6 +93,9 @@ public: void markKeysAsPublished(); + OlmErrorCode lastErrorCode() const; + const char* lastError() const; + // HACK do not use directly QOlmAccount(OlmAccount *account); OlmAccount *data(); @@ -103,6 +107,8 @@ private: OlmAccount *m_account = nullptr; // owning QString m_userId; QString m_deviceId; + + QString accountId() const; }; QUOTIENT_API bool verifyIdentitySignature(const DeviceKeys& deviceKeys, |