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 +#include +#include #include 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, }; +type ClientPublicKeys = { + +curve25519: string, + +ed25519: string, +}; + export interface Spec extends TurboModule { +getDraft: (key: string) => Promise; +updateDraft: (key: string, text: string) => Promise; @@ -48,7 +53,7 @@ operations: $ReadOnlyArray, ) => void; +initializeCryptoAccount: (userId: string) => Promise; - +getUserPublicKey: () => Promise; + +getUserPublicKey: () => Promise; +getUserOneTimeKeys: () => Promise; +getCodeVersion: () => number; +setNotifyToken: (token: string) => Promise;