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 @@ -30,6 +30,8 @@ static void clearSensitiveData(); static std::string getNotificationsIdentityKeys(const std::string &callingProcessName); + static std::string + generateAndGetNotificationsPrekey(const std::string &callingProcessName); static crypto::EncryptedData initializeNotificationsSession( const std::string &identityKeys, const std::string &prekey, 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 @@ -192,6 +192,16 @@ return identityKeys; } +std::string NotificationsCryptoModule::generateAndGetNotificationsPrekey( + const std::string &callingProcessName) { + std::string prekey; + auto caller = [&prekey](crypto::CryptoModule cryptoModule) { + prekey = cryptoModule.generateAndGetPrekey(); + }; + NotificationsCryptoModule::callCryptoModule(caller, callingProcessName); + return prekey; +} + crypto::EncryptedData NotificationsCryptoModule::initializeNotificationsSession( const std::string &identityKeys, const std::string &prekey,