Include unique set of UID emails on key representations

This commit is contained in:
David Duque 2021-02-10 01:54:45 +00:00
parent a4675b821a
commit 1ea90a5dbb
No known key found for this signature in database
GPG key ID: 2F327738A3C0AE3A
2 changed files with 6 additions and 0 deletions

View file

@ -3185,6 +3185,10 @@ components:
type: array
items:
type: string
ids_emails:
type: array
items:
$ref: '#/components/schemas/Email'
master_fpr:
type: string
revoked:

View file

@ -18,11 +18,13 @@ def key_representation(key):
"master_fpr": key.fpr,
"revoked": key.revoked != 0,
"ids": [],
"ids_emails": {},
"subkeys": []
}
now = datetime.datetime.utcnow()
key_rep["ids"] = [ id.uid for id in key.uids ]
key_rep["ids_emails"] = list({ id.email for id in key.uids }) # No duplicate email addresses in this list
key_rep["subkeys"] = [{
"master": skey.fpr == key.fpr,
"sign": skey.can_sign == 1,