1
0
Fork 0

Add signatures to requests to mastodon to support authorized fetch mode

When mastodon is in authorized fetch mode any request has to be signed
or it fails with 401. This adds the needed signature to the requests
made to discover the actor when receiving something from mastodon (such
as a follow request)
This commit is contained in:
Renato "Lond" Cerqueira 2020-12-29 20:51:05 +01:00
parent 1bd813c6f7
commit 097d86454a
4 changed files with 50 additions and 6 deletions

View file

@ -85,7 +85,7 @@ class Signature(TestCase):
now = date or http_date()
data = json.dumps(get_follow_activity(sender, self.rat))
digest = digest or make_digest(data)
signature = make_signature(signer or sender, self.rat.inbox, now, digest)
signature = make_signature("post", signer or sender, self.rat.inbox, now, digest)
with patch("bookwyrm.views.inbox.activity_task.delay"):
with patch("bookwyrm.models.user.set_remote_server.delay"):
return self.send(signature, now, send_data or data, digest)