Enhance fingerprint headers

This commit is contained in:
thePR0M3TH3AN
2025-07-07 21:41:09 -04:00
parent a937d93156
commit 76b28e49b9
3 changed files with 167 additions and 38 deletions

View File

@@ -587,10 +587,16 @@ def handle_toggle_secret_mode(pm: PasswordManager) -> None:
def handle_profiles_menu(password_manager: PasswordManager) -> None:
"""Submenu for managing seed profiles."""
while True:
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(getattr(password_manager, "current_fingerprint", None), None, None),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu > Settings > Profiles",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
print(color_text("\nProfiles:", "menu"))
print(color_text("1. Switch Seed Profile", "menu"))
@@ -627,10 +633,16 @@ def handle_nostr_menu(password_manager: PasswordManager) -> None:
return
while True:
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(getattr(password_manager, "current_fingerprint", None), None, None),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu > Settings > Nostr",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
print(color_text("\nNostr Settings:", "menu"))
print(color_text("1. Backup to Nostr", "menu"))
@@ -665,10 +677,16 @@ def handle_nostr_menu(password_manager: PasswordManager) -> None:
def handle_settings(password_manager: PasswordManager) -> None:
"""Interactive settings menu with submenus for profiles and Nostr."""
while True:
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(getattr(password_manager, "current_fingerprint", None), None, None),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu > Settings",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
print(color_text("\nSettings:", "menu"))
print(color_text("1. Profiles", "menu"))
@@ -760,10 +778,16 @@ def display_menu(
display_fn()
pause()
while True:
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(getattr(password_manager, "current_fingerprint", None), None, None),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
if time.time() - password_manager.last_activity > inactivity_timeout:
print(colored("Session timed out. Vault locked.", "yellow"))
@@ -803,10 +827,20 @@ def display_menu(
sys.exit(0)
if choice == "1":
while True:
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(
getattr(password_manager, "current_fingerprint", None),
None,
None,
),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu > Add Entry",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
print(color_text("\nAdd Entry:", "menu"))
print(color_text("1. Password", "menu"))
@@ -852,10 +886,16 @@ def display_menu(
elif choice == "2":
password_manager.update_activity()
password_manager.handle_retrieve_entry()
fp, parent_fp, child_fp = getattr(
password_manager,
"header_fingerprint_args",
(getattr(password_manager, "current_fingerprint", None), None, None),
)
clear_and_print_fingerprint(
getattr(password_manager, "header_fingerprint", None)
or getattr(password_manager, "current_fingerprint", None),
fp,
"Main Menu",
parent_fingerprint=parent_fp,
child_fingerprint=child_fp,
)
elif choice == "3":
password_manager.update_activity()