aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppEncryptedFileSource.h
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb@kaidan.im>2022-09-24 17:58:44 +0200
committerGitHub <noreply@github.com>2022-09-24 17:58:44 +0200
commiteb63b18dcbb2ccdf811461a42f120e5d0ab82e88 (patch)
treec640d0a4e663912fbcb8b4bf1971874bd5f295b3 /src/base/QXmppEncryptedFileSource.h
parent9f474d28ffeb6e2a55fe1fb688463e1156c8fcb6 (diff)
downloadqxmpp-eb63b18dcbb2ccdf811461a42f120e5d0ab82e88.tar.gz
EncryptedFileSource: Make public (#469)
The sources possibly need to be saved by clients.
Diffstat (limited to 'src/base/QXmppEncryptedFileSource.h')
-rw-r--r--src/base/QXmppEncryptedFileSource.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/base/QXmppEncryptedFileSource.h b/src/base/QXmppEncryptedFileSource.h
new file mode 100644
index 00000000..3d7a7c90
--- /dev/null
+++ b/src/base/QXmppEncryptedFileSource.h
@@ -0,0 +1,56 @@
+// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
+// SPDX-FileCopyrightText: 2022 Jonah BrĂ¼chert <jbb@kaidan.im>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef QXMPPENCRYPTEDFILESOURCE_H
+#define QXMPPENCRYPTEDFILESOURCE_H
+
+#include "QXmppGlobal.h"
+#include "QXmppHash.h"
+#include "QXmppHttpFileSource.h"
+
+#include <QSharedDataPointer>
+#include <QUrl>
+#include <QVector>
+
+class QXmppEncryptedFileSourcePrivate;
+
+// exported for tests
+class QXMPP_EXPORT QXmppEncryptedFileSource
+{
+public:
+ enum Cipher {
+ Aes128GcmNopadding,
+ Aes256GcmNopadding,
+ Aes256CbcPkcs7,
+ };
+
+ QXmppEncryptedFileSource();
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppEncryptedFileSource)
+
+ Cipher cipher() const;
+ void setCipher(Cipher newCipher);
+
+ const QByteArray &key() const;
+ void setKey(const QByteArray &newKey);
+
+ const QByteArray &iv() const;
+ void setIv(const QByteArray &newIv);
+
+ const QVector<QXmppHash> &hashes() const;
+ void setHashes(const QVector<QXmppHash> &newHashes);
+
+ const QVector<QXmppHttpFileSource> &httpSources() const;
+ void setHttpSources(const QVector<QXmppHttpFileSource> &newHttpSources);
+
+ /// \cond
+ bool parse(const QDomElement &el);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+private:
+ QSharedDataPointer<QXmppEncryptedFileSourcePrivate> d;
+};
+
+#endif // QXMPPENCRYPTEDFILESOURCE_H