mirror of https://gitlab.com/bashrc2/epicyon
parent
d68becabf7
commit
7b0f76db35
|
@ -309,8 +309,6 @@ def create_signed_header(date_str: str, private_key_pem: str, nickname: str,
|
||||||
to_domain, to_port,
|
to_domain, to_port,
|
||||||
path, http_prefix, message_body_json_str,
|
path, http_prefix, message_body_json_str,
|
||||||
content_type, algorithm, digest_algorithm)
|
content_type, algorithm, digest_algorithm)
|
||||||
if not signature_header:
|
|
||||||
return {}
|
|
||||||
headers['signature'] = signature_header
|
headers['signature'] = signature_header
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
|
|
8
posts.py
8
posts.py
|
@ -2516,15 +2516,11 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
||||||
to_domain, to_port,
|
to_domain, to_port,
|
||||||
post_path, http_prefix, with_digest,
|
post_path, http_prefix, with_digest,
|
||||||
post_json_str, 'application/activity+json')
|
post_json_str, 'application/activity+json')
|
||||||
if not signature_header_json:
|
|
||||||
return 8
|
|
||||||
signature_header_json_ld = \
|
signature_header_json_ld = \
|
||||||
create_signed_header(None, private_key_pem, nickname, domain, port,
|
create_signed_header(None, private_key_pem, nickname, domain, port,
|
||||||
to_domain, to_port,
|
to_domain, to_port,
|
||||||
post_path, http_prefix, with_digest,
|
post_path, http_prefix, with_digest,
|
||||||
post_json_str, 'application/ld+json')
|
post_json_str, 'application/ld+json')
|
||||||
if not signature_header_json_ld:
|
|
||||||
return 9
|
|
||||||
|
|
||||||
# if the "to" domain is within the shared items
|
# if the "to" domain is within the shared items
|
||||||
# federation list then send the token for this domain
|
# federation list then send the token for this domain
|
||||||
|
@ -2949,16 +2945,12 @@ def send_signed_json(post_json_object: {}, session, base_dir: str,
|
||||||
post_path, http_prefix, with_digest,
|
post_path, http_prefix, with_digest,
|
||||||
post_json_str,
|
post_json_str,
|
||||||
'application/activity+json')
|
'application/activity+json')
|
||||||
if not signature_header_json:
|
|
||||||
return 10
|
|
||||||
signature_header_json_ld = \
|
signature_header_json_ld = \
|
||||||
create_signed_header(None, private_key_pem, nickname, domain, port,
|
create_signed_header(None, private_key_pem, nickname, domain, port,
|
||||||
to_domain, to_port,
|
to_domain, to_port,
|
||||||
post_path, http_prefix, with_digest,
|
post_path, http_prefix, with_digest,
|
||||||
post_json_str,
|
post_json_str,
|
||||||
'application/ld+json')
|
'application/ld+json')
|
||||||
if not signature_header_json_ld:
|
|
||||||
return 11
|
|
||||||
# optionally add a token so that the receiving instance may access
|
# optionally add a token so that the receiving instance may access
|
||||||
# your shared items catalog
|
# your shared items catalog
|
||||||
if shared_items_token:
|
if shared_items_token:
|
||||||
|
|
|
@ -200,8 +200,6 @@ def _get_json_signed(session, url: str, domain_full: str, session_headers: {},
|
||||||
create_signed_header(None, signing_priv_key_pem, 'actor', domain, port,
|
create_signed_header(None, signing_priv_key_pem, 'actor', domain, port,
|
||||||
to_domain, to_port, path, http_prefix,
|
to_domain, to_port, path, http_prefix,
|
||||||
with_digest, message_str, content_type)
|
with_digest, message_str, content_type)
|
||||||
if not signature_header_json:
|
|
||||||
return {}
|
|
||||||
if debug:
|
if debug:
|
||||||
print('Signed GET signature_header_json ' + str(signature_header_json))
|
print('Signed GET signature_header_json ' + str(signature_header_json))
|
||||||
# update the session headers from the signature headers
|
# update the session headers from the signature headers
|
||||||
|
|
6
tests.py
6
tests.py
|
@ -316,7 +316,6 @@ def _test_http_signed_get(base_dir: str):
|
||||||
host_domain, port,
|
host_domain, port,
|
||||||
boxpath, http_prefix, False,
|
boxpath, http_prefix, False,
|
||||||
None, accept)
|
None, accept)
|
||||||
assert signature_header
|
|
||||||
|
|
||||||
headers['signature'] = signature_header['signature']
|
headers['signature'] = signature_header['signature']
|
||||||
getreq_method = not with_digest
|
getreq_method = not with_digest
|
||||||
|
@ -521,8 +520,6 @@ def _test_http_sig_new(algorithm: str, digest_algorithm: str):
|
||||||
domain, port,
|
domain, port,
|
||||||
path_str, http_prefix, message_body_json_str,
|
path_str, http_prefix, message_body_json_str,
|
||||||
algorithm, digest_algorithm, debug)
|
algorithm, digest_algorithm, debug)
|
||||||
assert signature_index_header
|
|
||||||
assert signature_header
|
|
||||||
print('signature_index_header1: ' + str(signature_index_header))
|
print('signature_index_header1: ' + str(signature_index_header))
|
||||||
print('signature_header1: ' + str(signature_header))
|
print('signature_header1: ' + str(signature_header))
|
||||||
sig_input = "keyId=\"https://example.com/users/foo#main-key\"; " + \
|
sig_input = "keyId=\"https://example.com/users/foo#main-key\"; " + \
|
||||||
|
@ -626,7 +623,6 @@ def _test_httpsig_base(with_digest: bool, base_dir: str):
|
||||||
boxpath, http_prefix, message_body_json_str,
|
boxpath, http_prefix, message_body_json_str,
|
||||||
content_type, algorithm, digest_algorithm)
|
content_type, algorithm, digest_algorithm)
|
||||||
|
|
||||||
assert signature_header
|
|
||||||
headers['signature'] = signature_header
|
headers['signature'] = signature_header
|
||||||
getreq_method = not with_digest
|
getreq_method = not with_digest
|
||||||
debug = True
|
debug = True
|
||||||
|
@ -6933,8 +6929,6 @@ def _test_httpsig_base_new(with_digest: bool, base_dir: str,
|
||||||
boxpath, http_prefix, message_body_json_str,
|
boxpath, http_prefix, message_body_json_str,
|
||||||
algorithm, digest_algorithm, debug)
|
algorithm, digest_algorithm, debug)
|
||||||
|
|
||||||
assert signature_index_header
|
|
||||||
assert signature_header
|
|
||||||
headers['signature'] = signature_header
|
headers['signature'] = signature_header
|
||||||
headers['signature-input'] = signature_index_header
|
headers['signature-input'] = signature_index_header
|
||||||
print('headers: ' + str(headers))
|
print('headers: ' + str(headers))
|
||||||
|
|
Loading…
Reference in New Issue