Exosphere.ATProto.Repo (Exosphere v0.2.0)

Copy Markdown View Source

Exosphere.ATProto repository operations for writing records to a user's PDS.

This module handles authenticated writes to the user's Exosphere.ATProto repository using OAuth tokens and DPoP proofs.

Summary

Functions

Create a new record in the user's repository.

Delete a record from the user's repository.

Get a record from any repository (public, no auth needed).

Put (create or update) a record in the user's repository.

Functions

create_record(session, pds_url, did, collection, record)

Create a new record in the user's repository.

Uses com.atproto.repo.createRecord for records with auto-generated keys.

Parameters

  • session - OAuth session with access_token and dpop_private_key
  • pds_url - URL of the user's PDS
  • did - The user's DID
  • collection - The collection NSID
  • record - The record data to write

Returns

  • {:ok, %{uri: uri, cid: cid}} on success
  • {:error, reason} on failure

delete_record(session, pds_url, did, collection, rkey)

Delete a record from the user's repository.

Parameters

  • session - OAuth session
  • pds_url - URL of the user's PDS
  • did - The user's DID
  • collection - The collection NSID
  • rkey - The record key to delete

get_record(pds_url, did, collection, rkey)

Get a record from any repository (public, no auth needed).

put_record(session, pds_url, did, collection, rkey, record)

Put (create or update) a record in the user's repository.

Uses com.atproto.repo.putRecord for records with known keys (like profile with "self").

Parameters

  • session - OAuth session with access_token and dpop_private_key
  • pds_url - URL of the user's PDS
  • did - The user's DID
  • collection - The collection NSID (e.g., "app.bsky.actor.profile")
  • rkey - The record key (e.g., "self")
  • record - The record data to write

Returns

  • {:ok, %{uri: uri, cid: cid}} on success
  • {:error, reason} on failure