From 1ea90a5dbb637220fd64f72b928016a06db27019 Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 10 Feb 2021 01:54:45 +0000 Subject: [PATCH] Include unique set of UID emails on key representations --- api/mailinabox.yml | 4 ++++ management/pgp.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/api/mailinabox.yml b/api/mailinabox.yml index 300fef3..71ae73b 100644 --- a/api/mailinabox.yml +++ b/api/mailinabox.yml @@ -3185,6 +3185,10 @@ components: type: array items: type: string + ids_emails: + type: array + items: + $ref: '#/components/schemas/Email' master_fpr: type: string revoked: diff --git a/management/pgp.py b/management/pgp.py index c56ecb5..5839c1b 100755 --- a/management/pgp.py +++ b/management/pgp.py @@ -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,