From a56c2664dc3facfed7f8ec2bbe3ab36f1f5803f0 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Wed, 18 Jan 2023 20:07:12 +0000 Subject: [PATCH] Even more code cleanup --- client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.py b/client.py index 50f6b2f..7a74607 100644 --- a/client.py +++ b/client.py @@ -12,12 +12,12 @@ date = formatdate(usegmt=True) digester = hashes.Hash(hashes.SHA256()) digester.update(activity) digest = b64encode(digester.finalize()).decode() -message = f'date: {date}\ndigest: SHA-256={digest}' +message = f'date: {date}\ndigest: SHA-256={digest}'.encode('utf8') with open('private.pem', 'rb') as f: privkey = serialization.load_pem_private_key(f.read(), None) -signature = b64encode(privkey.sign(message.encode('utf8'), padding.PKCS1v15(), hashes.SHA256())).decode() +signature = b64encode(privkey.sign(message, padding.PKCS1v15(), hashes.SHA256())).decode() header = f'keyId="https://0.exozy.me/users/test.jsonld#main-key",headers="date digest",signature="{signature}"' resp = post('https://0.exozy.me/users/test.outbox', headers={