aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-03-07 19:56:10 +0100
committerTobias Fella <fella@posteo.de>2022-03-07 19:56:41 +0100
commitfb9d7dc22c74022b914b1964965ed6b8b850d831 (patch)
tree2b6e4b0b8bdfbd9b2b0b8e38e8257c0506532f5d /lib/database.cpp
parent66918a4c7d393a8b22de7bf23009651dbd919366 (diff)
downloadlibquotient-fb9d7dc22c74022b914b1964965ed6b8b850d831.tar.gz
libquotient-fb9d7dc22c74022b914b1964965ed6b8b850d831.zip
Store the device's ed25519 in the database
Diffstat (limited to 'lib/database.cpp')
-rw-r--r--lib/database.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/database.cpp b/lib/database.cpp
index 84c93046..13b41a70 100644
--- a/lib/database.cpp
+++ b/lib/database.cpp
@@ -83,7 +83,7 @@ void Database::migrateTo1()
transaction();
execute(QStringLiteral("CREATE TABLE accounts (pickle TEXT);"));
execute(QStringLiteral("CREATE TABLE olm_sessions (senderKey TEXT, sessionId TEXT, pickle TEXT);"));
- execute(QStringLiteral("CREATE TABLE inbound_megolm_sessions (roomId TEXT, senderKey TEXT, sessionId TEXT, pickle TEXT);"));
+ execute(QStringLiteral("CREATE TABLE inbound_megolm_sessions (roomId TEXT, senderKey TEXT, sessionId TEXT, ed25519Key TEXT, pickle TEXT);"));
execute(QStringLiteral("CREATE TABLE outbound_megolm_sessions (roomId TEXT, senderKey TEXT, sessionId TEXT, pickle TEXT);"));
execute(QStringLiteral("CREATE TABLE group_session_record_index (roomId TEXT, sessionId TEXT, i INTEGER, eventId TEXT, ts INTEGER);"));
execute(QStringLiteral("CREATE TABLE tracked_users (matrixId TEXT);"));
@@ -179,12 +179,13 @@ UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> Database::
return sessions;
}
-void Database::saveMegolmSession(const QString& roomId, const QString& senderKey, const QString& sessionId, const QByteArray& pickle)
+void Database::saveMegolmSession(const QString& roomId, const QString& senderKey, const QString& sessionId, const QString& ed25519Key, const QByteArray& pickle)
{
- auto query = prepareQuery(QStringLiteral("INSERT INTO inbound_megolm_sessions(roomId, senderKey, sessionId, pickle) VALUES(:roomId, :senderKey, :sessionId, :pickle);"));
+ auto query = prepareQuery(QStringLiteral("INSERT INTO inbound_megolm_sessions(roomId, senderKey, sessionId, ed25519Key, pickle) VALUES(:roomId, :senderKey, :sessionId, :ed25519Key, :pickle);"));
query.bindValue(":roomId", roomId);
query.bindValue(":senderKey", senderKey);
query.bindValue(":sessionId", sessionId);
+ query.bindValue(":ed25519Key", ed25519Key);
query.bindValue(":pickle", pickle);
transaction();
execute(query);