Page MenuHomePhabricator

D6115.id20472.diff
No OneTemporary

D6115.id20472.diff

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

Mime Type
text/plain
Expires
Sun, Dec 1, 10:06 AM (16 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604113
Default Alt Text
D6115.id20472.diff (2 KB)

Event Timeline