mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Merge branch 'main' of gitlab.com:bashrc2/epicyon
						commit
						be1448179d
					
				|  | @ -9,6 +9,7 @@ __email__ = "bob@libreserver.org" | ||||||
| __status__ = "Production" | __status__ = "Production" | ||||||
| __module_group__ = "Security" | __module_group__ = "Security" | ||||||
| 
 | 
 | ||||||
|  | import random | ||||||
| import base64 | import base64 | ||||||
| import hashlib | import hashlib | ||||||
| from datetime import datetime | from datetime import datetime | ||||||
|  | @ -100,6 +101,7 @@ def generate_json_signature(doc: {}, private_key_pem: str) -> None: | ||||||
|         return |         return | ||||||
|     options = { |     options = { | ||||||
|         "type": "RsaSignature2017", |         "type": "RsaSignature2017", | ||||||
|  |         "nonce": '%030x' % random.randrange(16**64), | ||||||
|         "creator": doc["actor"] + "#main-key", |         "creator": doc["actor"] + "#main-key", | ||||||
|         "created": datetime.utcnow().replace(microsecond=0).isoformat() + "Z", |         "created": datetime.utcnow().replace(microsecond=0).isoformat() + "Z", | ||||||
|     } |     } | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								tests.py
								
								
								
								
							
							
						
						
									
										3
									
								
								tests.py
								
								
								
								
							|  | @ -3880,9 +3880,9 @@ def _test_jsonld(): | ||||||
|     assert signed_document |     assert signed_document | ||||||
|     assert signed_document.get('signature') |     assert signed_document.get('signature') | ||||||
|     assert signed_document['signature'].get('signatureValue') |     assert signed_document['signature'].get('signatureValue') | ||||||
|  |     assert signed_document['signature'].get('nonce') | ||||||
|     assert signed_document['signature'].get('type') |     assert signed_document['signature'].get('type') | ||||||
|     assert len(signed_document['signature']['signatureValue']) > 50 |     assert len(signed_document['signature']['signatureValue']) > 50 | ||||||
|     # print str(signed_document['signature']) |  | ||||||
|     assert signed_document['signature']['type'] == 'RsaSignature2017' |     assert signed_document['signature']['type'] == 'RsaSignature2017' | ||||||
|     assert verify_json_signature(signed_document, public_key_pem) |     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 len(str(signed_document['signature']['signatureValue'])) > 340 | ||||||
|     assert (signed_document['signature']['signatureValue'] != |     assert (signed_document['signature']['signatureValue'] != | ||||||
|             signed_document2['signature']['signatureValue']) |             signed_document2['signature']['signatureValue']) | ||||||
|  |     print('json-ld tests passed') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def _test_site_active(): | def _test_site_active(): | ||||||
|  |  | ||||||
|  | @ -203,9 +203,11 @@ def html_person_options(default_timeline: str, | ||||||
|             ': <a href="mailto:' + \ |             ': <a href="mailto:' + \ | ||||||
|             email_address + '">' + remove_html(email_address) + '</a></p>\n' |             email_address + '">' + remove_html(email_address) + '</a></p>\n' | ||||||
|     if web_address: |     if web_address: | ||||||
|  |         web_str = remove_html(web_address) | ||||||
|  |         if '://' not in web_str: | ||||||
|  |             web_str = 'https://' + web_str | ||||||
|         options_str += \ |         options_str += \ | ||||||
|             '<p class="imText">🌐 ' + \ |             '<p class="imText">🌐 <a href="' + web_str + '">' + \ | ||||||
|             '<a href="' + remove_html(web_address) + '">' + \ |  | ||||||
|             web_address + '</a></p>\n' |             web_address + '</a></p>\n' | ||||||
|     if xmpp_address: |     if xmpp_address: | ||||||
|         options_str += \ |         options_str += \ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue