create clan: better info about existing sop keys

When creating a new clan, the key selection now looks like this:
```
Found existing admin keys on this machine:
1: type: AGE
   pubkey: age1xyz...
   source: /home/grmpf/.config/sops/age/keys.txt
2: type: PGP
   pubkey: abc...
   source: SOPS_PGP_FP
Select keys to use (comma-separated list of numbers, or leave empty to select all):
```

This is achieved by adding a `source` attribute to `SopsKey`.
This commit is contained in:
DavHau
2025-07-23 13:19:18 +07:00
parent c94330ee9c
commit cc69892e3b
5 changed files with 61 additions and 18 deletions

View File

@@ -50,7 +50,9 @@ def _select_keys_interactive(pub_keys: list[SopsKey]) -> list[SopsKey]:
log.info("\nFound existing admin keys on this machine:")
selected_keys: list[SopsKey] = []
for i, key in enumerate(pub_keys):
log.info(f"{i + 1}: {key}")
log.info(
f"{i + 1}: type: {key.key_type}\n pubkey: {key.pubkey}\n source: {key.source}"
)
while not selected_keys:
choice = input(
"Select keys to use (comma-separated list of numbers, or leave empty to select all): "