Page MenuHomePhabricator

D14048.diff
No OneTemporary

D14048.diff

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
@@ -193,10 +193,6 @@
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) override;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) override;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) override;
- virtual jsi::Value computeBackupKey(
- jsi::Runtime &rt,
- jsi::String password,
- jsi::String backupID) override;
virtual jsi::Value
generateRandomString(jsi::Runtime &rt, double size) override;
virtual jsi::Value setCommServicesAuthMetadata(
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
@@ -2306,44 +2306,6 @@
DatabaseManager::reportDBOperationsFailure();
}
-jsi::Value CommCoreModule::computeBackupKey(
- jsi::Runtime &rt,
- jsi::String password,
- jsi::String backupID) {
- std::string passwordStr = password.utf8(rt);
- std::string backupIDStr = backupID.utf8(rt);
- return createPromiseAsJSIValue(
- rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- taskType job = [=, &innerRt]() {
- std::string error;
- std::array<::std::uint8_t, 32> backupKey;
- try {
- backupKey = compute_backup_key(passwordStr, backupIDStr);
- } catch (const std::exception &e) {
- error = std::string{"Failed to compute backup key: "} + e.what();
- }
-
- this->jsInvoker_->invokeAsync([=, &innerRt]() {
- if (error.size()) {
- promise->reject(error);
- return;
- }
- auto size = backupKey.size();
- auto arrayBuffer =
- innerRt.global()
- .getPropertyAsFunction(innerRt, "ArrayBuffer")
- .callAsConstructor(innerRt, {static_cast<double>(size)})
- .asObject(innerRt)
- .getArrayBuffer(innerRt);
- auto bufferPtr = arrayBuffer.data(innerRt);
- memcpy(bufferPtr, backupKey.data(), size);
- promise->resolve(std::move(arrayBuffer));
- });
- };
- this->cryptoThread->scheduleTask(job);
- });
-}
-
jsi::Value CommCoreModule::generateRandomString(jsi::Runtime &rt, double size) {
return createPromiseAsJSIValue(
rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
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
@@ -155,9 +155,6 @@
static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->reportDBOperationsFailure(rt);
return jsi::Value::undefined();
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_computeBackupKey(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->computeBackupKey(rt, args[0].asString(rt), args[1].asString(rt));
-}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateRandomString(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->generateRandomString(rt, args[0].asNumber());
}
@@ -296,7 +293,6 @@
methodMap_["clearSensitiveData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData};
methodMap_["checkIfDatabaseNeedsDeletion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_checkIfDatabaseNeedsDeletion};
methodMap_["reportDBOperationsFailure"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_reportDBOperationsFailure};
- methodMap_["computeBackupKey"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_computeBackupKey};
methodMap_["generateRandomString"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateRandomString};
methodMap_["setCommServicesAuthMetadata"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setCommServicesAuthMetadata};
methodMap_["getCommServicesAuthMetadata"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCommServicesAuthMetadata};
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
@@ -66,7 +66,6 @@
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) = 0;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) = 0;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) = 0;
- virtual jsi::Value computeBackupKey(jsi::Runtime &rt, jsi::String password, jsi::String backupID) = 0;
virtual jsi::Value generateRandomString(jsi::Runtime &rt, double size) = 0;
virtual jsi::Value setCommServicesAuthMetadata(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0;
virtual jsi::Value getCommServicesAuthMetadata(jsi::Runtime &rt) = 0;
@@ -485,14 +484,6 @@
return bridging::callFromJs<void>(
rt, &T::reportDBOperationsFailure, jsInvoker_, instance_);
}
- jsi::Value computeBackupKey(jsi::Runtime &rt, jsi::String password, jsi::String backupID) override {
- static_assert(
- bridging::getParameterCount(&T::computeBackupKey) == 3,
- "Expected computeBackupKey(...) to have 3 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::computeBackupKey, jsInvoker_, instance_, std::move(password), std::move(backupID));
- }
jsi::Value generateRandomString(jsi::Runtime &rt, double size) override {
static_assert(
bridging::getParameterCount(&T::generateRandomString) == 2,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -149,7 +149,6 @@
+clearSensitiveData: () => Promise<void>;
+checkIfDatabaseNeedsDeletion: () => boolean;
+reportDBOperationsFailure: () => void;
- +computeBackupKey: (password: string, backupID: string) => Promise<Object>;
+generateRandomString: (size: number) => Promise<string>;
+setCommServicesAuthMetadata: (
userID: string,
@@ -218,10 +217,6 @@
}
export interface CoreModuleSpec extends Spec {
- +computeBackupKey: (
- password: string,
- backupID: string,
- ) => Promise<ArrayBuffer>;
+decrypt: (encryptedData: EncryptedData, deviceID: string) => Promise<string>;
+decryptAndPersist: (
encryptedData: EncryptedData,

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 5:36 PM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601800
Default Alt Text
D14048.diff (6 KB)

Event Timeline