defmodule ActivityPub do def get(url, actor_url, private_key) do headers = ActivityPub.Headers.signing_headers("GET", url, "", actor_url, private_key) Req.new(url: url) |> Req.Request.put_header("accept", "application/activity+json") |> Req.Request.put_headers(headers) |> Req.get() |> case do {:ok, response} -> {:ok, response.body} other -> other end end def fetch_actor(actor_id) do request = Req.new(url: actor_id) |> Req.Request.put_header("accept", "application/json") case Req.get(request) do {:ok, result} -> {:ok, result.body} error -> error end end end