Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-05-10 21:19:13 +01:00
commit be1448179d
3 changed files with 8 additions and 3 deletions

View File

@ -9,6 +9,7 @@ __email__ = "bob@libreserver.org"
__status__ = "Production"
__module_group__ = "Security"
import random
import base64
import hashlib
from datetime import datetime
@ -100,6 +101,7 @@ def generate_json_signature(doc: {}, private_key_pem: str) -> None:
return
options = {
"type": "RsaSignature2017",
"nonce": '%030x' % random.randrange(16**64),
"creator": doc["actor"] + "#main-key",
"created": datetime.utcnow().replace(microsecond=0).isoformat() + "Z",
}

View File

@ -3880,9 +3880,9 @@ def _test_jsonld():
assert signed_document
assert signed_document.get('signature')
assert signed_document['signature'].get('signatureValue')
assert signed_document['signature'].get('nonce')
assert signed_document['signature'].get('type')
assert len(signed_document['signature']['signatureValue']) > 50
# print str(signed_document['signature'])
assert signed_document['signature']['type'] == 'RsaSignature2017'
assert verify_json_signature(signed_document, public_key_pem)
@ -3912,6 +3912,7 @@ def _test_jsonld():
assert len(str(signed_document['signature']['signatureValue'])) > 340
assert (signed_document['signature']['signatureValue'] !=
signed_document2['signature']['signatureValue'])
print('json-ld tests passed')
def _test_site_active():

View File

@ -203,9 +203,11 @@ def html_person_options(default_timeline: str,
': <a href="mailto:' + \
email_address + '">' + remove_html(email_address) + '</a></p>\n'
if web_address:
web_str = remove_html(web_address)
if '://' not in web_str:
web_str = 'https://' + web_str
options_str += \
'<p class="imText">🌐 ' + \
'<a href="' + remove_html(web_address) + '">' + \
'<p class="imText">🌐 <a href="' + web_str + '">' + \
web_address + '</a></p>\n'
if xmpp_address:
options_str += \