From 5a2f3a0f06c6795aa224fc6798ded7ea82e3d06c Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 2 Nov 2025 14:26:07 +0100 Subject: [PATCH] change filename for password to using pubkey instead of node name --- src/meshcore_cli/meshcore_cli.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 46d0647..5162bff 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -990,7 +990,18 @@ async def process_contact_chat_line(mc, contact, line): password_file = "" password = "" if os.path.isdir(MCCLI_CONFIG_DIR) : + # if a password file exists with node name open it and destroy it password_file = MCCLI_CONFIG_DIR + contact['adv_name'] + ".pass" + if os.path.exists(password_file) : + with open(password_file, "r", encoding="utf-8") as f : + password=f.readline().strip() + os.remove(password_file) + password_file = MCCLI_CONFIG_DIR + contact["public_key"] + ".pass" + with open(password_file, "w", encoding="utf-8") as f : + f.write(password) + + # this is the new correct password file, using pubkey + password_file = MCCLI_CONFIG_DIR + contact["public_key"] + ".pass" if os.path.exists(password_file) : with open(password_file, "r", encoding="utf-8") as f : password=f.readline().strip() @@ -1013,6 +1024,9 @@ async def process_contact_chat_line(mc, contact, line): if line.startswith("forget_password") or line.startswith("fp"): password_file = MCCLI_CONFIG_DIR + contact['adv_name'] + ".pass" + if os.path.exists(password_file): + os.remove(password_file) + password_file = MCCLI_CONFIG_DIR + contact['public_key'] + ".pass" if os.path.exists(password_file): os.remove(password_file) try: