aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmaccount.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-14 14:06:14 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-16 17:58:17 +0100
commit2178ca994c4b33197239155f7f6715e0451b9172 (patch)
treed5f7e92fee9f94cf6a23507c8d9da08cc1501885 /lib/e2ee/qolmaccount.cpp
parent445e34f26450cf8262a65b74e1294579d9cd56be (diff)
downloadlibquotient-2178ca994c4b33197239155f7f6715e0451b9172.tar.gz
libquotient-2178ca994c4b33197239155f7f6715e0451b9172.zip
Use QHash instead of QMap
We don't seem to need sorted associative containers in those cases.
Diffstat (limited to 'lib/e2ee/qolmaccount.cpp')
-rw-r--r--lib/e2ee/qolmaccount.cpp16
1 files changed, 4 insertions, 12 deletions
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);