1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! # 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
//!
//! The default feature set enables `syntax`, `cbor`, `crypto`, `mst`, `repo`, and `car`.
//! Enable `full` for everything, or disable defaults and pick only what you need:
//!
//! | Feature | Description |
//! |---------|-------------|
//! | `syntax` | Core identifier types ([`Did`], [`Handle`], [`Nsid`], [`AtUri`], [`Tid`], [`RecordKey`]) |
//! | `cbor` | DAG-CBOR encoding, decoding, and content-addressed hashing ([`cbor::Cid`]) |
//! | `crypto` | P-256 and secp256k1 signing and verification |
//! | `mst` | Merkle Search Tree for record storage |
//! | `repo` | In-memory AT Protocol repository with signed commits |
//! | `car` | Content Addressable aRchive (CAR v1) reading and writing |
//! | `lexicon` | Lexicon schema loading and record validation |
//! | `xrpc` | XRPC HTTP/2 client with retry, rate limiting, and auth |
//! | `xrpc-server` | Axum-based XRPC server framework |
//! | `identity` | DID resolution and handle verification |
//! | `streaming` | Firehose and Jetstream WebSocket consumers with reconnection |
//! | `sync` | Repository sync and commit verification |
//! | `backfill` | Concurrent bulk repo downloading |
//! | `labeling` | Label creation, signing, and verification |
//! | `oauth` | OAuth2 authorization client (DPoP, PKCE, session management) |
//! | `api` | Generated types for all Bluesky and AT Protocol lexicons |
//! | `full` | Everything above |
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use shrike::xrpc::Client;
//! use shrike::api::app::bsky;
//!
//! # async fn example() -> Result<(), shrike::xrpc::Error> {
//! // 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, ¶ms).await?;
//! # Ok(())
//! # }
//! ```
/// Default User-Agent sent by Shrike outbound HTTP and WebSocket clients.
pub const USER_AGENT: &str = concat!;
// Re-export common types at root for convenience
pub use crateCid;
pub use crate;