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

Copy Markdown

Handles DID resolution for AT Protocol identities.

Supports two DID methods:

  • did:plc - Resolves through the PLC directory
  • did:web - Resolves through .well-known DID documents

Summary

Functions

Resolves a DID to its full DID document.

Resolves a DID through the PLC directory.

Resolves a DID through the web DID document method.

Types

did()

@type did() :: String.t()

did_document()

@type did_document() :: %{
  id: did(),
  handle: String.t() | nil,
  service_endpoint: String.t(),
  verification_method: [map()],
  also_known_as: [String.t()]
}

error_reason()

@type error_reason() ::
  :not_found
  | :network_error
  | :invalid_format
  | :unsupported_did_method
  | :rate_limited
  | {:http_error, pos_integer()}

resolution_opts()

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

Functions

resolve(did, opts \\ [])

@spec resolve(did(), resolution_opts()) ::
  {:ok, did_document()} | {:error, error_reason()}

Resolves a DID to its full DID document.

Supports did:plc and did:web methods.

resolve_plc(did, opts \\ [])

@spec resolve_plc(did(), resolution_opts()) ::
  {:ok, did_document()} | {:error, error_reason()}

Resolves a DID through the PLC directory.

resolve_web(did, opts \\ [])

@spec resolve_web(did(), resolution_opts()) ::
  {:ok, did_document()} | {:error, error_reason()}

Resolves a DID through the web DID document method.