ProtoRune.Atproto.Identity (proto_rune v0.5.2)

Copy Markdown

Implements AT Protocol identity management operations.

Provides functionality for:

  • Resolving handles to DIDs
  • Resolving DIDs to DID documents
  • Validating identity chains
  • Verifying signatures

Summary

Functions

Resolves a handle to a DID via the com.atproto.identity.resolveHandle XRPC endpoint.

Performs complete syntactic validation of a DID according to AT Protocol specifications.

Performs complete syntactic validation of a handle.

Functions

is_did(term)

(macro)

is_handle(term)

(macro)

resolve_handle(pds_url, handle)

@spec resolve_handle(String.t() | nil, String.t()) ::
  {:ok, String.t()} | {:error, term()}

Resolves a handle to a DID via the com.atproto.identity.resolveHandle XRPC endpoint.

This is the plain wire endpoint: the resolution is performed server-side by the given PDS and no session is required. The DNS/HTTPS resolver of resolve_handle/1 stays the default; prefer it unless you specifically want the PDS's view of the handle.

Pass nil as pds_url to use the default base URL, or the PDS base URL (bare or /xrpc-suffixed, normalized internally).

https://docs.bsky.app/docs/api/com-atproto-identity-resolve-handle

valid_did?(term)

Performs complete syntactic validation of a DID according to AT Protocol specifications.

A valid DID must:

  • Start with "did:"
  • Have a supported method (plc or web)
  • Contain a valid method-specific identifier
  • Use only allowed characters (a-z, A-Z, 0-9, ., _, :, %, -)

valid_handle?(term)

Performs complete syntactic validation of a handle.

Validates according to AT Protocol handle specification:

  • Must be at least two segments separated by dots
  • Each segment must be 1-63 chars
  • Segments must start/end with alphanumeric
  • Segments can contain hyphens (not at start/end)
  • Last segment cannot start with a number