Page MenuHomePhorge

D14263.1768441377.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D14263.1768441377.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
@@ -3421,28 +3421,59 @@
return createPromiseAsJSIValue(
rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
+ std::string backupMessage;
+ try {
+ backupMessage = getSIWEBackupMessage();
+ } catch (std::system_error &e) {
+ this->jsInvoker_->invokeAsync(
+ [=, &innerRt]() { promise->reject(e.what()); });
+ return;
+ }
+
this->cryptoThread->scheduleTask([=, &innerRt]() {
std::string error;
+ std::string backupID;
try {
- auto currentID = RustPromiseManager::instance.addPromise(
- {promise, this->jsInvoker_, innerRt});
- identityRestoreUser(
- userIDRust,
- siweSocialProofMessageRust,
- siweSocialProofSignatureRust,
- keyPayloadRust,
- keyPayloadSignatureRust,
- contentPrekeyRust,
- contentPrekeySignatureRust,
- notifPrekeyRust,
- notifPrekeySignatureRust,
- contentOneTimeKeysRust,
- notifOneTimeKeysRust,
- deviceListRust,
- currentID);
+ backupID = crypto::Tools::generateRandomURLSafeString(32);
} catch (const std::exception &e) {
- error = e.what();
- };
+ error = "Failed to generate backupID";
+ }
+
+ std::string pickleKey;
+ std::string pickledAccount;
+ if (!error.size()) {
+ try {
+ pickleKey = crypto::Tools::generateRandomString(64);
+ pickledAccount =
+ this->contentCryptoModule->pickleAccountToString(pickleKey);
+ } catch (const std::exception &e) {
+ error = "Failed to pickle crypto account";
+ }
+ }
+
+ if (!error.size()) {
+ try {
+ auto currentID = RustPromiseManager::instance.addPromise(
+ {promise, this->jsInvoker_, innerRt});
+ identityRestoreUser(
+ userIDRust,
+ siweSocialProofMessageRust,
+ siweSocialProofSignatureRust,
+ keyPayloadRust,
+ keyPayloadSignatureRust,
+ contentPrekeyRust,
+ contentPrekeySignatureRust,
+ notifPrekeyRust,
+ notifPrekeySignatureRust,
+ contentOneTimeKeysRust,
+ notifOneTimeKeysRust,
+ deviceListRust,
+ currentID);
+ } catch (const std::exception &e) {
+ error = e.what();
+ };
+ }
+
if (!error.empty()) {
this->jsInvoker_->invokeAsync(
[error, promise]() { promise->reject(error); });

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 1:42 AM (3 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5935199
Default Alt Text
D14263.1768441377.diff (3 KB)

Event Timeline