Skip to main content

Crate shrike

Crate shrike 

Source
Expand description

§shrike

A comprehensive AT Protocol library for Rust. This library provides everything needed to interact with AT Protocol networks like Bluesky, including identifier types, cryptographic operations, repository management, XRPC client and server implementations, identity resolution, firehose streaming, and more.

All identifier types in shrike validate on construction using the newtype pattern with private inner fields. This means invalid identifiers like malformed DIDs or handles cannot be represented at all, eliminating a large class of runtime errors.

§Where to start

What you need depends on what you are building:

  • Bot or client app: Start with [xrpc::Client] and the [api] module to make authenticated requests to Bluesky or other AT Protocol services.
  • Feed generator: Use [streaming::Client] to consume the firehose and [xrpc::Client] to serve your custom feed.
  • Labeler: Combine [streaming::Client] for processing records, [labeling] for creating and signing labels, and [xrpc_server::Server] to host your labeler service.
  • Full relay or PDS: You will need repo, [sync], [identity], and most other modules to handle repository storage, commit verification, identity resolution, and federation.

§Feature flags

By default, no features are enabled. Pick what you need:

FeatureDescription
syntaxCore identifier types (Did, Handle, Nsid, AtUri, Tid, RecordKey)
cborDAG-CBOR encoding, decoding, and content-addressed hashing (cbor::Cid)
cryptoP-256 and secp256k1 signing and verification
mstMerkle Search Tree for record storage
repoIn-memory AT Protocol repository with signed commits
carContent Addressable aRchive (CAR v1) reading and writing
lexiconLexicon schema loading and record validation
xrpcXRPC HTTP/2 client with retry, rate limiting, and auth
xrpc-serverAxum-based XRPC server framework
identityDID resolution and handle verification
streamingFirehose and Jetstream WebSocket consumers with reconnection
syncRepository sync and commit verification
backfillConcurrent bulk repo downloading
labelingLabel creation, signing, and verification
oauthOAuth2 authorization client (DPoP, PKCE, session management)
apiGenerated types for all Bluesky and AT Protocol lexicons
fullEverything above

§Quick start

use shrike::xrpc::{Client, AuthInfo};
use shrike::api::app::bsky;

// Create a client and make a query
let client = Client::new("https://bsky.social");
let params = bsky::ActorGetProfileParams {
    actor: "alice.bsky.social".into(),
    ..Default::default()
};
let profile = bsky::actor_get_profile(&client, &params).await?;

Re-exports§

pub use crate::cbor::Cid;
pub use crate::syntax::AtIdentifier;
pub use crate::syntax::AtUri;
pub use crate::syntax::Datetime;
pub use crate::syntax::Did;
pub use crate::syntax::Handle;
pub use crate::syntax::Language;
pub use crate::syntax::Nsid;
pub use crate::syntax::RecordKey;
pub use crate::syntax::Tid;
pub use crate::syntax::TidClock;

Modules§

car
CAR v1 archives for AT Protocol repositories.
cbor
DAG-CBOR (DRISL) encoding and decoding for AT Protocol.
crypto
P-256 and secp256k1 signing and verification for AT Protocol.
mst
Merkle Search Tree implementation for AT Protocol repositories.
repo
In-memory AT Protocol repository with signed commits.
syntax
Core AT Protocol identifier types with validation-on-construction.