Page MenuHomePhabricator

D11312.id38031.diff
No OneTemporary

D11312.id38031.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
@@ -583,6 +583,20 @@
return jsiOneTimeKeys;
}
+jsi::String parseOLMPrekey(jsi::Runtime &rt, std::string prekeyBlob) {
+ folly::dynamic parsedPrekey = folly::parseJson(prekeyBlob);
+
+ auto prekey = parsedPrekey["curve25519"].values().begin()->asString();
+ return jsi::String::createFromUtf8(rt, prekey);
+}
+
+rust::String parseOLMPrekey(std::string prekeyBlob) {
+ folly::dynamic parsedPrekey = folly::parseJson(prekeyBlob);
+
+ auto prekey = parsedPrekey["curve25519"].values().begin()->asString();
+ return rust::String(prekey);
+}
+
jsi::Object parseOneTimeKeysResult(
jsi::Runtime &rt,
std::string contentOneTimeKeysBlob,
@@ -710,9 +724,9 @@
authUserIDRust,
authDeviceIDRust,
authAccessTokenRust,
- rust::string(prekeyToUpload),
+ parseOLMPrekey(prekeyToUpload),
rust::string(prekeySignature),
- rust::string(notificationsPrekey),
+ parseOLMPrekey(notificationsPrekey),
rust::string(notificationsPrekeySignature),
currentID);
prekeyFuture.get();
@@ -783,11 +797,10 @@
return;
}
auto contentPrekeyJSI =
- jsi::String::createFromUtf8(innerRt, contentPrekey.value());
+ parseOLMPrekey(innerRt, contentPrekey.value());
auto contentPrekeySignatureJSI =
jsi::String::createFromUtf8(innerRt, contentPrekeySignature);
- auto notifPrekeyJSI =
- jsi::String::createFromUtf8(innerRt, notifPrekey);
+ auto notifPrekeyJSI = parseOLMPrekey(innerRt, notifPrekey);
auto notifPrekeySignatureJSI =
jsi::String::createFromUtf8(innerRt, notifPrekeySignature);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 10:54 PM (21 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598493
Default Alt Text
D11312.id38031.diff (2 KB)

Event Timeline