Rename password actions to entries

This commit is contained in:
thePR0M3TH3AN
2025-06-29 15:01:21 -04:00
parent 7054442817
commit 3b08bdd5ff
4 changed files with 23 additions and 12 deletions

View File

@@ -122,8 +122,8 @@ python src/main.py
``` ```
Select an option: Select an option:
1. Generate Password 1. Add Entry
2. Retrieve Password 2. Retrieve Entry
3. Modify an Existing Entry 3. Modify an Existing Entry
4. Backup to Nostr 4. Backup to Nostr
5. Restore from Nostr 5. Restore from Nostr

View File

@@ -113,8 +113,8 @@ Enter your master password:
Fingerprint 31DD880A523B9759 selected and managers initialized. Fingerprint 31DD880A523B9759 selected and managers initialized.
Select an option: Select an option:
1. Generate Password 1. Add Entry
2. Retrieve Password 2. Retrieve Entry
3. Modify an Existing Entry 3. Modify an Existing Entry
4. Backup to Nostr 4. Backup to Nostr
5. Restore from Nostr 5. Restore from Nostr

View File

@@ -409,8 +409,8 @@ def display_menu(password_manager: PasswordManager):
""" """
menu = """ menu = """
Select an option: Select an option:
1. Generate Password 1. Add Entry
2. Retrieve Password 2. Retrieve Entry
3. Modify an Existing Entry 3. Modify an Existing Entry
4. Backup to Nostr 4. Backup to Nostr
5. Restore from Nostr 5. Restore from Nostr
@@ -436,9 +436,20 @@ def display_menu(password_manager: PasswordManager):
) )
continue # Re-display the menu without marking as invalid continue # Re-display the menu without marking as invalid
if choice == "1": if choice == "1":
password_manager.handle_generate_password() while True:
print("\nAdd Entry:")
print("1. Password")
print("2. Back")
sub_choice = input("Select entry type: ").strip()
if sub_choice == "1":
password_manager.handle_add_password()
break
elif sub_choice == "2":
break
else:
print(colored("Invalid choice.", "red"))
elif choice == "2": elif choice == "2":
password_manager.handle_retrieve_password() password_manager.handle_retrieve_entry()
elif choice == "3": elif choice == "3":
password_manager.handle_modify_entry() password_manager.handle_modify_entry()
elif choice == "4": elif choice == "4":

View File

@@ -697,7 +697,7 @@ class PasswordManager:
except Exception as e: except Exception as e:
logger.warning(f"Unable to sync index from Nostr: {e}") logger.warning(f"Unable to sync index from Nostr: {e}")
def handle_generate_password(self) -> None: def handle_add_password(self) -> None:
try: try:
website_name = input("Enter the website name: ").strip() website_name = input("Enter the website name: ").strip()
if not website_name: if not website_name:
@@ -746,7 +746,7 @@ class PasswordManager:
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())
print(colored(f"Error: Failed to generate password: {e}", "red")) print(colored(f"Error: Failed to generate password: {e}", "red"))
def handle_retrieve_password(self) -> None: def handle_retrieve_entry(self) -> None:
""" """
Handles retrieving a password from the index by prompting the user for the index number Handles retrieving a password from the index by prompting the user for the index number
and displaying the corresponding password and associated details. and displaying the corresponding password and associated details.
@@ -1208,8 +1208,8 @@ if __name__ == "__main__":
# Example operations # Example operations
# These would typically be triggered by user interactions, e.g., via a CLI menu # These would typically be triggered by user interactions, e.g., via a CLI menu
# manager.handle_generate_password() # manager.handle_add_password()
# manager.handle_retrieve_password() # manager.handle_retrieve_entry()
# manager.handle_modify_entry() # manager.handle_modify_entry()
# manager.handle_verify_checksum() # manager.handle_verify_checksum()
# manager.nostr_client.publish_and_subscribe("Sample password data") # manager.nostr_client.publish_and_subscribe("Sample password data")