From a518d72a7dac2df375b81ca193111e530cff23c5 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Fri, 10 Nov 2017 10:30:09 +1100 Subject: [PATCH] Add PGP keys and XMPP handle to the WebFinger output --- wellknowns/views/webfinger.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wellknowns/views/webfinger.py b/wellknowns/views/webfinger.py index 442e94e..ba3f0f2 100644 --- a/wellknowns/views/webfinger.py +++ b/wellknowns/views/webfinger.py @@ -29,15 +29,22 @@ def webfinger(request): def link(rel, href, type): return {'rel': rel, 'href': urljoin(base, href), 'type': type} + key_links = tuple(link( + rel='pgpkey', + href=key.file.url, + type='application/pgp-keys', + ) for key in user.keys.all()) + info = { 'subject': 'acct:' + user.email, 'aliases': ( urljoin(base, user.url), 'mailto:' + user.email, + 'xmpp:' + user.xmpp, ), 'links': ( link(rel=AVATAR, href=user.avatar.url, type='image/png'), link(rel=PROFILE_PAGE, href=user.url, type='text/html'), - ), + ) + key_links, } return JsonResponse(info, content_type='application/jrd+json')