mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-23 13:58:43 +00:00
Use LoginWithConfig method to log in (#13414)
This commit is contained in:
parent
cc2b6ab80c
commit
51174f8488
@ -370,6 +370,18 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void loginWithConfig(final String accountData, final String password, final String configJSON) {
|
||||||
|
Log.d(TAG, "loginWithConfig");
|
||||||
|
this.migrateKeyStoreDir(accountData, password);
|
||||||
|
String result = Statusgo.loginWithConfig(accountData, password, configJSON);
|
||||||
|
if (result.startsWith("{\"error\":\"\"")) {
|
||||||
|
Log.d(TAG, "LoginWithConfig result: " + result);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "LoginWithConfig failed: " + result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void exportUnencryptedDatabase(final String accountData, final String password, final Callback callback) {
|
public void exportUnencryptedDatabase(final String accountData, final String password, final Callback callback) {
|
||||||
Log.d(TAG, "login");
|
Log.d(TAG, "login");
|
||||||
|
@ -542,6 +542,19 @@ RCT_EXPORT_METHOD(login:(NSString *)accountData
|
|||||||
NSLog(@"%@", result);
|
NSLog(@"%@", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////// loginWithConfig
|
||||||
|
RCT_EXPORT_METHOD(loginWithConfig:(NSString *)accountData
|
||||||
|
password:(NSString *)password
|
||||||
|
configJSON:(NSString *)configJSON) {
|
||||||
|
#if DEBUG
|
||||||
|
NSLog(@"LoginWithConfig() method called");
|
||||||
|
#endif
|
||||||
|
[self getExportDbFilePath];
|
||||||
|
[self migrateKeystore:accountData password:password];
|
||||||
|
NSString *result = StatusgoLoginWithConfig(accountData, password, configJSON);
|
||||||
|
NSLog(@"%@", result);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////// loginWithKeycard
|
//////////////////////////////////////////////////////////////////// loginWithKeycard
|
||||||
RCT_EXPORT_METHOD(loginWithKeycard:(NSString *)accountData
|
RCT_EXPORT_METHOD(loginWithKeycard:(NSString *)accountData
|
||||||
password:(NSString *)password
|
password:(NSString *)password
|
||||||
|
@ -432,7 +432,7 @@
|
|||||||
(types/clj->json accounts-data)))
|
(types/clj->json accounts-data)))
|
||||||
|
|
||||||
(defn login [{:keys [key-uid multiaccount-data password]}]
|
(defn login [{:keys [key-uid multiaccount-data password]}]
|
||||||
(status/login key-uid multiaccount-data password))
|
(status/login-with-config key-uid multiaccount-data password nil))
|
||||||
|
|
||||||
(defn send-transaction-with-signature
|
(defn send-transaction-with-signature
|
||||||
[{:keys [transaction on-completed]}]
|
[{:keys [transaction on-completed]}]
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::login
|
::login
|
||||||
(fn [[key-uid account-data hashed-password]]
|
(fn [[key-uid account-data hashed-password]]
|
||||||
(status/login key-uid account-data hashed-password)))
|
(status/login-with-config key-uid account-data hashed-password nil)))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::export-db
|
::export-db
|
||||||
|
@ -64,6 +64,16 @@
|
|||||||
key-uid
|
key-uid
|
||||||
#(.login ^js (status) account-data hashed-password)))
|
#(.login ^js (status) account-data hashed-password)))
|
||||||
|
|
||||||
|
(defn login-with-config
|
||||||
|
"NOTE: beware, the password has to be sha3 hashed"
|
||||||
|
[key-uid account-data hashed-password config]
|
||||||
|
(log/debug "[native-module] loginWithConfig")
|
||||||
|
(clear-web-data)
|
||||||
|
(let [config (if config (types/clj->json config) "")]
|
||||||
|
(init-keystore
|
||||||
|
key-uid
|
||||||
|
#(.loginWithConfig ^js (status) account-data hashed-password config))))
|
||||||
|
|
||||||
(defn export-db
|
(defn export-db
|
||||||
"NOTE: beware, the password has to be sha3 hashed"
|
"NOTE: beware, the password has to be sha3 hashed"
|
||||||
[key-uid account-data hashed-password callback]
|
[key-uid account-data hashed-password callback]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user