7 #include <Quotient/converters.h>
20 Q_PROPERTY(QString kty MEMBER kty CONSTANT)
21 Q_PROPERTY(QStringList keyOps MEMBER keyOps CONSTANT)
22 Q_PROPERTY(QString alg MEMBER alg CONSTANT)
23 Q_PROPERTY(QString k MEMBER k CONSTANT)
24 Q_PROPERTY(
bool ext MEMBER ext CONSTANT)
36 Q_PROPERTY(QUrl url MEMBER url CONSTANT)
37 Q_PROPERTY(JWK key MEMBER key CONSTANT)
38 Q_PROPERTY(QString iv MEMBER iv CONSTANT)
39 Q_PROPERTY(QHash<QString, QString> hashes MEMBER hashes CONSTANT)
40 Q_PROPERTY(QString v MEMBER v CONSTANT)
41 Q_PROPERTY(
bool isValid READ isValid CONSTANT)
47 QHash<QString, QString> hashes;
50 bool isValid()
const {
return url.isValid(); }
53 QUOTIENT_API std::pair<EncryptedFileMetadata, QByteArray> encryptFile(
54 const QByteArray& plainText);
56 const EncryptedFileMetadata& metadata);
59 struct QUOTIENT_API JsonObjectConverter<EncryptedFileMetadata> {
60 static void dumpTo(QJsonObject& jo,
const EncryptedFileMetadata& pod);
61 static void fillFrom(
const QJsonObject& jo, EncryptedFileMetadata& pod);
66 static void dumpTo(QJsonObject& jo,
const JWK& pod);
67 static void fillFrom(
const QJsonObject& jo, JWK& pod);
70 using FileSourceInfo = std::variant<QUrl, EncryptedFileMetadata>;
72 using FileSourceInfoKeys = std::array<QLatin1String, std::variant_size_v<FileSourceInfo>>;
76 QUOTIENT_API void setUrlInSourceInfo(FileSourceInfo& fsi,
const QUrl& newUrl);
81 void fillJson(QJsonObject&,
const FileSourceInfo&) =
delete;
91 QUOTIENT_API void fillJson(QJsonObject& jo,
const FileSourceInfoKeys& jsonKeys,
92 const FileSourceInfo& fsi);
94 QUOTIENT_API FileSourceInfo fileSourceInfoFromJson(
const QJsonObject& jo,
95 const FileSourceInfoKeys& jsonKeys);
97 namespace FileMetadataMap {
99 const QString& eventId,
100 const EncryptedFileMetadata& fileMetadata);
102 const QString& eventId);
108 const QString& eventId);