22 lines
446 B
Elixir
22 lines
446 B
Elixir
defmodule ActivityPub.Webfinger do
|
|
def lookup_resource(acct_handle) do
|
|
[_handle, domain] = String.split(acct_handle, "@")
|
|
|
|
uri = %URI{
|
|
scheme: "https",
|
|
authority: domain,
|
|
host: domain,
|
|
port: 443,
|
|
path: "/.well-known/webfinger",
|
|
query: "resource=acct:#{acct_handle}"
|
|
}
|
|
|
|
case Req.get(uri) do
|
|
{:ok, response} ->
|
|
{:ok, response.body}
|
|
|
|
other ->
|
|
other
|
|
end
|
|
end
|
|
end
|