integrate status-go fix for keycard accounts

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-12-18 13:35:57 +01:00
parent 8578c317d6
commit a72d4c7d85
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
5 changed files with 20 additions and 16 deletions

View File

@ -312,10 +312,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
} }
@ReactMethod @ReactMethod
public void saveAccountAndLogin(final String accountData, final String password, final String config, final String subAccountsData) { public void saveAccountAndLogin(final String multiaccountData, final String password, final String config, final String accountsData) {
Log.d(TAG, "saveAccountAndLogin"); Log.d(TAG, "saveAccountAndLogin");
String finalConfig = prepareDirAndUpdateConfig(config); String finalConfig = prepareDirAndUpdateConfig(config);
String result = Statusgo.saveAccountAndLogin(accountData, password, finalConfig, subAccountsData); String result = Statusgo.saveAccountAndLogin(multiaccountData, password, finalConfig, accountsData);
if (result.startsWith("{\"error\":\"\"")) { if (result.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "saveAccountAndLogin result: " + result); Log.d(TAG, "saveAccountAndLogin result: " + result);
Log.d(TAG, "Geth node started"); Log.d(TAG, "Geth node started");
@ -325,10 +325,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
} }
@ReactMethod @ReactMethod
public void saveAccountAndLoginWithKeycard(final String accountData, final String password, final String config, final String chatKey) { public void saveAccountAndLoginWithKeycard(final String multiaccountData, final String password, final String config, final String accountsData, final String chatKey) {
Log.d(TAG, "saveAccountAndLoginWithKeycard"); Log.d(TAG, "saveAccountAndLoginWithKeycard");
String finalConfig = prepareDirAndUpdateConfig(config); String finalConfig = prepareDirAndUpdateConfig(config);
String result = Statusgo.saveAccountAndLoginWithKeycard(accountData, password, finalConfig, chatKey); String result = Statusgo.saveAccountAndLoginWithKeycard(multiaccountData, password, finalConfig, accountsData, chatKey);
if (result.startsWith("{\"error\":\"\"")) { if (result.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "saveAccountAndLoginWithKeycard result: " + result); Log.d(TAG, "saveAccountAndLoginWithKeycard result: " + result);
Log.d(TAG, "Geth node started"); Log.d(TAG, "Geth node started");

View File

@ -378,28 +378,29 @@ RCT_EXPORT_METHOD(prepareDirAndUpdateConfig:(NSString *)config
} }
//////////////////////////////////////////////////////////////////// saveAccountAndLogin //////////////////////////////////////////////////////////////////// saveAccountAndLogin
RCT_EXPORT_METHOD(saveAccountAndLogin:(NSString *)accountData RCT_EXPORT_METHOD(saveAccountAndLogin:(NSString *)multiaccountData
password:(NSString *)password password:(NSString *)password
config:(NSString *)config config:(NSString *)config
subAccountsData:(NSString *)subAccountsData) { accountsData:(NSString *)accountsData) {
#if DEBUG #if DEBUG
NSLog(@"SaveAccountAndLogin() method called"); NSLog(@"SaveAccountAndLogin() method called");
#endif #endif
NSString *finalConfig = [self prepareDirAndUpdateConfig:config]; NSString *finalConfig = [self prepareDirAndUpdateConfig:config];
NSString *result = StatusgoSaveAccountAndLogin(accountData, password, finalConfig, subAccountsData); NSString *result = StatusgoSaveAccountAndLogin(multiaccountData, password, finalConfig, accountsData);
NSLog(@"%@", result); NSLog(@"%@", result);
} }
//////////////////////////////////////////////////////////////////// saveAccountAndLoginWithKeycard //////////////////////////////////////////////////////////////////// saveAccountAndLoginWithKeycard
RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)accountData RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)multiaccountData
password:(NSString *)password password:(NSString *)password
config:(NSString *)config config:(NSString *)config
accountsData:(NSString *)accountsData
chatKey:(NSString *)chatKey) { chatKey:(NSString *)chatKey) {
#if DEBUG #if DEBUG
NSLog(@"SaveAccountAndLoginWithKeycard() method called"); NSLog(@"SaveAccountAndLoginWithKeycard() method called");
#endif #endif
NSString *finalConfig = [self prepareDirAndUpdateConfig:config]; NSString *finalConfig = [self prepareDirAndUpdateConfig:config];
NSString *result = StatusgoSaveAccountAndLoginWithKeycard(accountData, password, finalConfig, chatKey); NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, finalConfig, accountsData, chatKey);
NSLog(@"%@", result); NSLog(@"%@", result);
} }

View File

@ -208,10 +208,11 @@
:chat true})]) :chat true})])
(fx/defn save-account-and-login-with-keycard (fx/defn save-account-and-login-with-keycard
[_ multiaccount-data password node-config chat-key] [_ multiaccount-data password node-config accounts-data chat-key]
{::save-account-and-login-with-keycard [(types/clj->json multiaccount-data) {::save-account-and-login-with-keycard [(types/clj->json multiaccount-data)
password password
node-config node-config
(types/clj->json accounts-data)
chat-key]}) chat-key]})
(fx/defn save-account-and-login (fx/defn save-account-and-login
@ -275,6 +276,7 @@
(save-account-and-login-with-keycard new-multiaccount (save-account-and-login-with-keycard new-multiaccount
password password
(node/get-new-config db) (node/get-new-config db)
accounts-data
chat-key) chat-key)
(save-account-and-login multiaccount-data (save-account-and-login multiaccount-data
(ethereum/sha3 (security/safe-unmask-data password)) (ethereum/sha3 (security/safe-unmask-data password))
@ -382,8 +384,9 @@
accounts-data))) accounts-data)))
(re-frame/reg-fx (re-frame/reg-fx
::save-account-and-login-with-keycard ::save-account-and-login-with-keycard
(fn [[multiaccount-data password config chat-key]] (fn [[multiaccount-data password config accounts-data chat-key]]
(status/save-account-and-login-with-keycard multiaccount-data (status/save-account-and-login-with-keycard multiaccount-data
(security/safe-unmask-data password) (security/safe-unmask-data password)
config config
accounts-data
chat-key))) chat-key)))

View File

@ -53,9 +53,9 @@
(defn save-account-and-login-with-keycard (defn save-account-and-login-with-keycard
"NOTE: chat-key is a whisper private key sent from keycard" "NOTE: chat-key is a whisper private key sent from keycard"
[multiaccount-data password config chat-key] [multiaccount-data password config accounts-data chat-key]
(log/debug "[native-module] save-account-and-login-with-keycard") (log/debug "[native-module] save-account-and-login-with-keycard")
(.saveAccountAndLoginWithKeycard (status) multiaccount-data password config chat-key)) (.saveAccountAndLoginWithKeycard (status) multiaccount-data password config accounts-data chat-key))
(defn login (defn login
"NOTE: beware, the password has to be sha3 hashed" "NOTE: beware, the password has to be sha3 hashed"

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead", "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.38.1", "version": "v0.38.2",
"commit-sha1": "f8552280103000d720be98fa69ea09c7ae52d88f", "commit-sha1": "655031616c46233e93767d8a3d8c54568ca043f2",
"src-sha256": "04nrwkj34hj6mdv8h1ky8fa1xxxh4vx1jss5x1rxjb46ckd808mq" "src-sha256": "0bi1k1yf70zhayqd5lyrpc84nwdjvja1nsjj1pv75f1s0c2qbmw6"
} }