Export unencrypted db on iOS
This commit is contained in:
parent
1034d542db
commit
9035954f8b
|
@ -371,7 +371,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void exportUnencryptedDatabase(final String accountData, final String password) {
|
public void exportUnencryptedDatabase(final String accountData, final String password, final Callback callback) {
|
||||||
Log.d(TAG, "login");
|
Log.d(TAG, "login");
|
||||||
|
|
||||||
final File newFile = getExportDBFile();
|
final File newFile = getExportDBFile();
|
||||||
|
|
|
@ -853,11 +853,16 @@ StatusgoStartLocalNotifications();
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(exportUnencryptedDatabase:(NSString *)accountData
|
RCT_EXPORT_METHOD(exportUnencryptedDatabase:(NSString *)accountData
|
||||||
password:(NSString *)password) {
|
password:(NSString *)password
|
||||||
|
callback:(RCTResponseSenderBlock)callback) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
NSLog(@"exportUnencryptedDatabase() method called");
|
NSLog(@"exportUnencryptedDatabase() method called");
|
||||||
#endif
|
#endif
|
||||||
"";
|
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"export.db"];
|
||||||
|
|
||||||
|
StatusgoExportUnencryptedDatabase(accountData, password, filePath);
|
||||||
|
|
||||||
|
callback(@[filePath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(importUnencryptedDatabase:(NSString *)accountData
|
RCT_EXPORT_METHOD(importUnencryptedDatabase:(NSString *)accountData
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
[status-im.navigation :as navigation]
|
[status-im.navigation :as navigation]
|
||||||
[status-im.signing.eip1559 :as eip1559]
|
[status-im.signing.eip1559 :as eip1559]
|
||||||
[status-im.data-store.chats :as data-store.chats]
|
[status-im.data-store.chats :as data-store.chats]
|
||||||
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]))
|
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
|
||||||
|
[status-im.ui.components.react :as react]
|
||||||
|
[status-im.utils.platform :as platform]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::initialize-communities-enabled
|
::initialize-communities-enabled
|
||||||
|
@ -65,8 +67,8 @@
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::export-db
|
::export-db
|
||||||
(fn [[key-uid account-data hashed-password]]
|
(fn [[key-uid account-data hashed-password callback]]
|
||||||
(status/export-db key-uid account-data hashed-password)))
|
(status/export-db key-uid account-data hashed-password callback)))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::import-db
|
::import-db
|
||||||
|
@ -146,7 +148,12 @@
|
||||||
(types/clj->json {:name name
|
(types/clj->json {:name name
|
||||||
:key-uid key-uid
|
:key-uid key-uid
|
||||||
:identicon identicon})
|
:identicon identicon})
|
||||||
(ethereum/sha3 (security/safe-unmask-data password))]}))
|
(ethereum/sha3 (security/safe-unmask-data password))
|
||||||
|
(fn [path]
|
||||||
|
(when platform/ios?
|
||||||
|
(let [uri (str "file://" path)]
|
||||||
|
(.share ^js react/sharing (clj->js {:title "Unencrypted database"
|
||||||
|
:url uri})))))]}))
|
||||||
|
|
||||||
(fx/defn import-db-submitted
|
(fx/defn import-db-submitted
|
||||||
{:events [:multiaccounts.login.ui/import-db-submitted]}
|
{:events [:multiaccounts.login.ui/import-db-submitted]}
|
||||||
|
|
|
@ -66,12 +66,12 @@
|
||||||
|
|
||||||
(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]
|
[key-uid account-data hashed-password callback]
|
||||||
(log/debug "[native-module] export-db")
|
(log/debug "[native-module] export-db")
|
||||||
(clear-web-data)
|
(clear-web-data)
|
||||||
(init-keystore
|
(init-keystore
|
||||||
key-uid
|
key-uid
|
||||||
#(.exportUnencryptedDatabase ^js (status) account-data hashed-password)))
|
#(.exportUnencryptedDatabase ^js (status) account-data hashed-password callback)))
|
||||||
|
|
||||||
(defn import-db
|
(defn import-db
|
||||||
"NOTE: beware, the password has to be sha3 hashed"
|
"NOTE: beware, the password has to be sha3 hashed"
|
||||||
|
|
Loading…
Reference in New Issue