mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-07 14:58:56 +00:00
Merge pull request #27 from PR0M3TH3AN/codex/move-seed-profiles-and-nostr-in-settings
Restructure menu system
This commit is contained in:
38
README.md
38
README.md
@@ -125,16 +125,10 @@ python src/main.py
|
||||
1. Add Entry
|
||||
2. Retrieve Entry
|
||||
3. Modify an Existing Entry
|
||||
4. Backup to Nostr
|
||||
5. Restore from Nostr
|
||||
6. Switch Seed Profile
|
||||
7. Add a New Seed Profile
|
||||
8. Remove an Existing Seed Profile
|
||||
9. List All Seed Profiles
|
||||
10. Settings
|
||||
11. Exit
|
||||
4. Settings
|
||||
5. Exit
|
||||
|
||||
Enter your choice (1-11):
|
||||
Enter your choice (1-5):
|
||||
```
|
||||
|
||||
### Managing Multiple Seeds
|
||||
@@ -142,18 +136,18 @@ python src/main.py
|
||||
SeedPass allows you to manage multiple seed profiles (previously referred to as "fingerprints"). Each seed profile has its own parent seed and associated data, enabling you to compartmentalize your passwords.
|
||||
|
||||
- **Add a New Seed Profile:**
|
||||
- Select option `8` from the main menu.
|
||||
- From the main menu, select **Settings** then **Profiles** and choose "Add a New Seed Profile".
|
||||
- Choose to enter an existing seed or generate a new one.
|
||||
- If generating a new seed, you'll be provided with a 12-word BIP-85 seed phrase. **Ensure you write this down and store it securely.**
|
||||
|
||||
- **Switch Between Seed Profiles:**
|
||||
- Select option `7` from the main menu.
|
||||
- From the **Profiles** menu, select "Switch Seed Profile".
|
||||
- You'll see a list of available seed profiles.
|
||||
- Enter the number corresponding to the seed profile you wish to switch to.
|
||||
- Enter the master password associated with that seed profile.
|
||||
|
||||
- **List All Seed Profiles:**
|
||||
- Select option `10` from the main menu to view all existing seed profiles.
|
||||
- In the **Profiles** menu, choose "List All Seed Profiles" to view all existing profiles.
|
||||
|
||||
**Note:** The term "seed profile" is used to represent different sets of seeds you can manage within SeedPass. This provides an intuitive way to handle multiple identities or sets of passwords.
|
||||
|
||||
@@ -169,16 +163,16 @@ wss://relay.primal.net
|
||||
|
||||
You can manage the relay list or change the PIN through the **Settings** menu:
|
||||
|
||||
1. From the main menu, choose option `10` (**Settings**).
|
||||
2. Select `1` to view your current relays.
|
||||
3. Choose `2` to add a new relay URL.
|
||||
4. Select `3` to remove a relay by number.
|
||||
5. Choose `4` to reset to the default relay list.
|
||||
6. Select `5` to change the settings PIN.
|
||||
7. Choose `6` to display your Nostr public key.
|
||||
8. Select `7` to verify the script checksum.
|
||||
9. Choose `8` to back up the parent seed.
|
||||
10. Select `9` to return to the main menu.
|
||||
1. From the main menu, choose option `4` (**Settings**).
|
||||
2. Select `2` (**Nostr**) to open the Nostr submenu.
|
||||
3. Choose `3` to view your current relays.
|
||||
4. Select `4` to add a new relay URL.
|
||||
5. Choose `5` to remove a relay by number.
|
||||
6. Select `6` to reset to the default relay list.
|
||||
7. Choose `7` to display your Nostr public key.
|
||||
8. Select `8` to return to the Settings menu.
|
||||
9. From the Settings menu you can select `3` to change the settings PIN.
|
||||
10. Choose `4` to verify the script checksum or `5` to back up the parent seed.
|
||||
|
||||
## Running Tests
|
||||
|
||||
|
118
src/main.py
118
src/main.py
@@ -357,8 +357,33 @@ def handle_reset_relays(password_manager: PasswordManager) -> None:
|
||||
print(colored(f"Error: {e}", "red"))
|
||||
|
||||
|
||||
def handle_settings(password_manager: PasswordManager) -> None:
|
||||
"""Interactive settings menu for relay list and password changes."""
|
||||
def handle_profiles_menu(password_manager: PasswordManager) -> None:
|
||||
"""Submenu for managing seed profiles."""
|
||||
while True:
|
||||
print("\nProfiles:")
|
||||
print("1. Switch Seed Profile")
|
||||
print("2. Add a New Seed Profile")
|
||||
print("3. Remove an Existing Seed Profile")
|
||||
print("4. List All Seed Profiles")
|
||||
print("5. Back")
|
||||
choice = input("Select an option: ").strip()
|
||||
if choice == "1":
|
||||
if not password_manager.handle_switch_fingerprint():
|
||||
print(colored("Failed to switch seed profile.", "red"))
|
||||
elif choice == "2":
|
||||
handle_add_new_fingerprint(password_manager)
|
||||
elif choice == "3":
|
||||
handle_remove_fingerprint(password_manager)
|
||||
elif choice == "4":
|
||||
handle_list_fingerprints(password_manager)
|
||||
elif choice == "5":
|
||||
break
|
||||
else:
|
||||
print(colored("Invalid choice.", "red"))
|
||||
|
||||
|
||||
def handle_nostr_menu(password_manager: PasswordManager) -> None:
|
||||
"""Submenu for Nostr-related actions and relay configuration."""
|
||||
cfg_mgr = password_manager.config_manager
|
||||
if cfg_mgr is None:
|
||||
print(colored("Configuration manager unavailable.", "red"))
|
||||
@@ -370,34 +395,58 @@ def handle_settings(password_manager: PasswordManager) -> None:
|
||||
return
|
||||
|
||||
while True:
|
||||
print("\nSettings:")
|
||||
print("1. View current relays")
|
||||
print("2. Add a relay URL")
|
||||
print("3. Remove a relay by number")
|
||||
print("4. Reset to default relays")
|
||||
print("5. Change password")
|
||||
print("6. Display Nostr Public Key")
|
||||
print("7. Verify Script Checksum")
|
||||
print("8. Backup Parent Seed")
|
||||
print("9. Back")
|
||||
print("\nNostr Settings:")
|
||||
print("1. Backup to Nostr")
|
||||
print("2. Restore from Nostr")
|
||||
print("3. View current relays")
|
||||
print("4. Add a relay URL")
|
||||
print("5. Remove a relay by number")
|
||||
print("6. Reset to default relays")
|
||||
print("7. Display Nostr Public Key")
|
||||
print("8. Back")
|
||||
choice = input("Select an option: ").strip()
|
||||
if choice == "1":
|
||||
handle_view_relays(cfg_mgr)
|
||||
handle_post_to_nostr(password_manager)
|
||||
elif choice == "2":
|
||||
handle_add_relay(password_manager)
|
||||
handle_retrieve_from_nostr(password_manager)
|
||||
elif choice == "3":
|
||||
handle_remove_relay(password_manager)
|
||||
handle_view_relays(cfg_mgr)
|
||||
elif choice == "4":
|
||||
handle_reset_relays(password_manager)
|
||||
handle_add_relay(password_manager)
|
||||
elif choice == "5":
|
||||
password_manager.change_password()
|
||||
handle_remove_relay(password_manager)
|
||||
elif choice == "6":
|
||||
handle_display_npub(password_manager)
|
||||
handle_reset_relays(password_manager)
|
||||
elif choice == "7":
|
||||
password_manager.handle_verify_checksum()
|
||||
handle_display_npub(password_manager)
|
||||
elif choice == "8":
|
||||
break
|
||||
else:
|
||||
print(colored("Invalid choice.", "red"))
|
||||
|
||||
|
||||
def handle_settings(password_manager: PasswordManager) -> None:
|
||||
"""Interactive settings menu with submenus for profiles and Nostr."""
|
||||
while True:
|
||||
print("\nSettings:")
|
||||
print("1. Profiles")
|
||||
print("2. Nostr")
|
||||
print("3. Change password")
|
||||
print("4. Verify Script Checksum")
|
||||
print("5. Backup Parent Seed")
|
||||
print("6. Back")
|
||||
choice = input("Select an option: ").strip()
|
||||
if choice == "1":
|
||||
handle_profiles_menu(password_manager)
|
||||
elif choice == "2":
|
||||
handle_nostr_menu(password_manager)
|
||||
elif choice == "3":
|
||||
password_manager.change_password()
|
||||
elif choice == "4":
|
||||
password_manager.handle_verify_checksum()
|
||||
elif choice == "5":
|
||||
password_manager.handle_backup_reveal_parent_seed()
|
||||
elif choice == "9":
|
||||
elif choice == "6":
|
||||
break
|
||||
else:
|
||||
print(colored("Invalid choice.", "red"))
|
||||
@@ -412,25 +461,19 @@ def display_menu(password_manager: PasswordManager):
|
||||
1. Add Entry
|
||||
2. Retrieve Entry
|
||||
3. Modify an Existing Entry
|
||||
4. Backup to Nostr
|
||||
5. Restore from Nostr
|
||||
6. Switch Seed Profile
|
||||
7. Add a New Seed Profile
|
||||
8. Remove an Existing Seed Profile
|
||||
9. List All Seed Profiles
|
||||
10. Settings
|
||||
11. Exit
|
||||
4. Settings
|
||||
5. Exit
|
||||
"""
|
||||
while True:
|
||||
# Flush logging handlers
|
||||
for handler in logging.getLogger().handlers:
|
||||
handler.flush()
|
||||
print(colored(menu, "cyan"))
|
||||
choice = input("Enter your choice (1-11): ").strip()
|
||||
choice = input("Enter your choice (1-5): ").strip()
|
||||
if not choice:
|
||||
print(
|
||||
colored(
|
||||
"No input detected. Please enter a number between 1 and 11.",
|
||||
"No input detected. Please enter a number between 1 and 5.",
|
||||
"yellow",
|
||||
)
|
||||
)
|
||||
@@ -453,21 +496,8 @@ def display_menu(password_manager: PasswordManager):
|
||||
elif choice == "3":
|
||||
password_manager.handle_modify_entry()
|
||||
elif choice == "4":
|
||||
handle_post_to_nostr(password_manager)
|
||||
elif choice == "5":
|
||||
handle_retrieve_from_nostr(password_manager)
|
||||
elif choice == "6":
|
||||
if not password_manager.handle_switch_fingerprint():
|
||||
print(colored("Failed to switch seed profile.", "red"))
|
||||
elif choice == "7":
|
||||
handle_add_new_fingerprint(password_manager)
|
||||
elif choice == "8":
|
||||
handle_remove_fingerprint(password_manager)
|
||||
elif choice == "9":
|
||||
handle_list_fingerprints(password_manager)
|
||||
elif choice == "10":
|
||||
handle_settings(password_manager)
|
||||
elif choice == "11":
|
||||
elif choice == "5":
|
||||
logging.info("Exiting the program.")
|
||||
print(colored("Exiting the program.", "green"))
|
||||
password_manager.nostr_client.close_client_pool()
|
||||
|
Reference in New Issue
Block a user