fix(wallet): auto-unlock keystore in wallet runtime for CLI/headless use

get_runtime() now calls ensure_unlocked(interactive=False) when the
keystore is initialized but locked, so HERMES_KEYSTORE_PASSPHRASE and
credential-store-cached passphrases work for wallet CLI commands without
requiring a separate unlock step.

Found during Linux sandbox testing where 'hermes wallet status' failed
with KeystoreLocked despite the env var being set.
This commit is contained in:
Shannon Sands 2026-03-27 11:35:46 +10:00
parent 4f419585b1
commit 24852c6789

View file

@ -63,7 +63,11 @@ def get_runtime():
ks = get_keystore()
if not ks.is_unlocked:
return None, None
try:
if not ks.ensure_unlocked(interactive=False):
return None, None
except Exception:
return None, None
mgr = WalletManager(ks, state_dir=_wallet_state_dir())
wallet_cfg = _load_wallet_config()