An Elixir toolkit for the AT Protocol.
hexdocs.pm/atex
elixir
bluesky
atproto
decentralization
Changelog#
All notable changes to atex will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased#
Breaking Changes#
Atex.OAuthrefactor:Atex.OAuth.get_key/0removed - useAtex.Config.OAuth.get_key/0directlyAtex.OAuth.create_client_metadata/1,create_client_assertion/3,create_authorization_url/5,validate_authorization_code/5,refresh_token/5,revoke_tokens/2moved toAtex.OAuth.FlowAtex.OAuth.create_dpop_token/4,send_oauth_dpop_request/3,request_protected_dpop_resource/5moved toAtex.OAuth.DPoPAtex.OAuth.get_authorization_server/2,get_authorization_server_metadata/2moved toAtex.OAuth.Discovery- Error atom
:invaild_issuercorrected to:invalid_issuerinAtex.OAuth.Discovery
Atex.Config.OAuth.is_localhost/0renamed toAtex.Config.OAuth.localhost?/0Atex.ServiceAuth.validate_jwt/2now returns{:error, :invalid_jwt}on malformed input instead of raising
Added#
Atex.OAuth.session_keys_name/0andAtex.OAuth.session_active_session_name/0expose Plug session key atomsAtex.IdentityResolvernow has full module and function documentationAtex.XRPC.LoginClientnow has a@moduledoc- Optional
:telemetryinstrumentation viaAtex.Telemetry. Add{:telemetry, "~> 1.0"}to your deps to receive events from XRPC requests, identity resolution, OAuth flows, and service auth validation. SeeAtex.Telemetryfor the full event catalogue. - New
:user_agentconfig key underconfig :atex. When set, all outgoing XRPC requests include aUser-Agentheader of"<user_agent> (atex/<version>)". Defaults to"atex/<version>". SeeAtex.Config.user_agent/0.
Fixed#
- Fix
raw_inputnot actually being set as the request's body inAtex.XRPC.post/3when providing a struct as input. Atex.XRPC.LoginClient.handle_failure/3now returns consistent 3-tuples{:error, response, client}Atex.OAuth.Cachemetadata cachettl_check_intervalcorrected to 5 minutes (was 30 seconds)- Typo in
Atex.OAuth.Errormoduledoc corrected ("extesion" -> "exception")
0.9.1 - 2026-04-17#
Fixed#
- Fix a problem with error struct generation with some lexicons in
deflexicon.
0.9.0 - 2026-04-16#
Breaking Changes#
Atex.NSIDis now a struct (%Atex.NSID{authority, name, fragment}). Public functions now accept and return structs. You can usenew/1,new!/1or the new~NSID""for constructing from a NSID string.
Added#
Atex.Repomodule for building, mutating, signing, serialising, and loading AT Protocol repositories. Also supports lazily streaming from a CAR binary for efficient processing of large repository exports.Atex.XRPC.UnauthedClientmodule for running unauthenticated XRPC fetches on public APIs or PDSes.Atex.Lexicon.Resolvermodule for resolving published lexicons by NSID, following the publication and resolution spec.mix atex.lexicons.resolvetask for resolving one or more lexicons by NSID and writing to a JSON file.- Sigils for
Atex.AtURIandAtex.TID,~AT"at://..."and~TID"..."respectively. /logoutroute forAtex.OAuth.Plugto revoke the current session, as well asAtex.OAuth.Plug.revoke_session/2to revoke a conn's session programmaticly (e.g. from a session management dashboard).deflexiconnow generates structs for errors defined by queries and procedures, under aErrorssubmodule.deflexicongenerated models now have acoerce_error/1function that takes in a map and tries to convert it to one of its known error structs.Atex.XRPC.Errorstruct for wrapping XRPC error responses, including both known errors (with typederror_struct) and unknown errors.
Fixed#
- Fix issue when trying to validate OAuth authorisation codes in localhost mode on PDS implementations that are more strict than the Bluesky reference implementation.
0.8.0 - 2026-03-29#
Breaking Changes#
-
The
Atex.IdentityResolverconfig key has been replaced with a flat config option. Update your config from:config :atex, Atex.IdentityResolver, directory_url: "https://plc.directory"to:
config :atex, plc_directory_url: "https://plc.directory" -
Atex.Config.IdentityResolverhas been renamed toAtex.Config. -
Atex.IdentityResolver.DIDDocumenthas been renamed toAtex.DID.Document. -
Replace existing
Atex.DID.Document.new/1method with the method previously namedfrom_json/1.
Added#
Atex.Cryptomodule for performing AT Protocol-related cryptographic operations.Atex.PLCmodule for interacting with a did:plc directory API.Atex.ServiceAuthmodule for validating inter-service authentication tokens.- Various improvements to
Atex.Did.Document- Add
Atex.DID.Document.ServiceandAtex.DID.Document.VerificationMethodsub-structs. - Add
to_json/1methods andJSON.Encoderprotocols for easy conversion to camelCase JSON.
- Add
Atex.XRPC.Routermodule withquery/3andprocedure/3macros for easily building XRPC server routes inside aPlug.Router, with built-in service auth validation and validation if passed the name of a module usingdeflexicon.deflexiconnow emitscontent_type/0functions (onInputsubmodules for typed JSON bodies, otherwise on the root module) for procedures.Atex.XRPC.ServiceAuthClientmodule for making requests to other atproto services using a service auth token.
Fixed#
- Fix a problem where generated
%<LexiconId>.Paramsstructs could not be passed to an XRPC call due to not having the Enumerable protocol implemented. - Correctly generate
Input/Outputsubmodules withfrom_jsonmethods for queries and procedures that usereforuniontypes.
0.7.1 - 2026-02-06#
Breaking Changes#
- Included
Com.Atproto.*lexicon modules have been removed and put intoatex_atprotoinstead.
Added#
- The PLC directory used for identity resolution can now be configured. See
Atex.Config.IdentityResolvefor more information. (Thanks @hexmani.ac!) - Add an extra optional
optsparameter to someAtex.OAuthfunctions, to allow for better integration with other ecosystems. (Thanks @lekkice.moe!)
0.7.0 - 2026-01-07#
Breaking Changes#
Atex.OAuth.Plugnow raisesAtex.OAuth.Errorexceptions instead of handling error situations internally. Applications should implementPlug.ErrorHandlerto catch and gracefully handle them.Atex.OAuth.Plugnow saves only the user's DID in the session instead of the entire OAuth session object. Applications must useAtex.OAuth.SessionStoreto manage OAuth sessions.Atex.XRPC.OAuthClienthas been overhauled to useAtex.OAuth.SessionStorefor retrieving and managing OAuth sessions, making it easier to use with not needing to manually keep a Plug session in sync.
Added#
Atex.OAuth.SessionStorebehaviour andAtex.OAuth.Sessionstruct for managing OAuth sessions with pluggable storage backends.Atex.OAuth.SessionStore.ETS- in-memory session store implementation.Atex.OAuth.SessionStore.DETS- persistent disk-based session store implementation.
Atex.OAuth.Plugnow requires a:callbackoption that is a MFA tuple (Module, Function, Args), denoting a callback function to be invoked by after a successful OAuth login. See the OAuth example for a simple usage of this.Atex.OAuth.Permissionmodule for creating AT Protocol permission strings for OAuth.Atex.OAuth.Errorexception module for OAuth flow errors. Contains both a human-readablemessagestring and a machine-readablereasonatom for error handling.Atex.OAuth.Cachemodule provides TTL caching for OAuth authorization server metadata with a 1-hour default TTL to reduce load on third-party PDSs.Atex.OAuth.get_authorization_server/2andAtex.OAuth.get_authorization_server_metadata/2now support an optionalfreshparameter to bypass the cache when needed.
Changed#
mix atex.lexiconsnow adds@moduledoc falseto generated modules to stop them from automatically cluttering documentation.Atex.IdentityResolver.Cache.ETSnow uses ConCache instead of ETS directly, with a 1-hour TTL for cached identity information.
0.6.0 - 2025-11-25#
Breaking Changes#
deflexiconnow converts all def names to be in snake_case instead of the casing as written the lexicon.
Added#
deflexiconnow emits structs for records, objects, queries, and procedures.Atex.XRPC.get/3andAtex.XRPC.post/3now support having a lexicon struct as the second argument instead of the method's name, making it easier to have properly checked XRPC calls.- Add pre-transpiled modules for the core
com.atprotolexicons.
0.5.0 - 2025-10-11#
Breaking Changes#
- Remove
Atex.HTTPand associated modules as the abstraction caused a bit too much complexities for how early atex is. It may come back in the future as something more fleshed out once we're more stable. - Rename
Atex.XRPC.ClienttoAtex.XRPC.LoginClient
Added#
Atex.OAuthmodule with utilites for handling some OAuth functionality.Atex.OAuth.Plugmodule (if Plug is loaded) which provides a basic but complete OAuth flow, including storing the tokens inPlug.Session.Atex.XRPC.Clientbehaviour for implementing custom client variants.Atex.XRPCnow supports using different client implementations.Atex.XRPC.OAuthClientto make XRPC calls on the behalf of a user who has authenticated with ATProto OAuth.
0.4.0 - 2025-08-27#
Added#
Atex.Lexiconmodule that provides thedeflexiconmacro, taking in a JSON Lexicon definition and converts it into a series of schemas for each definition within it.mix atex.lexiconsfor converting lexicon JSON files into modules usingdeflexiconeasily.
0.3.0 - 2025-06-29#
Changed#
Atex.XRPC.Adapterrenamed toAtex.HTTP.Adapter.
Added#
Atex.HTTPmodule that delegates to the currently configured adapter.Atex.HTTP.Responsestruct to be returned byAtex.HTTP.Adapter.Atex.IdentityResolvermodule for resolving and validating an identity, either by DID or a handle.- Also has a pluggable cache (with a default ETS implementation) for keeping some data locally.
0.2.0 - 2025-06-09#
Added#
Atex.TIDmodule for manipulating ATProto TIDs.Atex.Base32Sortablemodule for encoding/decoding numbers asbase32-sortablestrings.- Basic XRPC client.
0.1.0 - 2025-06-07#
Initial release.