From f46de144a9d577017aab368897f92813a08909f0 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 16 Jul 2025 03:22:47 -0400 Subject: [PATCH] Validate BIP-85 seeds using Mnemonic --- src/password_manager/manager.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/password_manager/manager.py b/src/password_manager/manager.py index 8f94817..89e5d22 100644 --- a/src/password_manager/manager.py +++ b/src/password_manager/manager.py @@ -87,6 +87,7 @@ from pathlib import Path from local_bip85.bip85 import BIP85, Bip85Error from bip_utils import Bip39SeedGenerator, Bip39MnemonicGenerator, Bip39Languages +from mnemonic import Mnemonic from datetime import datetime from utils.fingerprint_manager import FingerprintManager @@ -909,11 +910,11 @@ class PasswordManager: bool: True if valid, False otherwise. """ try: - words = seed.split() - if len(words) != 12: - return False - # Additional validation can be added here if needed (e.g., word list checks) - return True + checker = Mnemonic("english") + if checker.check(seed): + return True + logging.error("Invalid BIP-85 seed provided") + return False except Exception as e: logging.error(f"Error validating BIP-85 seed: {e}") return False