From fbbd209549649fa3dad05921231faa04f17bf54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Thu, 21 Sep 2023 22:11:15 -0300 Subject: [PATCH] fix: start passing passphrase when addind passphrase --- src/App.js | 4 ++++ src/sagas/wallet.js | 2 +- src/storage.js | 8 +++++--- src/utils/wallet.js | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 78aa99ea..e8e0ae97 100644 --- a/src/App.js +++ b/src/App.js @@ -257,6 +257,10 @@ const returnStartedRoute = (Component, props, rest) => { return ; } + // Check if we are currently addind the passphrase + // This should hold until we finish loading the wallet + // ... + // Wallet is not loaded, but it is still loading addresses. Go to the loading screen const reduxState = store.getState(); if (reduxState.loadingAddresses) { diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 9dcc6b3e..a0a04e0a 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -120,7 +120,7 @@ export function* startWallet(action) { if (hardware) { yield LOCAL_STORE.initHWStorage(xpub); } else { - yield LOCAL_STORE.initStorage(words, password, pin); + yield LOCAL_STORE.initStorage(words, password, pin, passphrase); } } diff --git a/src/storage.js b/src/storage.js index 2d93440f..e70be107 100644 --- a/src/storage.js +++ b/src/storage.js @@ -89,8 +89,9 @@ export class LocalStorageStore { cleanWallet() { this.removeItem('wallet:id'); this.removeItem(IS_HARDWARE_KEY); - this.removeItem(STARTED_KEY); - this.removeItem(LOCKED_KEY); + // this.removeItem(STARTED_KEY); + // this.removeItem(LOCKED_KEY); + this.lock(); this.removeItem(CLOSED_KEY); delete this._storage; this._storage = null; @@ -104,13 +105,14 @@ export class LocalStorageStore { } } - async initStorage(seed, password, pin) { + async initStorage(seed, password, pin, passphrase='') { this._storage = null; this.setHardwareWallet(false); const accessData = walletUtils.generateAccessDataFromSeed( seed, { pin, + passphrase, password, networkName: config.getNetwork().name, } diff --git a/src/utils/wallet.js b/src/utils/wallet.js index 0309293b..911e00e7 100644 --- a/src/utils/wallet.js +++ b/src/utils/wallet.js @@ -431,7 +431,7 @@ const wallet = { // Clean wallet data, persisted data and redux await this.cleanWallet(wallet); - return this.generateWallet(words, passphrase, pin, password, routerHistory); + this.generateWallet(words, passphrase, pin, password, routerHistory); }, /*