aboutsummaryrefslogtreecommitdiff
path: root/client.py
diff options
context:
space:
mode:
authorAnthony Wang2023-01-18 20:07:12 +0000
committerAnthony Wang2023-01-18 20:07:12 +0000
commita56c2664dc3facfed7f8ec2bbe3ab36f1f5803f0 (patch)
treecca72c40d610efaf61eeb264aefbaded621c9a08 /client.py
parent315b1c635c584dbd4b7b55c0c2d8e622dbb37862 (diff)
Even more code cleanup
Diffstat (limited to 'client.py')
-rw-r--r--client.py4
1 files 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={