From cf96832a0b50baa6f4b55f5f6d3db0a6bd41a2ed Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 Jun 2019 12:25:03 +0100 Subject: [PATCH] Post header --- posts.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/posts.py b/posts.py index e85ff04b..4b7e8f55 100644 --- a/posts.py +++ b/posts.py @@ -12,13 +12,11 @@ import commentjson import html import datetime import os, shutil -import base64 from pprint import pprint from random import randint from session import getJson from session import postJson from person import getPersonKey -from Crypto.Hash import SHA256 try: from BeautifulSoup import BeautifulSoup except ImportError: @@ -328,13 +326,11 @@ def sendPost(session,username: str, domain: str, toUsername: str, toDomain: str, return 5 # construct the http header - bodyDigest = base64.b64encode(SHA256.new(postJsonObject.encode()).digest()) - headers = {'Content-type': 'application/json', 'host': domain, 'digest': f'SHA-256={bodyDigest}'} signatureHeader = signPostHeaders(privateKeyPem, username, domain, '/inbox', https, postJsonObject) - headers['signature'] = signatureHeader + signatureHeader['Content-type'] = 'application/json' # TODO this should be replaced by a send buffer - postJson(session,postJsonObject,federationList,inboxUrl,headers) + postJson(session,postJsonObject,federationList,inboxUrl,signatureHeader) return 0