aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-27 18:10:06 +0100
committerGitHub <noreply@github.com>2022-02-27 18:10:06 +0100
commit7b1320be28024280d930617858f26dd4db34e68c (patch)
treedbc34f2a9090b967746332570c88382a188b162a /lib
parentbcc8d2d6547e2efd595628a1528ed609eccddad6 (diff)
parentf159d5ec0caf75468c802ee997630af8f7fda02d (diff)
downloadlibquotient-7b1320be28024280d930617858f26dd4db34e68c.tar.gz
libquotient-7b1320be28024280d930617858f26dd4db34e68c.zip
Merge #535: Convenience functions for querying user devices and keys from cache
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp16
-rw-r--r--lib/connection.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index b585fcc6..4abb77a5 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -2154,4 +2154,20 @@ void Connection::saveMegolmSession(Room* room, const QString& senderKey, QOlmInb
{
database()->saveMegolmSession(room->id(), senderKey, session->sessionId(), session->pickle(picklingMode()));
}
+
+QStringList Connection::devicesForUser(User* user) const
+{
+ return d->deviceKeys[user->id()].keys();
+}
+
+QString Connection::curveKeyForUserDevice(const QString& user, const QString& device) const
+{
+ return d->deviceKeys[user][device].keys["curve25519:" % device];
+}
+
+QString Connection::edKeyForUserDevice(const QString& user, const QString& device) const
+{
+ return d->deviceKeys[user][device].keys["ed25519:" % device];
+}
+
#endif
diff --git a/lib/connection.h b/lib/connection.h
index 165d8d68..4a475319 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -680,6 +680,10 @@ public Q_SLOTS:
void encryptionUpdate(Room *room);
PicklingMode picklingMode() const;
QJsonObject decryptNotification(const QJsonObject &notification);
+
+ QStringList devicesForUser(User* user) const;
+ QString curveKeyForUserDevice(const QString &user, const QString& device) const;
+ QString edKeyForUserDevice(const QString& user, const QString& device) const;
#endif
Q_SIGNALS:
/// \brief Initial server resolution has failed