Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3241519
D10939.id36602.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D10939.id36602.diff
View Options
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
@@ -25,6 +25,7 @@
void createAccount();
void exposePublicIdentityKeys();
void generateOneTimeKeys(size_t oneTimeKeysAmount);
+ std::string generateAndGetPrekey();
// returns number of published keys
size_t publishOneTimeKeys();
bool prekeyExistsAndOlderThan(uint64_t threshold);
@@ -50,7 +51,6 @@
std::string getPrekey();
std::string getPrekeySignature();
std::optional<std::string> getUnpublishedPrekey();
- std::string generateAndGetPrekey();
void markPrekeyAsPublished();
void forgetOldPrekey();
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
@@ -76,7 +76,6 @@
virtual jsi::Value getNotificationsOneTimeKeys(
jsi::Runtime &rt,
double oneTimeKeysAmount) override;
- virtual jsi::Value generateAndGetPrekeys(jsi::Runtime &rt) override;
virtual jsi::Value validateAndUploadPrekeys(
jsi::Runtime &rt,
jsi::String authUserID,
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
@@ -604,64 +604,6 @@
});
}
-jsi::Value CommCoreModule::generateAndGetPrekeys(jsi::Runtime &rt) {
- return createPromiseAsJSIValue(
- rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- taskType job = [=, &innerRt]() {
- std::string error;
- std::string contentPrekey, contentPrekeySignature, notifPrekey,
- notifPrekeySignature;
-
- if (this->cryptoModule == nullptr) {
- error = "user has not been initialized";
- } else {
- try {
- contentPrekey = this->cryptoModule->generateAndGetPrekey();
- contentPrekeySignature = this->cryptoModule->getPrekeySignature();
- this->persistCryptoModule();
- notifPrekey =
- NotificationsCryptoModule::generateAndGetNotificationsPrekey(
- "Comm");
- notifPrekeySignature =
- NotificationsCryptoModule::getNotificationsPrekeySignature(
- "Comm");
- } catch (const std::exception &e) {
- error = e.what();
- }
- }
-
- this->jsInvoker_->invokeAsync([=, &innerRt]() {
- if (error.size()) {
- promise->reject(error);
- return;
- }
- auto contentPrekeyJSI =
- jsi::String::createFromUtf8(innerRt, contentPrekey);
- auto contentPrekeySignatureJSI =
- jsi::String::createFromUtf8(innerRt, contentPrekeySignature);
- auto notifPrekeyJSI =
- jsi::String::createFromUtf8(innerRt, notifPrekey);
- auto notifPrekeySignatureJSI =
- jsi::String::createFromUtf8(innerRt, notifPrekeySignature);
-
- auto signedPrekeysJSI = jsi::Object(innerRt);
- signedPrekeysJSI.setProperty(
- innerRt, "contentPrekey", contentPrekeyJSI);
- signedPrekeysJSI.setProperty(
- innerRt, "contentPrekeySignature", contentPrekeySignatureJSI);
- signedPrekeysJSI.setProperty(
- innerRt, "notifPrekey", notifPrekeyJSI);
- signedPrekeysJSI.setProperty(
- innerRt, "notifPrekeySignature", notifPrekeySignatureJSI);
-
- promise->resolve(std::move(signedPrekeysJSI));
- });
- };
-
- this->cryptoThread->scheduleTask(job);
- });
-}
-
std::pair<std::string, std::string> getNotificationsPrekeyAndSignature() {
// TODO: Implement notifs prekey rotation.
// Notifications prekey is not rotated at this moment. It
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
@@ -35,8 +35,6 @@
static std::string
getNotificationsPrekey(const std::string &callingProcessName);
static std::string
- generateAndGetNotificationsPrekey(const std::string &callingProcessName);
- static std::string
getNotificationsPrekeySignature(const std::string &callingProcessName);
static std::string getNotificationsOneTimeKeys(
const size_t oneTimeKeysAmount,
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
@@ -214,17 +214,6 @@
return prekey;
}
-std::string NotificationsCryptoModule::generateAndGetNotificationsPrekey(
- const std::string &callingProcessName) {
- std::string prekey;
- auto caller =
- [&prekey](const std::unique_ptr<crypto::CryptoModule> &cryptoModule) {
- prekey = cryptoModule->generateAndGetPrekey();
- };
- NotificationsCryptoModule::callCryptoModule(caller, callingProcessName);
- return prekey;
-}
-
std::string NotificationsCryptoModule::getNotificationsPrekeySignature(
const std::string &callingProcessName) {
std::string prekeySignature;
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -75,9 +75,6 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getNotificationsOneTimeKeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getNotificationsOneTimeKeys(rt, args[0].asNumber());
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateAndGetPrekeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->generateAndGetPrekeys(rt);
-}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_validateAndGetPrekeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->validateAndGetPrekeys(rt);
}
@@ -186,7 +183,6 @@
methodMap_["getUserPublicKey"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};
methodMap_["getPrimaryOneTimeKeys"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getPrimaryOneTimeKeys};
methodMap_["getNotificationsOneTimeKeys"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getNotificationsOneTimeKeys};
- methodMap_["generateAndGetPrekeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateAndGetPrekeys};
methodMap_["validateAndGetPrekeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_validateAndGetPrekeys};
methodMap_["validateAndUploadPrekeys"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_validateAndUploadPrekeys};
methodMap_["initializeNotificationsSession"] = MethodMetadata {5, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeNotificationsSession};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -40,7 +40,6 @@
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) = 0;
virtual jsi::Value getPrimaryOneTimeKeys(jsi::Runtime &rt, double oneTimeKeysAmount) = 0;
virtual jsi::Value getNotificationsOneTimeKeys(jsi::Runtime &rt, double oneTimeKeysAmount) = 0;
- virtual jsi::Value generateAndGetPrekeys(jsi::Runtime &rt) = 0;
virtual jsi::Value validateAndGetPrekeys(jsi::Runtime &rt) = 0;
virtual jsi::Value validateAndUploadPrekeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) = 0;
virtual jsi::Value initializeNotificationsSession(jsi::Runtime &rt, jsi::String identityKeys, jsi::String prekey, jsi::String prekeySignature, jsi::String oneTimeKeys, jsi::String keyserverID) = 0;
@@ -249,14 +248,6 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::getNotificationsOneTimeKeys, jsInvoker_, instance_, std::move(oneTimeKeysAmount));
}
- jsi::Value generateAndGetPrekeys(jsi::Runtime &rt) override {
- static_assert(
- bridging::getParameterCount(&T::generateAndGetPrekeys) == 1,
- "Expected generateAndGetPrekeys(...) to have 1 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::generateAndGetPrekeys, jsInvoker_, instance_);
- }
jsi::Value validateAndGetPrekeys(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::validateAndGetPrekeys) == 1,
diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js
--- a/native/identity-service/identity-service-context-provider.react.js
+++ b/native/identity-service/identity-service-context-provider.react.js
@@ -208,7 +208,7 @@
commCoreModule.getUserPublicKey(),
commCoreModule.getNotificationsOneTimeKeys(ONE_TIME_KEYS_NUMBER),
commCoreModule.getPrimaryOneTimeKeys(ONE_TIME_KEYS_NUMBER),
- commCoreModule.generateAndGetPrekeys(),
+ commCoreModule.validateAndGetPrekeys(),
]);
const registrationResult = await commRustModule.registerUser(
username,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -85,7 +85,6 @@
+getNotificationsOneTimeKeys: (
oneTimeKeysAmount: number,
) => Promise<OLMOneTimeKeys>;
- +generateAndGetPrekeys: () => Promise<SignedPrekeys>;
+validateAndGetPrekeys: () => Promise<SignedPrekeys>;
+validateAndUploadPrekeys: (
authUserID: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 14, 6:57 PM (10 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2492179
Default Alt Text
D10939.id36602.diff (10 KB)
Attached To
Mode
D10939: [native] deprecate generateAndGetPrekeys
Attached
Detach File
Event Timeline
Log In to Comment