Latch.DIDDocument (latch v0.2.0)

Copy Markdown

Parses atproto DID documents to extract the claimed handle and PDS endpoint.

Verifies the document's internal correctness only. The caller must confirm the handle resolves back to this DID (bidirectional verification) before trusting it.

Summary

Functions

Parses a decoded DID document for a given DID.

Types

t()

@type t() :: %Latch.DIDDocument{
  did: String.t(),
  handle: String.t(),
  pds_endpoint: String.t()
}

Functions

parse(document, did)

@spec parse(map(), String.t()) ::
  {:ok, t()}
  | {:error, :did_mismatch | :invalid_handle | :no_pds | :invalid_pds_endpoint}

Parses a decoded DID document for a given DID.

The did argument is the DID that was resolved to obtain this document. It must match the document's id.