# latch v0.4.0 - Table of Contents

> atproto OAuth client library for Elixir

## Pages

- [Latch](readme.md)

## Modules

- [Latch](Latch.md): 
- [Latch.AtURI](Latch.AtURI.md): at-uris are used to reference individual records within a repository, identified
by `did` or handle. This module implements the restricted grammar used in Lexicons.
- [Latch.Client](Latch.Client.md): Authenticated XRPC for a logged in did, with transparent token refresh.
- [Latch.ClientAssertion](Latch.ClientAssertion.md): Client assertion JWTs (RFC 7523 `private_key_jwt`) for atproto OAuth.
- [Latch.ClientMetadata](Latch.ClientMetadata.md): Client metadata document for atproto OAuth.
- [Latch.Config](Latch.Config.md): The configuration that drives the client.
- [Latch.DID](Latch.DID.md): DID syntax validation per the atproto DID spec.
- [Latch.DIDDocument](Latch.DIDDocument.md): Parses atproto DID documents to extract the claimed handle and PDS endpoint.
- [Latch.DNS](Latch.DNS.md): DNS transport boundary for atproto handle resolution.
- [Latch.DPoP](Latch.DPoP.md): DPoP (RFC 9449) proof JWTs for atproto OAuth, and server-issued nonce flow
shared by `Latch.XRPC` and `Latch.Flow`.

- [Latch.Discovery](Latch.Discovery.md): Discovers the authorization server for a PDS and validates the binding
between them, per the atproto OAuth profile.
- [Latch.Error](Latch.Error.md): Errors returned by the public `Latch` and `Latch.Client` API.
- [Latch.Flow](Latch.Flow.md): Drives the atproto OAuth flow against an authorization server: pushed
authorization requests, the authorization redirect, token exchange, and
refresh.
- [Latch.HTTP](Latch.HTTP.md): HTTP transport boundary for atproto identify resolution.
- [Latch.Handle](Latch.Handle.md): Handle syntax validation and normalization per the atproto handle spec.

- [Latch.Identity](Latch.Identity.md): Resolves an atproto handle to a verified identity.
- [Latch.NSID](Latch.NSID.md): Namespaced identifiers are used in atproto to reference lexicons, XRPC endpoints, and more.
- [Latch.PKCE](Latch.PKCE.md): PKCE (RFC 7636) helpers for atproto OAuth.

- [Latch.RecordKey](Latch.RecordKey.md): Record keys have a defined set of allowed shapes: TID, NSID, `literal:<value>`, and `any`.
- [Latch.Request](Latch.Request.md): An in-flight atproto OAuth authorization request, keyed by `state`.
- [Latch.ServerMetadata](Latch.ServerMetadata.md): Parses authorization server metadata (`/.well-known/oauth-authorization-server`)
per the atproto OAuth profile.
- [Latch.Session](Latch.Session.md): An established atproto OAuth session: the credentials and binding needed to
make authenticated PDS requests and to refresh the access token.
- [Latch.Store](Latch.Store.md): Storage backend for in-flight OAuth requests and long-lived sessions.
- [Latch.Store.ETS](Latch.Store.ETS.md): Pre-built ETS Store for Latch. Does not maintain access tokens or in-progress requests
across restarts. For a more reliable approach, create your own implementation of
the Latch.Store behavior.
- [Latch.TID](Latch.TID.md): Timestamp identifiers, frequently used as record keys in atproto. Time-sortable,
can be used as logical clocks within a system, and designed to reduce the risk
of collisions.
- [Latch.TokenResponse](Latch.TokenResponse.md): Parses token endpoint responses per the atproto OAuth profile.

- [Latch.XRPC](Latch.XRPC.md): DPoP-authenticated XRPC calls to a session's PDS.

- Exceptions
  - [Latch.Error.Discovery](Latch.Error.Discovery.md): Authorization-server discovery failed for a PDS.
  - [Latch.Error.HandleNotFound](Latch.Error.HandleNotFound.md): 	A handle could not be resolved to a DID during `authorize/2`.
  - [Latch.Error.IdentityMismatch](Latch.Error.IdentityMismatch.md): A handle reoslved to a DID, but the DID document does not read back to it,
or it lacks a usable PDS endpoint.
  - [Latch.Error.InvalidResponse](Latch.Error.InvalidResponse.md): A server response was structurally invalid, including bad JSON or a
missing or malformed required field.
  - [Latch.Error.MissingDPoPNonce](Latch.Error.MissingDPoPNonce.md): The server responded with `use_dpop_nonce` but did not provide a
header to retry with. This is a server side issue.

  - [Latch.Error.NoSession](Latch.Error.NoSession.md): No stored session exists for the given DID.

  - [Latch.Error.OAuth](Latch.Error.OAuth.md): The authorization server returned an OAuth error response.
  - [Latch.Error.RefreshFailed](Latch.Error.RefreshFailed.md): 	A token refresh was attempted and failed.
  - [Latch.Error.SecurityViolation](Latch.Error.SecurityViolation.md): An integrity check required by the atproto OAuth spec failed. A caller must
not treat the user as logged in when one of these is returned.
  - [Latch.Error.Store](Latch.Error.Store.md): The caller's `Latch.Store` implementation returned an error. The
specific callback is in the `action` field.
  - [Latch.Error.Transport](Latch.Error.Transport.md): An HTTP request failed at the transport layer.

  - [Latch.Error.XRPC](Latch.Error.XRPC.md): The PDS returned a non-2xx XRPC response.

