diff --git a/src/at/handle.gleam b/src/at/handle.gleam index 4e03b59..f4e66c8 100644 --- a/src/at/handle.gleam +++ b/src/at/handle.gleam @@ -2,6 +2,7 @@ import at/internal/hostname import gleam/dynamic/decode.{type Decoder} +import gleam/http/request.{type Request} import gleam/json.{type Json} import gleam/string @@ -102,6 +103,10 @@ pub fn is_test(handle: Handle) -> Bool { } } +pub fn dns_hostname(handle: Handle) -> String { + "_atproto." <> handle.hostname +} + // CONVERSIONS ----------------------------------------------------------------- pub fn to_string(handle: Handle) -> String { @@ -111,3 +116,9 @@ pub fn to_string(handle: Handle) -> String { pub fn to_json(handle: Handle) -> Json { json.string(handle.hostname) } + +pub fn resolve(handle: Handle) -> Request(String) { + request.new() + |> request.set_host(handle.hostname) + |> request.set_path("/.well-known/atproto-did") +}