Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3392762
D6115.id20453.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6115.id20453.diff
View Options
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
@@ -7,6 +7,8 @@
#include "ThreadStoreOperations.h"
#include <ReactCommon/TurboModuleUtils.h>
+#include <folly/dynamic.h>
+#include <folly/json.h>
#include <future>
namespace comm {
@@ -818,7 +820,16 @@
promise->reject(error);
return;
}
- promise->resolve(jsi::String::createFromUtf8(innerRt, result));
+ folly::dynamic parsed = folly::parseJson(result);
+ auto curve25519{jsi::String::createFromUtf8(
+ innerRt, parsed["curve25519"].asString())};
+ auto ed25519{jsi::String::createFromUtf8(
+ innerRt, parsed["ed25519"].asString())};
+
+ auto jsiClientPublicKeys = jsi::Object(innerRt);
+ jsiClientPublicKeys.setProperty(innerRt, "curve25519", curve25519);
+ jsiClientPublicKeys.setProperty(innerRt, "ed25519", ed25519);
+ promise->resolve(std::move(jsiClientPublicKeys));
});
};
this->cryptoThread->scheduleTask(job);
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -24,6 +24,11 @@
+threads: $ReadOnlyArray<ClientDBThreadInfo>,
};
+type ClientPublicKeys = {
+ +curve25519: string,
+ +ed25519: string,
+};
+
export interface Spec extends TurboModule {
+getDraft: (key: string) => Promise<string>;
+updateDraft: (key: string, text: string) => Promise<boolean>;
@@ -48,7 +53,7 @@
operations: $ReadOnlyArray<ClientDBThreadStoreOperation>,
) => void;
+initializeCryptoAccount: (userId: string) => Promise<string>;
- +getUserPublicKey: () => Promise<string>;
+ +getUserPublicKey: () => Promise<ClientPublicKeys>;
+getUserOneTimeKeys: () => Promise<string>;
+getCodeVersion: () => number;
+setNotifyToken: (token: string) => Promise<void>;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 10:06 AM (16 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604113
Default Alt Text
D6115.id20453.diff (2 KB)
Attached To
Mode
D6115: [native] Modify `getUserPublicKey()` JSI function to return `ClientPublicKeys`
Attached
Detach File
Event Timeline
Log In to Comment