diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h @@ -32,9 +32,8 @@ OlmBuffer pickleAccount(const std::string &secretKey); public: - const std::string id; - CryptoModule(std::string id); - CryptoModule(std::string id, std::string secretKey, Persist persist); + CryptoModule(); + CryptoModule(std::string secretKey, Persist persist); // CryptoModule's accountBuffer cannot be safely copied // See explanation in https://phab.comm.dev/D9562 diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp @@ -17,15 +17,11 @@ const std::string SESSION_DOES_NOT_EXIST_ERROR{"SESSION_DOES_NOT_EXIST"}; const std::string INVALID_SESSION_VERSION_ERROR{"INVALID_SESSION_VERSION"}; -CryptoModule::CryptoModule(std::string id) : id{id} { +CryptoModule::CryptoModule() { this->createAccount(); } -CryptoModule::CryptoModule( - std::string id, - std::string secretKey, - Persist persist) - : id{id} { +CryptoModule::CryptoModule(std::string secretKey, Persist persist) { if (persist.isEmpty()) { this->createAccount(); } else { diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h @@ -33,9 +33,7 @@ std::unique_ptr cryptoThread; const std::string secureStoreAccountDataKey = "cryptoAccountDataKey"; - const std::string publicCryptoAccountID = "publicCryptoAccountID"; std::unique_ptr contentCryptoModule; - const std::string notifsCryptoAccountID = "notifsCryptoAccountID"; DraftStore draftStore; ThreadStore threadStore; diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp @@ -654,9 +654,7 @@ taskType cryptoJob = [=]() { std::string error; this->contentCryptoModule.reset(new crypto::CryptoModule( - this->publicCryptoAccountID, - storedSecretKey.value(), - contentPersist)); + storedSecretKey.value(), contentPersist)); std::optional< std::pair, std::string>> @@ -666,9 +664,7 @@ isNotificationsAccountInitialized()) { maybeNotifsCryptoAccountToPersist = { std::make_shared( - this->notifsCryptoAccountID, - storedSecretKey.value(), - notifsPersist), + storedSecretKey.value(), notifsPersist), storedSecretKey.value()}; } diff --git a/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.h b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.h --- a/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.h +++ b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.h @@ -7,8 +7,6 @@ namespace comm { class NotificationsCryptoModule { - const static std::string notificationsCryptoAccountID; - // Used for handling of legacy notifications sessions const static std::string secureStoreNotificationsAccountDataKey; const static std::string keyserverHostedNotificationsID; diff --git a/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.cpp b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.cpp --- a/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.cpp +++ b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModule.cpp @@ -22,8 +22,6 @@ const std::string NotificationsCryptoModule::secureStoreNotificationsAccountDataKey = "notificationsCryptoAccountDataKey"; -const std::string NotificationsCryptoModule::notificationsCryptoAccountID = - "notificationsCryptoAccountDataID"; const std::string NotificationsCryptoModule::keyserverHostedNotificationsID = "keyserverHostedNotificationsID"; const std::string NotificationsCryptoModule::initialEncryptedMessageContent = @@ -73,9 +71,7 @@ if (persistJSON["sessions"].isNull()) { return std::make_unique( - notificationsCryptoAccountID, - picklingKey, - crypto::Persist({account, sessions})); + picklingKey, crypto::Persist({account, sessions})); } for (auto &sessionKeyValuePair : persistJSON["sessions"].items()) { std::string targetUserID = sessionKeyValuePair.first.asString(); @@ -84,9 +80,7 @@ std::vector(sessionData.begin(), sessionData.end()), 1}; } return std::make_unique( - notificationsCryptoAccountID, - picklingKey, - crypto::Persist({account, sessions})); + picklingKey, crypto::Persist({account, sessions})); } void NotificationsCryptoModule::serializeAndFlushCryptoModule( @@ -339,7 +333,7 @@ std::shared_ptr cryptoModule = std::make_shared( - notificationsCryptoAccountID, picklingKey, serializedCryptoModule); + picklingKey, serializedCryptoModule); return {{cryptoModule, picklingKey}}; }