Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394769
D14000.id45993.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D14000.id45993.diff
View Options
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<std::string> maybeEncryptionKey =
- CommSecureStore::get(SQLiteQueryExecutor::secureStoreEncryptionKeyID);
+ CommSecureStore::get(CommSecureStore::encryptionKey);
folly::Optional<std::string> 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<std::string> 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$@<O00001
literal 0
Hc$@<O00001
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 9:56 PM (2 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596651
Default Alt Text
D14000.id45993.diff (4 KB)
Attached To
Mode
D14000: [CommCoreModule][native_rust_library] move constants to one place
Attached
Detach File
Event Timeline
Log In to Comment