diff --git a/chia/cmds/passphrase_funcs.py b/chia/cmds/passphrase_funcs.py index fb794e0675..08cf7a88e8 100644 --- a/chia/cmds/passphrase_funcs.py +++ b/chia/cmds/passphrase_funcs.py @@ -11,8 +11,8 @@ import click import colorama from chia.daemon.client import acquire_connection_to_daemon -from chia.util.keychain import Keychain, supports_os_passphrase_storage -from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE, obtain_current_passphrase +from chia.util.keychain import Keychain, default_passphrase, supports_os_passphrase_storage, using_default_passphrase +from chia.util.keyring_wrapper import obtain_current_passphrase SAVE_MASTER_PASSPHRASE_WARNING = ( colorama.Fore.YELLOW @@ -219,17 +219,6 @@ def get_current_passphrase() -> str | None: return current_passphrase -def default_passphrase() -> str: - return DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE - - -def using_default_passphrase() -> bool: - if not Keychain.has_master_passphrase(): - return False - - return Keychain.master_passphrase_is_valid(default_passphrase()) - - def display_passphrase_hint() -> None: passphrase_hint = Keychain.get_master_passphrase_hint() if passphrase_hint is not None: diff --git a/chia/daemon/server.py b/chia/daemon/server.py index f12ced5660..4de16506cc 100644 --- a/chia/daemon/server.py +++ b/chia/daemon/server.py @@ -25,7 +25,6 @@ from chia_rs.sized_ints import uint32 from typing_extensions import Protocol from chia import __version__ -from chia.cmds.passphrase_funcs import default_passphrase, using_default_passphrase from chia.daemon.keychain_server import KeychainServer, keychain_commands from chia.daemon.windows_signal import kill from chia.init.init_funcs import check_keys, chia_init @@ -39,7 +38,14 @@ from chia.util.config import load_config from chia.util.errors import KeychainCurrentPassphraseIsInvalid from chia.util.harvester_config import add_plot_directory from chia.util.json_util import dict_to_json_str -from chia.util.keychain import Keychain, KeyData, passphrase_requirements, supports_os_passphrase_storage +from chia.util.keychain import ( + Keychain, + KeyData, + default_passphrase, + passphrase_requirements, + supports_os_passphrase_storage, + using_default_passphrase, +) from chia.util.lock import Lockfile, LockfileError, service_launch_lock_path from chia.util.log_exceptions import log_exceptions from chia.util.network import WebServer diff --git a/chia/util/keychain.py b/chia/util/keychain.py index 87852495af..7cd50bb336 100644 --- a/chia/util/keychain.py +++ b/chia/util/keychain.py @@ -27,7 +27,7 @@ from chia.util.errors import ( ) from chia.util.file_keyring import Key from chia.util.hash import std_hash -from chia.util.keyring_wrapper import KeyringWrapper +from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE, KeyringWrapper from chia.util.streamable import Streamable, streamable CURRENT_KEY_VERSION = "1.8" @@ -668,3 +668,14 @@ class Keychain: passphrase, as the passphrase hint is written as part of a passphrase update. """ Keychain.set_master_passphrase(current_passphrase, current_passphrase, passphrase_hint=passphrase_hint) + + +def default_passphrase() -> str: + return DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE + + +def using_default_passphrase() -> bool: + if not Keychain.has_master_passphrase(): + return False + + return Keychain.master_passphrase_is_valid(default_passphrase()) diff --git a/tach.toml b/tach.toml index 3c711f5b61..1b4632ce24 100644 --- a/tach.toml +++ b/tach.toml @@ -240,7 +240,6 @@ depends_on = [ "chia.init", "chia.util", { path = "chia.server", deprecated = false }, - { path = "chia.cmds", deprecated = false }, { path = "chia.wallet", deprecated = false }, { path = "chia.plotters", deprecated = false }, ]