Page MenuHomePhabricator

D6172.id20594.diff
No OneTemporary

D6172.id20594.diff

diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -88,7 +88,7 @@
setNonce(response);
})(),
);
- await commCoreModule.initializeCryptoAccount('PLACEHOLDER');
+ await commCoreModule.initializeCryptoAccount();
const { ed25519 } = await commCoreModule.getUserPublicKey();
setPrimaryIdentityPublicKey(ed25519);
})();
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
@@ -30,8 +30,8 @@
public:
const std::string id;
- CryptoModule(std::string id);
- CryptoModule(std::string id, std::string secretKey, Persist persist);
+ CryptoModule();
+ CryptoModule(std::string secretKey, Persist persist);
static Keys keysFromStrings(
const std::string &identityKeys,
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -7,15 +7,11 @@
namespace comm {
namespace crypto {
-CryptoModule::CryptoModule(std::string id) : id{id} {
+CryptoModule::CryptoModule() {
this->createAccount();
}
-CryptoModule::CryptoModule(
- std::string id,
- std::string secretKey,
- Persist persist)
- : id{id} {
+CryptoModule::CryptoModule(std::string secretKey, Persist persist) : id{id} {
if (persist.isEmpty()) {
this->createAccount();
} else {
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
@@ -45,8 +45,7 @@
virtual void processThreadStoreOperationsSync(
jsi::Runtime &rt,
jsi::Array operations) override;
- virtual jsi::Value
- initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) override;
+ virtual jsi::Value initializeCryptoAccount(jsi::Runtime &rt) override;
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) override;
virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) override;
virtual double getCodeVersion(jsi::Runtime &rt) override;
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
@@ -721,9 +721,7 @@
});
}
-jsi::Value
-CommCoreModule::initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) {
- std::string userIdStr = userId.utf8(rt);
+jsi::Value CommCoreModule::initializeCryptoAccount(jsi::Runtime &rt) {
folly::Optional<std::string> storedSecretKey =
this->secureStore.get(this->secureStoreAccountDataKey);
if (!storedSecretKey.hasValue()) {
@@ -761,8 +759,8 @@
this->cryptoThread->scheduleTask([=]() {
std::string error;
- this->cryptoModule.reset(new crypto::CryptoModule(
- userIdStr, storedSecretKey.value(), persist));
+ this->cryptoModule.reset(
+ new crypto::CryptoModule(storedSecretKey.value(), persist));
if (persist.isEmpty()) {
crypto::Persist newPersist =
this->cryptoModule->storeAsB64(storedSecretKey.value());
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
@@ -51,7 +51,7 @@
return jsi::Value::undefined();
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeCryptoAccount(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->initializeCryptoAccount(rt, args[0].asString(rt));
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->initializeCryptoAccount(rt);
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getUserPublicKey(rt);
@@ -98,7 +98,7 @@
methodMap_["getAllThreadsSync"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getAllThreadsSync};
methodMap_["processThreadStoreOperations"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_processThreadStoreOperations};
methodMap_["processThreadStoreOperationsSync"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_processThreadStoreOperationsSync};
- methodMap_["initializeCryptoAccount"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeCryptoAccount};
+ methodMap_["initializeCryptoAccount"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeCryptoAccount};
methodMap_["getUserPublicKey"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};
methodMap_["getUserOneTimeKeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys};
methodMap_["getCodeVersion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCodeVersion};
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
@@ -32,7 +32,7 @@
virtual jsi::Array getAllThreadsSync(jsi::Runtime &rt) = 0;
virtual jsi::Value processThreadStoreOperations(jsi::Runtime &rt, jsi::Array operations) = 0;
virtual void processThreadStoreOperationsSync(jsi::Runtime &rt, jsi::Array operations) = 0;
- virtual jsi::Value initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) = 0;
+ virtual jsi::Value initializeCryptoAccount(jsi::Runtime &rt) = 0;
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) = 0;
virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) = 0;
virtual double getCodeVersion(jsi::Runtime &rt) = 0;
@@ -160,13 +160,13 @@
return bridging::callFromJs<void>(
rt, &T::processThreadStoreOperationsSync, jsInvoker_, instance_, std::move(operations));
}
- jsi::Value initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) override {
+ jsi::Value initializeCryptoAccount(jsi::Runtime &rt) override {
static_assert(
- bridging::getParameterCount(&T::initializeCryptoAccount) == 2,
- "Expected initializeCryptoAccount(...) to have 2 parameters");
+ bridging::getParameterCount(&T::initializeCryptoAccount) == 1,
+ "Expected initializeCryptoAccount(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::initializeCryptoAccount, jsInvoker_, instance_, std::move(userId));
+ rt, &T::initializeCryptoAccount, jsInvoker_, instance_);
}
jsi::Value getUserPublicKey(jsi::Runtime &rt) override {
static_assert(
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -52,7 +52,7 @@
+processThreadStoreOperationsSync: (
operations: $ReadOnlyArray<ClientDBThreadStoreOperation>,
) => void;
- +initializeCryptoAccount: (userId: string) => Promise<string>;
+ +initializeCryptoAccount: () => Promise<string>;
+getUserPublicKey: () => Promise<ClientPublicKeys>;
+getUserOneTimeKeys: () => Promise<string>;
+getCodeVersion: () => number;

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 1, 5:13 PM (20 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2399469
Default Alt Text
D6172.id20594.diff (7 KB)

Event Timeline