Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3112322
D6777.id23322.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6777.id23322.diff
View Options
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
@@ -125,4 +125,33 @@
std::string(strerror(errno)));
}
}
+
+void NotificationsCryptoModule::initializeNotificationsCryptoAccount(
+ const std::string &callingProcessName) {
+ const std::string notificationsCryptoAccountPath =
+ PlatformSpecificTools::getNotificationsCryptoAccountPath();
+ std::ifstream notificationCryptoAccountCheck(notificationsCryptoAccountPath);
+ if (notificationCryptoAccountCheck.good()) {
+ // Implemented in CommmCoreModule semantics regarding public olm account
+ // initialization is idempotent. We should follow the same approach when it
+ // comes to notifications
+ notificationCryptoAccountCheck.close();
+ return;
+ }
+ // There is no reason to check if the key is already present since if we are
+ // in this place in the code we are about to create new account
+ CommSecureStore secureStore{};
+ std::string picklingKey = crypto::Tools::generateRandomString(64);
+ secureStore.set(
+ NotificationsCryptoModule::secureStoreNotificationsAccountDataKey,
+ picklingKey);
+
+ crypto::CryptoModule cryptoModule{
+ NotificationsCryptoModule::notificationsCryptoAccountID};
+ NotificationsCryptoModule::serializeAndFlushCryptoModule(
+ cryptoModule,
+ notificationsCryptoAccountPath,
+ picklingKey,
+ callingProcessName);
+}
} // namespace comm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 1, 5:07 PM (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2399458
Default Alt Text
D6777.id23322.diff (1 KB)
Attached To
Mode
D6777: Implement public method to initialize (generate and persist new) notifications olm account
Attached
Detach File
Event Timeline
Log In to Comment