feat: pass node config/kdf to status-go when local pairing (#15072)
4cc53630...8ff91ba0
This commit is contained in:
parent
0f8ad69319
commit
900688dc15
|
@ -797,7 +797,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
final JSONObject jsonConfig = new JSONObject(configJSON);
|
final JSONObject jsonConfig = new JSONObject(configJSON);
|
||||||
final String keyStorePath = pathCombine(this.getNoBackupDirectory(), "/keystore");
|
final String keyStorePath = pathCombine(this.getNoBackupDirectory(), "/keystore");
|
||||||
jsonConfig.put("keystorePath", keyStorePath);
|
jsonConfig.put("keystorePath", keyStorePath);
|
||||||
|
jsonConfig.put("rootDataDir", this.getNoBackupDirectory());
|
||||||
executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
|
executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,12 +329,13 @@ RCT_EXPORT_METHOD(inputConnectionStringForBootstrapping:(NSString *)cs
|
||||||
NSDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
|
NSDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
NSURL *rootUrl =[[fileManager URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
|
NSURL *rootUrl =[[fileManager URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
|
||||||
|
NSURL *rootDataDir = rootUrl.path;
|
||||||
NSURL *multiaccountKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
|
NSURL *multiaccountKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
|
||||||
NSString *keystoreDir = multiaccountKeystoreDir.path;
|
NSString *keystoreDir = multiaccountKeystoreDir.path;
|
||||||
|
|
||||||
[configDict setValue:keystoreDir forKey:@"keystorePath"];
|
[configDict setValue:keystoreDir forKey:@"keystorePath"];
|
||||||
|
[configDict setValue:rootDataDir forKey:@"rootDataDir"];
|
||||||
NSString *modifiedConfigJSON = [configDict bv_jsonStringWithPrettyPrint:NO];
|
NSString *modifiedConfigJSON = [configDict bv_jsonStringWithPrettyPrint:NO];
|
||||||
|
|
||||||
NSString *result = StatusgoInputConnectionStringForBootstrapping(cs,modifiedConfigJSON);
|
NSString *result = StatusgoInputConnectionStringForBootstrapping(cs,modifiedConfigJSON);
|
||||||
callback(@[result]);
|
callback(@[result]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
(let [ks (keys fleet)]
|
(let [ks (keys fleet)]
|
||||||
(some #(string/includes? (str %) "waku") ks)))
|
(some #(string/includes? (str %) "waku") ks)))
|
||||||
|
|
||||||
(defn- get-multiaccount-node-config
|
(defn get-multiaccount-node-config
|
||||||
[{:keys [multiaccount :networks/networks :networks/current-network]
|
[{:keys [multiaccount :networks/networks :networks/current-network]
|
||||||
:as db}]
|
:as db}]
|
||||||
(let [wakuv2-config (get multiaccount :wakuv2-config {})
|
(let [wakuv2-config (get multiaccount :wakuv2-config {})
|
||||||
|
|
|
@ -151,3 +151,5 @@
|
||||||
["enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"]
|
["enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"]
|
||||||
:wakuv2.test
|
:wakuv2.test
|
||||||
["enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"]})
|
["enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"]})
|
||||||
|
|
||||||
|
(def default-kdf-iterations 3200)
|
||||||
|
|
|
@ -3,17 +3,43 @@
|
||||||
[status-im2.contexts.syncing.sheets.enter-password.view :as sheet]
|
[status-im2.contexts.syncing.sheets.enter-password.view :as sheet]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[utils.security.core :as security]))
|
[utils.security.core :as security]
|
||||||
|
[status-im2.config :as config]
|
||||||
|
[status-im.node.core :as node]
|
||||||
|
[re-frame.core :as re-frame]
|
||||||
|
[status-im.data-store.settings :as data-store.settings]))
|
||||||
|
|
||||||
|
(defn- get-default-node-config
|
||||||
|
[installation-id]
|
||||||
|
(let [db {:networks/current-network config/default-network
|
||||||
|
:networks/networks (data-store.settings/rpc->networks config/default-networks)
|
||||||
|
:multiaccount {:installation-id installation-id
|
||||||
|
:log-level config/log-level
|
||||||
|
:waku-bloom-filter-mode false
|
||||||
|
:custom-bootnodes nil
|
||||||
|
:custom-bootnodes-enabled? false}}]
|
||||||
|
(node/get-multiaccount-node-config db)))
|
||||||
|
|
||||||
(rf/defn initiate-local-pairing-with-connection-string
|
(rf/defn initiate-local-pairing-with-connection-string
|
||||||
{:events [:syncing/input-connection-string-for-bootstrapping]}
|
{:events [:syncing/input-connection-string-for-bootstrapping]
|
||||||
[{:keys [db]} {:keys [data]}]
|
:interceptors [(re-frame/inject-cofx :random-guid-generator)]}
|
||||||
(let [config-map (.stringify js/JSON (clj->js {:keyUID "" :keystorePath "" :password ""}))
|
[{:keys [random-guid-generator db]} {connection-string :data}]
|
||||||
connection-string data]
|
(let [installation-id (random-guid-generator)
|
||||||
(status/input-connection-string-for-bootstrapping
|
default-node-config (get-default-node-config installation-id)
|
||||||
connection-string
|
default-node-config-string (.stringify js/JSON (clj->js default-node-config))
|
||||||
config-map
|
callback
|
||||||
#(log/info "this is response from initiate-local-pairing-with-connection-string " %))))
|
(fn [final-node-config]
|
||||||
|
(let [config-map (.stringify js/JSON
|
||||||
|
(clj->js {:kdfIterations config/default-kdf-iterations
|
||||||
|
:nodeConfig final-node-config
|
||||||
|
:settingCurrentNetwork config/default-network}))]
|
||||||
|
(status/input-connection-string-for-bootstrapping
|
||||||
|
connection-string
|
||||||
|
config-map
|
||||||
|
#(log/info "Initiated local pairing"
|
||||||
|
{:response %
|
||||||
|
:event :syncing/input-connection-string-for-bootstrapping}))))]
|
||||||
|
(status/prepare-dir-and-update-config "" default-node-config-string callback)))
|
||||||
|
|
||||||
(rf/defn preparations-for-connection-string
|
(rf/defn preparations-for-connection-string
|
||||||
{:events [:syncing/get-connection-string-for-bootstrapping-another-device]}
|
{:events [:syncing/get-connection-string-for-bootstrapping-another-device]}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"_comment": "THIS SHOULD NOT BE EDITED BY HAND.",
|
"_comment": "THIS SHOULD NOT BE EDITED BY HAND.",
|
||||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "v0.131.7",
|
"version": "v0.131.10",
|
||||||
"commit-sha1": "97579ee36393955705e51f364fce3ab40d1d6921",
|
"commit-sha1": "8ff91ba0024f5ecf05d29904288537b236329f51",
|
||||||
"src-sha256": "0b15kv6f1f1935lljl4bmvmndsr5smb9kxazx0fxz6xfsyjd1x5i"
|
"src-sha256": "1m3an4fhzhh0vq8bb24xfjwdysfdd9qrz08a3gfz3ddahkh41jad"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue