diff options
Diffstat (limited to 'lib/converters.cpp')
-rw-r--r-- | lib/converters.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/converters.cpp b/lib/converters.cpp index 444ca4f6..e6dcd854 100644 --- a/lib/converters.cpp +++ b/lib/converters.cpp @@ -3,15 +3,26 @@ #include "converters.h" -#include <QtCore/QVariant> +#include <QVariant> +#include "crypto/e2ee.h" QJsonValue Quotient::JsonConverter<QVariant>::dump(const QVariant& v) { + if (v.canConvert<SignedOneTimeKey>()) { + return toJson(v.value<SignedOneTimeKey>()); + } return QJsonValue::fromVariant(v); } QVariant Quotient::JsonConverter<QVariant>::load(const QJsonValue& jv) { + if (jv.isObject()) { + QJsonObject obj = jv.toObject(); + if (obj.contains("key") && obj.contains("signatures")) { + SignedOneTimeKey signedOneTimeKeys; + signedOneTimeKeys.key = obj["key"].toString(); + } + } return jv.toVariant(); } |