ProtoRune (proto_rune v0.2.0)
Copy MarkdownMain API for ProtoRune - Elixir SDK for AT Protocol.
ProtoRune provides a functional, type-safe interface for interacting with AT Protocol services, including Bluesky.
Quick Start
# Login to create a session
{:ok, session} = ProtoRune.login("alice.bsky.social", "app-password")
# Post to Bluesky
{:ok, post} = ProtoRune.post(session, "Hello from Elixir!")
# Identity resolution
{:ok, did} = ProtoRune.resolve_handle("bob.bsky.social")Architecture
- Core API (this module): Simple, high-level functions
- ATProto Layer: Protocol operations (Identity, Repo, Server)
- Bsky Layer: Bluesky-specific API
- Bot Framework: Event-driven bot development
Summary
Functions
Gets current session information.
Guard to check if a value is a valid DID format.
Guard to check if a value is a valid handle format.
Authenticates with AT Protocol and creates a session.
Posts a text message to Bluesky.
Refreshes an expired session using the refresh token.
Resolves a DID to its DID document.
Resolves a handle to a DID (Decentralized Identifier).
Validates DID syntax (does not resolve or verify).
Validates handle syntax (does not resolve or verify).
Validates that a handle correctly maps to its DID.
Types
Functions
Gets current session information.
Examples
{:ok, info} = ProtoRune.get_session(session)
Guard to check if a value is a valid DID format.
Guard to check if a value is a valid handle format.
@spec login(user_identifier(), user_password(), keyword()) :: {:ok, session()} | error()
Authenticates with AT Protocol and creates a session.
Parameters
identifier- Handle (e.g., "alice.bsky.social") or emailpassword- App password (NOT your main account password)opts- Optional keyword list::service- Service URL (default: "https://bsky.social")
Returns
{:ok, session}- Session with access tokens and DID{:error, reason}- Authentication failed
Examples
{:ok, session} = ProtoRune.login("alice.bsky.social", "abcd-1234-efgh-5678")
{:ok, session} = ProtoRune.login(
"alice.bsky.social",
"abcd-1234-efgh-5678",
service: "https://custom-pds.example.com"
)
Posts a text message to Bluesky.
Examples
{:ok, post} = ProtoRune.post(session, "Hello Bluesky!")
{:ok, post} = ProtoRune.post(session, "Hello!", langs: ["en"])
Refreshes an expired session using the refresh token.
Examples
{:ok, fresh_session} = ProtoRune.refresh_session(session)
Resolves a DID to its DID document.
Results are cached for 24 hours.
Examples
{:ok, doc} = ProtoRune.resolve_did("did:plc:abc123xyz")
Resolves a handle to a DID (Decentralized Identifier).
Results are cached for 1 hour.
Examples
{:ok, did} = ProtoRune.resolve_handle("alice.bsky.social")
# => {:ok, "did:plc:abc123xyz"}
Validates DID syntax (does not resolve or verify).
Validates handle syntax (does not resolve or verify).
Validates that a handle correctly maps to its DID.
Examples
{:ok, doc} = ProtoRune.validate_identity("alice.bsky.social")