Base64 encode pgp public key within vcard

main
Bob Mottram 2022-02-15 16:09:04 +00:00
parent 28111275f1
commit c77b64baf9
1 changed files with 3 additions and 1 deletions

4
pgp.py
View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
import os
import base64
import subprocess
from pathlib import Path
from person import get_actor_json
@ -645,7 +646,8 @@ def actor_to_vcard(actor: {}) -> str:
vcard_str += 'PHOTO:' + actor['icon']['url'] + '\n'
pgp_key = get_pgp_pub_key(actor)
if pgp_key:
vcard_str += 'KEY;TYPE=PGP:' + pgp_key + '\n'
vcard_str += 'KEY:data:application/pgp-keys;base64,' + \
base64.b64encode(pgp_key).decode('utf-8') + '\n'
email_address = get_email_address(actor)
if email_address:
vcard_str += 'EMAIL;TYPE=internet:' + email_address + '\n'