aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/e2ee/e2ee.h4
-rw-r--r--lib/e2ee/qolmaccount.cpp16
-rw-r--r--lib/e2ee/qolmaccount.h2
3 files changed, 7 insertions, 15 deletions
diff --git a/lib/e2ee/e2ee.h b/lib/e2ee/e2ee.h
index e21aa87b..361c48ff 100644
--- a/lib/e2ee/e2ee.h
+++ b/lib/e2ee/e2ee.h
@@ -55,10 +55,10 @@ struct IdentityKeys
//! Struct representing the one-time keys.
struct QUOTIENT_API OneTimeKeys
{
- QMap<QString, QMap<QString, QString>> keys;
+ QHash<QString, QHash<QString, QString>> keys;
//! Get the HashMap containing the curve25519 one-time keys.
- QMap<QString, QString> curve25519() const;
+ QHash<QString, QString> curve25519() const;
//! Get a reference to the hashmap corresponding to given key type.
// std::optional<QHash<QString, QString>> get(QString keyType) const;
diff --git a/lib/e2ee/qolmaccount.cpp b/lib/e2ee/qolmaccount.cpp
index 9cbb14f5..476a60bd 100644
--- a/lib/e2ee/qolmaccount.cpp
+++ b/lib/e2ee/qolmaccount.cpp
@@ -14,7 +14,7 @@
using namespace Quotient;
-QMap<QString, QString> OneTimeKeys::curve25519() const
+QHash<QString, QString> OneTimeKeys::curve25519() const
{
return keys[Curve25519Key];
}
@@ -164,21 +164,13 @@ OneTimeKeys QOlmAccount::oneTimeKeys() const
}
const auto json = QJsonDocument::fromJson(oneTimeKeysBuffer).object();
OneTimeKeys oneTimeKeys;
-
- for (const QString& key1 : json.keys()) {
- auto oneTimeKeyObject = json[key1].toObject();
- auto keyMap = QMap<QString, QString>();
- for (const QString &key2 : oneTimeKeyObject.keys()) {
- keyMap[key2] = oneTimeKeyObject[key2].toString();
- }
- oneTimeKeys.keys[key1] = keyMap;
- }
+ fromJson(json, oneTimeKeys.keys);
return oneTimeKeys;
}
-QMap<QString, SignedOneTimeKey> QOlmAccount::signOneTimeKeys(const OneTimeKeys &keys) const
+QHash<QString, SignedOneTimeKey> QOlmAccount::signOneTimeKeys(const OneTimeKeys &keys) const
{
- QMap<QString, SignedOneTimeKey> signedOneTimeKeys;
+ QHash<QString, SignedOneTimeKey> signedOneTimeKeys;
for (const auto &keyid : keys.curve25519().keys()) {
const auto oneTimeKey = keys.curve25519()[keyid];
QByteArray sign = signOneTimeKey(oneTimeKey);
diff --git a/lib/e2ee/qolmaccount.h b/lib/e2ee/qolmaccount.h
index 17aca8aa..17f43f1a 100644
--- a/lib/e2ee/qolmaccount.h
+++ b/lib/e2ee/qolmaccount.h
@@ -67,7 +67,7 @@ public:
OneTimeKeys oneTimeKeys() const;
//! Sign all one time keys.
- QMap<QString, SignedOneTimeKey> signOneTimeKeys(const OneTimeKeys &keys) const;
+ QHash<QString, SignedOneTimeKey> signOneTimeKeys(const OneTimeKeys &keys) const;
//! Sign one time key.
QByteArray signOneTimeKey(const QString &key) const;