diff --git a/src/components/settings/SecurityLogin/SocialSignerExport/ExportMPCAccountModal.tsx b/src/components/settings/SecurityLogin/SocialSignerExport/ExportMPCAccountModal.tsx index f1605d8474..baa6946b33 100644 --- a/src/components/settings/SecurityLogin/SocialSignerExport/ExportMPCAccountModal.tsx +++ b/src/components/settings/SecurityLogin/SocialSignerExport/ExportMPCAccountModal.tsx @@ -14,12 +14,10 @@ import { asError } from '@/services/exceptions/utils' import useSocialWallet from '@/hooks/wallets/mpc/useSocialWallet' enum ExportFieldNames { - password = 'password', pk = 'pk', } type ExportFormData = { - [ExportFieldNames.password]: string [ExportFieldNames.pk]: string | undefined } @@ -30,21 +28,18 @@ const ExportMPCAccountModal = ({ onClose, open }: { onClose: () => void; open: b const [showPassword, setShowPassword] = useState(false) const formMethods = useForm({ mode: 'all', - defaultValues: { - [ExportFieldNames.password]: '', - }, }) const { register, formState, handleSubmit, setValue, watch, reset } = formMethods const exportedKey = watch(ExportFieldNames.pk) - const onSubmit = async (data: ExportFormData) => { + const onSubmit = async () => { if (!socialWalletService) { return } try { setError(undefined) - const pk = await socialWalletService.exportSignerKey(data[ExportFieldNames.password]) + const pk = await socialWalletService.exportSignerKey() trackEvent(MPC_WALLET_EVENTS.EXPORT_PK_SUCCESS) setValue(ExportFieldNames.pk, pk) } catch (err) { diff --git a/src/services/mpc/SocialWalletService.ts b/src/services/mpc/SocialWalletService.ts index 12cad18cdb..82b3f79034 100644 --- a/src/services/mpc/SocialWalletService.ts +++ b/src/services/mpc/SocialWalletService.ts @@ -175,16 +175,12 @@ class SocialWalletService implements ISocialWalletService { return this.mpcCoreKit.status === COREKIT_STATUS.LOGGED_IN } - async exportSignerKey(password: string): Promise { + async exportSignerKey(): Promise { try { - if (this.securityQuestionRecovery.isEnabled()) { - // Only export PK if recovery works - await this.securityQuestionRecovery.recoverWithPassword(password) - } const exportedPK = await this.mpcCoreKit?._UNSAFE_exportTssKey() return exportedPK } catch (err) { - throw new Error('Error exporting account. Make sure the password is correct.') + throw new Error('Error exporting account. ' + (err as Error).message) } } diff --git a/src/services/mpc/interfaces.ts b/src/services/mpc/interfaces.ts index b76ace0eec..b9fd1e7aec 100644 --- a/src/services/mpc/interfaces.ts +++ b/src/services/mpc/interfaces.ts @@ -27,7 +27,7 @@ export interface ISocialWalletService { * * @param password recovery password */ - exportSignerKey(password: string): Promise + exportSignerKey(): Promise /** * Returns true if MFA is enabled