Always prompt for GPG key selection for transparency

Remove auto-selection when only one key exists. Users should always
be explicitly aware of which key is being used and have the option
to choose the default key (option 0) instead.

trace/gpg_wizard.py:79-95
This commit is contained in:
Claude
2025-12-14 12:36:12 +00:00
parent dff27ac7e4
commit 085c9e9aa8

View File

@@ -76,27 +76,23 @@ def run_gpg_wizard():
# Let user select a key # Let user select a key
selected_key = None selected_key = None
if len(keys) == 1: while True:
print(f"Only one key found. Using: {keys[0][1]}") try:
selected_key = keys[0][0] choice = input(f"Select a key (1-{len(keys)}, or 0 to use default key): ").strip()
else: choice_num = int(choice)
while True:
try:
choice = input(f"Select a key (1-{len(keys)}, or 0 to use default key): ").strip()
choice_num = int(choice)
if choice_num == 0: if choice_num == 0:
print("Using GPG default key (no specific key ID)") print("Using GPG default key (no specific key ID)")
selected_key = None selected_key = None
break break
elif 1 <= choice_num <= len(keys): elif 1 <= choice_num <= len(keys):
selected_key = keys[choice_num - 1][0] selected_key = keys[choice_num - 1][0]
print(f"Selected: {keys[choice_num - 1][1]}") print(f"Selected: {keys[choice_num - 1][1]}")
break break
else: else:
print(f"Please enter a number between 0 and {len(keys)}") print(f"Please enter a number between 0 and {len(keys)}")
except ValueError: except ValueError:
print("Please enter a valid number") print("Please enter a valid number")
print("\n✓ GPG signing enabled!") print("\n✓ GPG signing enabled!")
if selected_key: if selected_key: