diff --git a/src/components/SeedBlender.tsx b/src/components/SeedBlender.tsx index 444064b..d8e4dbc 100644 --- a/src/components/SeedBlender.tsx +++ b/src/components/SeedBlender.tsx @@ -96,18 +96,23 @@ export function SeedBlender({ onDirtyStateChange, setMnemonicForBackup, requestT const validMnemonics = entries.map(e => e.decryptedMnemonic).filter((m): m is string => m !== null && m.length > 0); const validityPromises = entries.map(async (entry) => { - if (!entry.rawInput.trim()) return null; - if (entry.isEncrypted && !entry.decryptedMnemonic) return null; // Cannot validate until decrypted + if (!entry.rawInput.trim()) return { isValid: null, error: null }; + if (entry.isEncrypted && !entry.decryptedMnemonic) return { isValid: null, error: null }; + const textToValidate = entry.decryptedMnemonic || entry.rawInput; try { await mnemonicToEntropy(textToValidate.trim()); - return true; - } catch { - return false; + return { isValid: true, error: null }; + } catch (e: any) { + return { isValid: false, error: e.message || "Invalid mnemonic" }; } }); - const newValidity = await Promise.all(validityPromises); - setEntries(currentEntries => currentEntries.map((e, i) => ({ ...e, isValid: newValidity[i] }))); + const newValidationResults = await Promise.all(validityPromises); + setEntries(currentEntries => currentEntries.map((e, i) => ({ + ...e, + isValid: newValidationResults[i]?.isValid ?? e.isValid, + error: newValidationResults[i]?.error ?? e.error, + }))); if (validMnemonics.length > 0) { try { @@ -223,16 +228,19 @@ export function SeedBlender({ onDirtyStateChange, setMnemonicForBackup, requestT {entry.error &&

{entry.error}

} ) : ( -
-
-