| … | … | @@ -595,8 +595,8 @@ async function exportIdentity() { |
| 595 | 595 | return |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | | // Prompt for password |
| 599 | | const password = prompt('🔒 Enter your encryption password:') |
| 598 | // Use modal instead of prompt() which is blocked in Pear/Electron |
| 599 | const password = await promptForPasswordModal('Enter your encryption password to export identity mnemonic:') |
| 600 | 600 | if (!password) { |
| 601 | 601 | showError('Password required to export mnemonic') |
| 602 | 602 | return |
| … | … | @@ -637,8 +637,8 @@ async function exportWalletMnemonic() { |
| 637 | 637 | return |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | | // Prompt for password |
| 641 | | const password = prompt('🔒 Enter your encryption password:') |
| 640 | // Use modal instead of prompt() which is blocked in Pear/Electron |
| 641 | const password = await promptForPasswordModal('Enter your encryption password to export wallet mnemonic:') |
| 642 | 642 | if (!password) { |
| 643 | 643 | showError('Password required to export mnemonic') |
| 644 | 644 | return |
| … | … | @@ -3653,6 +3653,62 @@ window.setWalletAddressCurrent = setWalletAddressCurrent |
| 3653 | 3653 | window.showAddWallet = showAddWallet |
| 3654 | 3654 | window.showTxDetails = showTxDetails |
| 3655 | 3655 | |
| 3656 | // Password prompt modal functions (replaces blocked prompt()) |
| 3657 | let passwordPromptResolver = null |
| 3658 | |
| 3659 | function promptForPasswordModal(message = 'Enter your password:') { |
| 3660 | return new Promise((resolve) => { |
| 3661 | const modal = document.getElementById('password-prompt-modal') |
| 3662 | const messageEl = document.getElementById('password-prompt-message') |
| 3663 | const inputEl = document.getElementById('password-prompt-input') |
| 3664 | |
| 3665 | messageEl.textContent = message |
| 3666 | inputEl.value = '' |
| 3667 | passwordPromptResolver = resolve |
| 3668 | |
| 3669 | modal.showModal() |
| 3670 | inputEl.focus() |
| 3671 | |
| 3672 | // Allow Enter key to submit |
| 3673 | inputEl.onkeypress = (e) => { |
| 3674 | if (e.key === 'Enter') { |
| 3675 | submitPasswordPrompt() |
| 3676 | } |
| 3677 | } |
| 3678 | }) |
| 3679 | } |
| 3680 | |
| 3681 | function submitPasswordPrompt() { |
| 3682 | const modal = document.getElementById('password-prompt-modal') |
| 3683 | const inputEl = document.getElementById('password-prompt-input') |
| 3684 | const password = inputEl.value |
| 3685 | |
| 3686 | if (passwordPromptResolver) { |
| 3687 | passwordPromptResolver(password) |
| 3688 | passwordPromptResolver = null |
| 3689 | } |
| 3690 | |
| 3691 | inputEl.value = '' |
| 3692 | modal.close() |
| 3693 | } |
| 3694 | |
| 3695 | function closePasswordPrompt() { |
| 3696 | const modal = document.getElementById('password-prompt-modal') |
| 3697 | const inputEl = document.getElementById('password-prompt-input') |
| 3698 | |
| 3699 | if (passwordPromptResolver) { |
| 3700 | passwordPromptResolver(null) |
| 3701 | passwordPromptResolver = null |
| 3702 | } |
| 3703 | |
| 3704 | inputEl.value = '' |
| 3705 | modal.close() |
| 3706 | } |
| 3707 | |
| 3708 | window.promptForPasswordModal = promptForPasswordModal |
| 3709 | window.submitPasswordPrompt = submitPasswordPrompt |
| 3710 | window.closePasswordPrompt = closePasswordPrompt |
| 3711 | |
| 3656 | 3712 | // Mnemonic display modal functions |
| 3657 | 3713 | let currentMnemonic = '' |
| 3658 | 3714 | |