ProtoRune.Atproto.Identity.HandleResolver (proto_rune v0.3.0)

Copy Markdown

Handles AT Protocol handle resolution to DIDs through DNS and HTTPS methods.

Implements the handle resolution specification from AT Protocol:

  • DNS TXT record lookup at _atproto.<handle>
  • HTTPS lookup at https://<handle>/.well-known/atproto-did

Summary

Functions

Attempts to resolve a handle to a DID using DNS TXT records.

Attempts to resolve a handle to a DID using HTTPS lookup.

Types

error_reason()

@type error_reason() :: :not_found | :network_error | :invalid_response | :timeout

resolution_opts()

@type resolution_opts() :: [timeout: pos_integer(), retry_count: non_neg_integer()]

Functions

resolve_dns(handle, opts \\ [])

@spec resolve_dns(String.t(), resolution_opts()) ::
  {:ok, String.t()} | {:error, error_reason()}

Attempts to resolve a handle to a DID using DNS TXT records.

Looks for a TXT record at _atproto.<handle> that starts with "did=".

resolve_https(handle, opts \\ [])

@spec resolve_https(String.t(), resolution_opts()) ::
  {:ok, String.t()} | {:error, error_reason()}

Attempts to resolve a handle to a DID using HTTPS lookup.

Makes a GET request to https://<handle>/.well-known/atproto-did.