diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-07-31 21:41:18 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-07-31 23:24:30 +0000 |
commit | 2890aef9e8924a6ddc170034679b7313372b3567 (patch) | |
tree | 7916de68011caf268b668f75b75d76366671eca8 /lib | |
parent | ba72c51a0f6f8a64a24a96c89d4cb8cfcfb7a245 (diff) | |
download | pleroma-2890aef9e8924a6ddc170034679b7313372b3567.tar.gz |
activitypub: add digest header to outbound messages and sign it
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 464832a1e..90a39ce69 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -641,8 +641,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do Logger.info("Federating #{id} to #{inbox}") host = URI.parse(inbox).host + digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64()) + signature = - Pleroma.Web.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)}) + Pleroma.Web.HTTPSignatures.sign(actor, %{ + host: host, + "content-length": byte_size(json), + digest: digest + }) @httpoison.post( inbox, |