activity content type

master
Bob Mottram 2019-08-16 10:12:47 +01:00
parent d538e901a2
commit 81d990c066
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ def signPostHeaders(privateKeyPem: str, nickname: str, domain: str, \
else: else:
bodyDigest = \ bodyDigest = \
base64.b64encode(SHA256.new(messageBodyJson.encode()).digest()).decode('utf-8') base64.b64encode(SHA256.new(messageBodyJson.encode()).digest()).decode('utf-8')
headers = {'(request-target)': f'post {path}','host': domain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': 'application/json'} headers = {'(request-target)': f'post {path}','host': domain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': 'application/activity+json'}
privateKeyPem = RSA.import_key(privateKeyPem) privateKeyPem = RSA.import_key(privateKeyPem)
#headers.update({ #headers.update({
# '(request-target)': f'post {path}', # '(request-target)': f'post {path}',
@ -80,7 +80,7 @@ def createSignedHeader(privateKeyPem: str,nickname: str,domain: str,port: int, \
messageBodyJsonStr=json.dumps(messageBodyJson) messageBodyJsonStr=json.dumps(messageBodyJson)
bodyDigest = \ bodyDigest = \
base64.b64encode(SHA256.new(messageBodyJsonStr.encode()).digest()) base64.b64encode(SHA256.new(messageBodyJsonStr.encode()).digest())
headers = {'(request-target)': f'post {path}','host': headerDomain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': 'application/json'} headers = {'(request-target)': f'post {path}','host': headerDomain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': 'application/activity+json'}
signatureHeader = signPostHeaders(privateKeyPem, nickname, domain, port, \ signatureHeader = signPostHeaders(privateKeyPem, nickname, domain, port, \
path, httpPrefix, None) path, httpPrefix, None)
headers['signature'] = signatureHeader headers['signature'] = signatureHeader