diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h @@ -29,9 +29,7 @@ static std::once_flag initialized; static int sqlcipherEncryptionKeySize; - static std::string secureStoreEncryptionKeyID; static int backupLogsEncryptionKeySize; - static std::string secureStoreBackupLogsEncryptionKeyID; static std::string backupLogsEncryptionKey; #ifndef EMSCRIPTEN diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp @@ -33,12 +33,7 @@ std::string SQLiteQueryExecutor::encryptionKey; std::once_flag SQLiteQueryExecutor::initialized; int SQLiteQueryExecutor::sqlcipherEncryptionKeySize = 64; -// Should match constant defined in `native_rust_library/src/constants.rs` -std::string SQLiteQueryExecutor::secureStoreEncryptionKeyID = - "comm.encryptionKey"; int SQLiteQueryExecutor::backupLogsEncryptionKeySize = 32; -std::string SQLiteQueryExecutor::secureStoreBackupLogsEncryptionKeyID = - "comm.backupLogsEncryptionKey"; std::string SQLiteQueryExecutor::backupLogsEncryptionKey; #ifndef EMSCRIPTEN @@ -2977,10 +2972,9 @@ std::call_once(SQLiteQueryExecutor::initialized, [&databasePath]() { SQLiteQueryExecutor::sqliteFilePath = databasePath; folly::Optional maybeEncryptionKey = - CommSecureStore::get(SQLiteQueryExecutor::secureStoreEncryptionKeyID); + CommSecureStore::get(CommSecureStore::encryptionKey); folly::Optional maybeBackupLogsEncryptionKey = - CommSecureStore::get( - SQLiteQueryExecutor::secureStoreBackupLogsEncryptionKeyID); + CommSecureStore::get(CommSecureStore::backupLogsEncryptionKey); if (file_exists(databasePath) && maybeEncryptionKey && maybeBackupLogsEncryptionKey) { @@ -3135,8 +3129,7 @@ void SQLiteQueryExecutor::generateFreshEncryptionKey() { std::string encryptionKey = comm::crypto::Tools::generateRandomHexString( SQLiteQueryExecutor::sqlcipherEncryptionKeySize); - CommSecureStore::set( - SQLiteQueryExecutor::secureStoreEncryptionKeyID, encryptionKey); + CommSecureStore::set(CommSecureStore::encryptionKey, encryptionKey); SQLiteQueryExecutor::encryptionKey = encryptionKey; SQLiteQueryExecutor::generateFreshBackupLogsEncryptionKey(); } @@ -3146,8 +3139,7 @@ comm::crypto::Tools::generateRandomHexString( SQLiteQueryExecutor::backupLogsEncryptionKeySize); CommSecureStore::set( - SQLiteQueryExecutor::secureStoreBackupLogsEncryptionKeyID, - backupLogsEncryptionKey); + CommSecureStore::backupLogsEncryptionKey, backupLogsEncryptionKey); SQLiteQueryExecutor::backupLogsEncryptionKey = backupLogsEncryptionKey; } diff --git a/native/cpp/CommonCpp/Tools/CommSecureStore.h b/native/cpp/CommonCpp/Tools/CommSecureStore.h --- a/native/cpp/CommonCpp/Tools/CommSecureStore.h +++ b/native/cpp/CommonCpp/Tools/CommSecureStore.h @@ -10,9 +10,13 @@ public: static void set(const std::string key, const std::string value); static folly::Optional get(const std::string key); + // Should match constant defined in `native_rust_library/src/constants.rs` inline static const std::string commServicesAccessToken = "accessToken"; inline static const std::string userID = "userID"; inline static const std::string deviceID = "deviceID"; + inline static const std::string encryptionKey = "comm.encryptionKey"; + inline static const std::string backupLogsEncryptionKey = + "comm.backupLogsEncryptionKey"; }; } // namespace comm diff --git a/native/native_rust_library/src/constants.rs b/native/native_rust_library/src/constants.rs --- a/native/native_rust_library/src/constants.rs +++ b/native/native_rust_library/src/constants.rs @@ -12,7 +12,6 @@ pub const COMM_SERVICES_ACCESS_TOKEN: &str = "accessToken"; pub const USER_ID: &str = "userID"; pub const DEVICE_ID: &str = "deviceID"; - /// Should match constant defined in `SQLiteQueryExecutor.h` pub const SECURE_STORE_ENCRYPTION_KEY_ID: &str = "comm.encryptionKey"; pub const SECURE_STORE_BACKUP_LOGS_ENCRYPTION_KEY_ID: &str = "comm.backupLogsEncryptionKey"; diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@