Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3380251
D6822.id23315.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6822.id23315.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
@@ -839,35 +839,59 @@
} catch (const std::exception &e) {
error = e.what();
}
+
+ folly::dynamic parsedPrimary = folly::parseJson(primaryKeysResult);
+ auto primaryCurve25519Cpp{parsedPrimary["curve25519"].asString()};
+ auto primaryEd25519Cpp{parsedPrimary["ed25519"].asString()};
+
+ folly::dynamic parsedNotifications =
+ folly::parseJson(notificationsKeysResult);
+ auto notificationsCurve25519Cpp{
+ parsedNotifications["curve25519"].asString()};
+ auto notificationsEd25519Cpp{
+ parsedNotifications["ed25519"].asString()};
+
+ folly::dynamic blobPayloadJSON = folly::dynamic::object(
+ "primaryIdentityPublicKeys",
+ folly::dynamic::object("ed25519", primaryEd25519Cpp)(
+ "curve25519", primaryCurve25519Cpp))(
+ "notificationIdentityPublicKeys",
+ folly::dynamic::object("ed25519", notificationsEd25519Cpp)(
+ "curve25519", notificationsCurve25519Cpp));
+
+ auto blobPayloadCpp = folly::toJson(blobPayloadJSON);
+ auto signatureCpp = this->cryptoModule->signMessage(blobPayloadCpp);
+
this->jsInvoker_->invokeAsync([=, &innerRt]() {
if (error.size()) {
promise->reject(error);
return;
}
- folly::dynamic parsedPrimary = folly::parseJson(primaryKeysResult);
- auto primaryCurve25519{jsi::String::createFromUtf8(
- innerRt, parsedPrimary["curve25519"].asString())};
- auto primaryEd25519{jsi::String::createFromUtf8(
- innerRt, parsedPrimary["ed25519"].asString())};
+ auto primaryCurve25519{
+ jsi::String::createFromUtf8(innerRt, primaryCurve25519Cpp)};
+ auto primaryEd25519{
+ jsi::String::createFromUtf8(innerRt, primaryEd25519Cpp)};
auto jsiPrimaryIdentityPublicKeys = jsi::Object(innerRt);
jsiPrimaryIdentityPublicKeys.setProperty(
innerRt, "ed25519", primaryEd25519);
jsiPrimaryIdentityPublicKeys.setProperty(
innerRt, "curve25519", primaryCurve25519);
- folly::dynamic parsedNotifications =
- folly::parseJson(notificationsKeysResult);
auto notificationsCurve25519{jsi::String::createFromUtf8(
- innerRt, parsedNotifications["curve25519"].asString())};
- auto notificationsEd25519{jsi::String::createFromUtf8(
- innerRt, parsedNotifications["ed25519"].asString())};
+ innerRt, notificationsCurve25519Cpp)};
+ auto notificationsEd25519{
+ jsi::String::createFromUtf8(innerRt, notificationsEd25519Cpp)};
auto jsiNotificationIdentityPublicKeys = jsi::Object(innerRt);
jsiNotificationIdentityPublicKeys.setProperty(
innerRt, "ed25519", notificationsEd25519);
jsiNotificationIdentityPublicKeys.setProperty(
innerRt, "curve25519", notificationsCurve25519);
+ auto blobPayload{
+ jsi::String::createFromUtf8(innerRt, blobPayloadCpp)};
+ auto signature{jsi::String::createFromUtf8(innerRt, signatureCpp)};
+
auto jsiClientPublicKeys = jsi::Object(innerRt);
jsiClientPublicKeys.setProperty(
innerRt,
@@ -877,6 +901,9 @@
innerRt,
"notificationIdentityPublicKeys",
jsiNotificationIdentityPublicKeys);
+ jsiClientPublicKeys.setProperty(
+ innerRt, "blobPayload", blobPayload);
+ jsiClientPublicKeys.setProperty(innerRt, "signature", signature);
promise->resolve(std::move(jsiClientPublicKeys));
});
};
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -33,6 +33,8 @@
+ed25519: string,
+curve25519: string,
},
+ +blobPayload: string,
+ +signature: string,
};
export interface Spec extends TurboModule {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 10:29 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595032
Default Alt Text
D6822.id23315.diff (4 KB)
Attached To
Mode
D6822: Sign concatenation of public and notif keypairs using private key of public identity
Attached
Detach File
Event Timeline
Log In to Comment