Crates.io | atproto-client |
lib.rs | atproto-client |
version | 0.11.2 |
created_at | 2025-06-03 13:31:23.129599+00 |
updated_at | 2025-08-20 18:55:06.132057+00 |
description | HTTP client for AT Protocol services with OAuth and identity integration |
homepage | https://tangled.sh/@smokesignal.events/atproto-identity-rs |
repository | https://tangled.sh/@smokesignal.events/atproto-identity-rs |
max_upload_size | |
id | 1699033 |
size | 170,079 |
AT Protocol HTTP client with authentication support.
HTTP client for AT Protocol services supporting DPoP, bearer tokens, and sessions with native XRPC protocol operations and repository management.
The following command-line tools are available when built with the clap
feature:
atproto-client-auth
: Create and refresh authentication sessions using identifier and passwordatproto-client-app-password
: Make authenticated XRPC calls using app password Bearer tokensatproto-client-dpop
: Make authenticated XRPC calls using DPoP (Demonstration of Proof-of-Possession) tokensuse atproto_client::client;
use reqwest::Client;
let http_client = Client::new();
let response = client::get_json(&http_client, "https://api.example.com/data").await?;
use atproto_client::client::{DPoPAuth, get_dpop_json};
use atproto_identity::key::identify_key;
let dpop_auth = DPoPAuth {
dpop_private_key_data: identify_key("did:key:zQ3sh...")?,
oauth_access_token: "your_access_token".to_string(),
};
let response = get_dpop_json(&http_client, &dpop_auth, "https://pds.example.com/xrpc/...").await?;
use atproto_client::com::atproto::repo::{create_record, CreateRecordRequest};
let create_request = CreateRecordRequest {
repo: "did:plc:user123".to_string(),
collection: "app.bsky.feed.post".to_string(),
record: json!({"$type": "app.bsky.feed.post", "text": "Hello!"}),
// ...
};
let response = create_record(&http_client, &dpop_auth, pds_url, create_request).await?;
# Create an authentication session with username and password
cargo run --features clap --bin atproto-client-auth -- login alice.example.com my_password
# Use an existing app password for session creation
cargo run --features clap --bin atproto-client-auth -- session alice.example.com app_password_token
# Make an XRPC call using app password Bearer token
cargo run --features clap --bin atproto-client-app-password -- \
did:plc:user123 \
your_access_token \
com.atproto.repo.listRecords
# Make an authenticated XRPC call using DPoP tokens
cargo run --features clap --bin atproto-client-dpop -- \
did:plc:user123 \
did:key:zQ3sh... \
your_access_token \
com.atproto.repo.getRecord
MIT License