aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptedfile.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-29 12:46:11 +0200
committerGitHub <noreply@github.com>2022-05-29 12:46:11 +0200
commit346c36768e145435a54ce0ba6138af916410cbea (patch)
treefb78230a898754b2df982b890a4129839937f110 /lib/events/encryptedfile.h
parent729ba7da174eacc88bf9bd4e2e80eeab3fc92716 (diff)
parent0f8335a32debc4c61d9fc9875c79c0ba6ba05357 (diff)
downloadlibquotient-346c36768e145435a54ce0ba6138af916410cbea.tar.gz
libquotient-346c36768e145435a54ce0ba6138af916410cbea.zip
Merge pull request #556 from quotient-im/kitsune/fixes
Cleanup and refactoring
Diffstat (limited to 'lib/events/encryptedfile.h')
-rw-r--r--lib/events/encryptedfile.h63
1 files changed, 0 insertions, 63 deletions
diff --git a/lib/events/encryptedfile.h b/lib/events/encryptedfile.h
deleted file mode 100644
index 022ac91e..00000000
--- a/lib/events/encryptedfile.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
-//
-// SPDX-License-Identifier: LGPL-2.1-or-later
-
-#pragma once
-
-#include "converters.h"
-
-namespace Quotient {
-/**
- * JSON Web Key object as specified in
- * https://spec.matrix.org/unstable/client-server-api/#extensions-to-mroommessage-msgtypes
- * The only currently relevant member is `k`, the rest needs to be set to the defaults specified in the spec.
- */
-struct JWK
-{
- Q_GADGET
- Q_PROPERTY(QString kty MEMBER kty CONSTANT)
- Q_PROPERTY(QStringList keyOps MEMBER keyOps CONSTANT)
- Q_PROPERTY(QString alg MEMBER alg CONSTANT)
- Q_PROPERTY(QString k MEMBER k CONSTANT)
- Q_PROPERTY(bool ext MEMBER ext CONSTANT)
-
-public:
- QString kty;
- QStringList keyOps;
- QString alg;
- QString k;
- bool ext;
-};
-
-struct QUOTIENT_API EncryptedFile
-{
- Q_GADGET
- Q_PROPERTY(QUrl url MEMBER url CONSTANT)
- Q_PROPERTY(JWK key MEMBER key CONSTANT)
- Q_PROPERTY(QString iv MEMBER iv CONSTANT)
- Q_PROPERTY(QHash<QString, QString> hashes MEMBER hashes CONSTANT)
- Q_PROPERTY(QString v MEMBER v CONSTANT)
-
-public:
- QUrl url;
- JWK key;
- QString iv;
- QHash<QString, QString> hashes;
- QString v;
-
- QByteArray decryptFile(const QByteArray &ciphertext) const;
- static std::pair<EncryptedFile, QByteArray> encryptFile(const QByteArray& plainText);
-};
-
-template <>
-struct QUOTIENT_API JsonObjectConverter<EncryptedFile> {
- static void dumpTo(QJsonObject& jo, const EncryptedFile& pod);
- static void fillFrom(const QJsonObject& jo, EncryptedFile& pod);
-};
-
-template <>
-struct QUOTIENT_API JsonObjectConverter<JWK> {
- static void dumpTo(QJsonObject& jo, const JWK& pod);
- static void fillFrom(const QJsonObject& jo, JWK& pod);
-};
-} // namespace Quotient