Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33069020
D14263.1768441377.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D14263.1768441377.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
@@ -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
Details
Attached
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)
Attached To
Mode
D14263: [CommCoreModule] add retrieving SIWE backup message, generating `backupID` and pickling account to `restoreUser`
Attached
Detach File
Event Timeline
Log In to Comment