Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,9 @@ function DefaultComponent({ children }) {
// If this is a hardware wallet that has been locked, navigate to the "Wallet Type" screen
if (isLockedScreen &&
LOCAL_STORE.isHardwareWallet()) {
// This exit path bypasses resetStorage, so clear the registered data too.
LOCAL_STORE.cleanWallet({ cleanRegisteredData: true });
// This will redirect the page to Wallet Type screen
LOCAL_STORE.cleanWallet();
return <Navigate to={'/wallet_type/'} />;
}

Expand Down
15 changes: 13 additions & 2 deletions src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,23 @@ export class LocalStorageStore {
}

/**
* Clean wallet metadata
* Clean wallet metadata.
*
* @param {Object} [options]
* @param {boolean} [options.cleanRegisteredData=false] Also drop the
* wallet-scoped registered tokens, nano contracts and Ledger token
* signatures. Used by exit paths that bypass resetStorage, so this data
* doesn't leak into the next wallet.
*/
cleanWallet() {
cleanWallet({ cleanRegisteredData = false } = {}) {
this.removeItem(IS_HARDWARE_KEY);
this.removeItem(CLOSED_KEY);
this.removeItem(ACCESS_DATA_KEY);
if (cleanRegisteredData) {
this.removeItem(REGISTERED_TOKENS_KEY);
this.removeItem(REGISTERED_NANOCONTRACTS_KEY);
this.removeItem(TOKEN_SIGNATURES_KEY);
}
delete this._storage;
this._storage = null;
}
Expand Down
Loading