From 2e132ba4192abaa3cb2c470fcab8d4886de4b0f9 Mon Sep 17 00:00:00 2001 From: Danny Cho Date: Thu, 16 Nov 2023 16:21:42 +1300 Subject: [PATCH 1/2] feat: skip bypass key rotation step --- .../wallet-migration/modals/Disable2faModal/Disable2FA.jsx | 2 +- .../modals/WalletSelectorModal/WalletSelectorModal.jsx | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/components/wallet-migration/modals/Disable2faModal/Disable2FA.jsx b/packages/frontend/src/components/wallet-migration/modals/Disable2faModal/Disable2FA.jsx index b0b35cb989..d9a92c2433 100644 --- a/packages/frontend/src/components/wallet-migration/modals/Disable2faModal/Disable2FA.jsx +++ b/packages/frontend/src/components/wallet-migration/modals/Disable2faModal/Disable2FA.jsx @@ -140,7 +140,7 @@ const Disable2FAModal = ({ handleSetActiveView, onClose, accountWithDetails, set useEffect(() => { if (completedWithSuccess) { - handleSetActiveView(WALLET_MIGRATION_VIEWS.ROTATE_KEYS); + handleSetActiveView(WALLET_MIGRATION_VIEWS.MIGRATE_ACCOUNTS); } }, [completedWithSuccess]); diff --git a/packages/frontend/src/components/wallet-migration/modals/WalletSelectorModal/WalletSelectorModal.jsx b/packages/frontend/src/components/wallet-migration/modals/WalletSelectorModal/WalletSelectorModal.jsx index f5781bfede..4369a63e47 100644 --- a/packages/frontend/src/components/wallet-migration/modals/WalletSelectorModal/WalletSelectorModal.jsx +++ b/packages/frontend/src/components/wallet-migration/modals/WalletSelectorModal/WalletSelectorModal.jsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; +import { wallet } from '../../../../utils/wallet'; import { WalletSelectorContent } from './WalletSelectorContent'; import { ExportAccountSelectorContextProvider } from './WalletSelectorExportContext'; @@ -9,11 +10,7 @@ export const WalletSelectorModal = ({ onComplete, migrationAccounts, network, ro const init = async () => { const accountsWithKey = await Promise.all(migrationAccounts.map(async (account) => { const accountId = account.accountId; - const privateKey = rotatedKeys[accountId]; - if (!privateKey) { - throw new Error('Unable to find a private key from the rotated keys'); - } - + const privateKey = await wallet.getLocalSecretKey(accountId); return { accountId, privateKey, From 74c25ad9259b5cf019f3fa7963f63ebf17ade8f3 Mon Sep 17 00:00:00 2001 From: Danny Cho Date: Fri, 17 Nov 2023 10:23:01 +1300 Subject: [PATCH 2/2] fix: avoid deleting FAK on chain during the transfer wizard logout --- .../src/components/wallet-migration/WalletMigration.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx index ba4f7c7914..4006083149 100644 --- a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx +++ b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx @@ -124,10 +124,7 @@ const WalletMigration = ({ open, onClose }) => { setIsLoggingOut(true); const failedAccounts = []; for (const accountId of availableAccounts) { - const publicKey = await wallet.getPublicKey(accountId); try { - const account = await wallet.getAccount(accountId); - await account.deleteKey(publicKey); await wallet.removeWalletAccount(accountId); } catch { failedAccounts.push(accountIdToHash(accountId));