summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-02-21 00:23:17 +0000
committerlain <lain@soykaf.club>2019-02-21 09:20:59 +0100
commit9c10e7c78da2f8e9bda7032badd985a62d0f3c44 (patch)
treeae85bbcb1570ede4a4289f1bf3e54a93fd3a2dc8
parent9da9cacbf2793e22b99ebf4c3e8b0ea1350b8a9a (diff)
activitypub: sign http date header
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex8
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 b33912721..52f5a0c70 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -774,11 +774,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64())
+ date =
+ NaiveDateTime.utc_now()
+ |> Timex.format!("{WDshort}, {D} {Mshort} {YYYY} {h24}:{m}:{s} GMT")
+
signature =
Pleroma.Web.HTTPSignatures.sign(actor, %{
host: host,
"content-length": byte_size(json),
- digest: digest
+ digest: digest,
+ date: date
})
with {:ok, %{status: code}} when code in 200..299 <-
@@ -788,6 +793,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
json,
[
{"Content-Type", "application/activity+json"},
+ {"Date", date},
{"signature", signature},
{"digest", digest}
]