fix(client): Choose correct fingerprint for pubkey

This commit is contained in:
s3lph 2023-01-31 02:07:33 +01:00
parent 082d7d93d4
commit 9182582589

View file

@ -540,8 +540,8 @@ def _gpg_get_uid_fp(address: str):
elif line.startswith('fpr:'):
fpr = line.split(':')[9]
fprs.append(fpr)
valid = {fprs[i]: pub for i, pub in enumerate(pubs) if not revoked[i]}
revoked = {fprs[i]: pub for i, pub in enumerate(pubs) if revoked[i]}
valid = {next((f for f in fprs if f.endswith(pub))): pub for i, pub in enumerate(pubs) if not revoked[i]}
revoked = {next((f for f in fprs if f.endswith(pub))): pub for i, pub in enumerate(pubs) if revoked[i]}
if len(valid) == 0:
raise ValueError(f'No valid key found for {address}.')
elif len(valid) > 1: