summary refs log tree commit diff
path: root/src/Cache_p.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-08 20:08:38 +0200
committerGitHub <noreply@github.com>2020-10-08 20:08:38 +0200
commit517a126a4427972668a97b21fc8684f7160976b9 (patch)
tree27142d719f848abe685897cd367e8d69a9bed719 /src/Cache_p.h
parentMerge pull request #294 from trilene/master (diff)
parentTry to fix windows build (diff)
downloadnheko-517a126a4427972668a97b21fc8684f7160976b9.tar.xz
Merge pull request #270 from Chethan2k1/device-verification
Device verification and Cross-Signing
Diffstat (limited to 'src/Cache_p.h')
-rw-r--r--src/Cache_p.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Cache_p.h b/src/Cache_p.h

index c57995a2..b3f4c58c 100644 --- a/src/Cache_p.h +++ b/src/Cache_p.h
@@ -54,6 +54,23 @@ public: mtx::presence::PresenceState presenceState(const std::string &user_id); std::string statusMessage(const std::string &user_id); + // user cache stores user keys + std::optional<UserKeyCache> userKeys(const std::string &user_id); + void updateUserKeys(const std::string &sync_token, + const mtx::responses::QueryKeys &keyQuery); + void markUserKeysOutOfDate(lmdb::txn &txn, + lmdb::dbi &db, + const std::vector<std::string> &user_ids, + const std::string &sync_token); + void deleteUserKeys(lmdb::txn &txn, + lmdb::dbi &db, + const std::vector<std::string> &user_ids); + + // device & user verification cache + VerificationStatus verificationStatus(const std::string &user_id); + void markDeviceVerified(const std::string &user_id, const std::string &device); + void markDeviceUnverified(const std::string &user_id, const std::string &device); + static void removeDisplayName(const QString &room_id, const QString &user_id); static void removeAvatarUrl(const QString &room_id, const QString &user_id); @@ -233,6 +250,7 @@ public: OutboundGroupSessionDataRef getOutboundMegolmSession(const std::string &room_id); bool outboundMegolmSessionExists(const std::string &room_id) noexcept; void updateOutboundMegolmSession(const std::string &room_id, int message_index); + void dropOutboundMegolmSession(const std::string &room_id); void importSessionKeys(const mtx::crypto::ExportedSessionKeys &keys); mtx::crypto::ExportedSessionKeys exportSessionKeys(); @@ -262,6 +280,9 @@ signals: void newReadReceipts(const QString &room_id, const std::vector<QString> &event_ids); void roomReadStatus(const std::map<QString, bool> &status); void removeNotification(const QString &room_id, const QString &event_id); + void userKeysUpdate(const std::string &sync_token, + const mtx::responses::QueryKeys &keyQuery); + void verificationStatusChanged(const std::string &userid); private: //! Save an invited room. @@ -527,6 +548,16 @@ private: return lmdb::dbi::open(txn, "presence", MDB_CREATE); } + lmdb::dbi getUserKeysDb(lmdb::txn &txn) + { + return lmdb::dbi::open(txn, "user_key", MDB_CREATE); + } + + lmdb::dbi getVerificationDb(lmdb::txn &txn) + { + return lmdb::dbi::open(txn, "verified", MDB_CREATE); + } + //! Retrieves or creates the database that stores the open OLM sessions between our device //! and the given curve25519 key which represents another device. //! @@ -545,6 +576,8 @@ private: return QString::fromStdString(event.state_key); } + std::optional<VerificationCache> verificationCache(const std::string &user_id); + void setNextBatchToken(lmdb::txn &txn, const std::string &token); void setNextBatchToken(lmdb::txn &txn, const QString &token); @@ -569,6 +602,7 @@ private: static QHash<QString, QString> AvatarUrls; OlmSessionStorage session_storage; + VerificationStorage verification_storage; }; namespace cache {