Skip to content

Commit

Permalink
discard backup message when recovering account
Browse files Browse the repository at this point in the history
  • Loading branch information
qfrank committed Jul 24, 2023
1 parent 0ac6817 commit 798018e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,10 @@ public void migrateKeyStoreDir(final String accountData, final String password)
}

@ReactMethod
public void loginWithKeycard(final String accountData, final String password, final String chatKey) {
public void loginWithKeycard(final String accountData, final String password, final String chatKey, final String nodeConfigJSON) {
Log.d(TAG, "loginWithKeycard");
this.migrateKeyStoreDir(accountData, password);
String result = Statusgo.loginWithKeycard(accountData, password, chatKey);
String result = Statusgo.loginWithKeycard(accountData, password, chatKey, nodeConfigJSON);
if (result.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "LoginWithKeycard result: " + result);
} else {
Expand Down
5 changes: 3 additions & 2 deletions modules/react-native-status/ios/RCTStatus/RCTStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,15 @@ - (void) migrateKeystore:(NSString *)accountData

RCT_EXPORT_METHOD(loginWithKeycard:(NSString *)accountData
password:(NSString *)password
chatKey:(NSString *)chatKey) {
chatKey:(NSString *)chatKey
nodeConfigJSON:(NSString *)nodeConfigJSON) {
#if DEBUG
NSLog(@"LoginWithKeycard() method called");
#endif
[self getExportDbFilePath];
[self migrateKeystore:accountData password:password];

NSString *result = StatusgoLoginWithKeycard(accountData, password, chatKey);
NSString *result = StatusgoLoginWithKeycard(accountData, password, chatKey, nodeConfigJSON);

NSLog(@"%@", result);
}
Expand Down
4 changes: 2 additions & 2 deletions src/native_module/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@
(.verifyDatabasePassword ^js (status) key-uid hashed-password callback))

(defn login-with-keycard
[{:keys [key-uid multiaccount-data password chat-key]}]
[{:keys [key-uid multiaccount-data password chat-key node-config]}]
(log/debug "[native-module] login-with-keycard")
(clear-web-data)
(init-keystore
key-uid
#(.loginWithKeycard ^js (status) multiaccount-data password chat-key)))
#(.loginWithKeycard ^js (status) multiaccount-data password chat-key (types/clj->json node-config))))

(defn set-soft-input-mode
[mode]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/keycard/real_keycard.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@

(defn login
[args]
(native-module/login-with-keycard args))
(native-module/login-with-keycard (assoc args :node-config {:ProcessBackedupMessages false})))

(defn send-transaction-with-signature
[{:keys [transaction signature on-completed]}]
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/keycard/recovery.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@
encryption-pass
#(let [{:keys [error]} (types/json->clj %)]
(if (string/blank? error)
(native-module/login-with-keycard login-params)
(native-module/login-with-keycard
(assoc login-params :node-config {:ProcessBackedupMessages true}))
(throw
(js/Error.
"Please shake the phone to report this error and restart the app. Migration failed unexpectedly.")))))))
Expand Down
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.162.5",
"commit-sha1": "cf2d72bfa83f094719a93b7b7fd5a68e3a68ab47",
"src-sha256": "0x79nm1n6gbgz2lzsky29laap7m0r0hggrb2fsn07bf0xw0364qn"
"version": "fix/discard-backedup-messages-if-not-acc-recover-flow",
"commit-sha1": "9cbbc5c078525dbc4c14e6228396910ef472d32d",
"src-sha256": "1b705s4hakd3ahp7arrakqa0kz7vkg3r55d0mzynygax4dpgmlsm"
}

0 comments on commit 798018e

Please sign in to comment.