solid_pod_rs_activitypub/lib.rs
1//! # solid-pod-rs-activitypub
2//!
3//! ActivityPub federation (Actor, inbox, outbox, HTTP Signatures,
4//! NodeInfo) for [`solid-pod-rs`](https://crates.io/crates/solid-pod-rs).
5//!
6//! ## Modules
7//!
8//! - [`actor`] — Actor document rendering and RSA keypair generation.
9//! - [`inbox`] — Inbox handler with HTTP-Signature verification dispatch.
10//! - [`outbox`] — Outbox handler with Create/Follow/Delete activity persistence.
11//! - [`delivery`] — Background federated-delivery worker with exponential-backoff retry.
12//! - [`http_sig`] — Draft-cavage-12 `rsa-sha256` HTTP Signature sign/verify.
13//! - [`discovery`] — NodeInfo 2.1 and WebFinger discovery endpoints.
14//! - [`store`] — SQLite-backed persistence for followers, inbox, outbox, delivery queue.
15//! - [`error`] — [`SigError`], [`InboxError`], [`OutboxError`].
16//!
17//! ## Quick start
18//!
19//! ```rust,ignore
20//! use solid_pod_rs_activitypub::store::Store;
21//!
22//! // Connect to (or create) the SQLite-backed AP store.
23//! let store = Store::connect("sqlite:ap.db").await?;
24//!
25//! // Check if a remote actor follows the local pod.
26//! let is_following = store.is_follower("local-pod", "https://remote.example/actor").await?;
27//! ```
28//!
29//! ## Relationship to core
30//!
31//! AP federation pulls in RSA (2048-bit keypairs, `rsa-sha256`
32//! signatures) and a persistent follower store, neither of which the
33//! core `solid-pod-rs` crate needs for pods that don't federate.
34//! Keeping federation in a sibling crate keeps the core lean.
35//!
36//! HTTP Signatures use draft-cavage v12 (what the fediverse actually
37//! speaks), not RFC 9421. Core's Ed25519-based
38//! `solid_pod_rs::notifications::signing` is a different protocol.
39
40#![doc = include_str!("../README.md")]
41
42pub mod actor;
43pub mod delivery;
44pub mod discovery;
45pub mod error;
46pub mod http_sig;
47pub mod inbox;
48pub mod outbox;
49pub mod store;
50
51// ---- Flat re-export surface -------------------------------------------------
52pub use actor::{
53 generate_actor_keypair, negotiate_actor_format, render_actor, with_also_known_as, Actor,
54 ActorFormat, Endpoints, PublicKey,
55};
56pub use delivery::{DeliveryConfig, DeliveryOutcome, DeliveryWorker};
57pub use discovery::{
58 nodeinfo_2_1, nodeinfo_wellknown, webfinger_response, WebFingerJrd, WebFingerLink,
59};
60pub use error::{InboxError, OutboxError, SigError};
61pub use http_sig::{
62 digest_header, sign_request, verify_request_signature, ActorKeyResolver,
63 HttpActorKeyResolver, OutboundRequest, SignedRequest, VerifiedActor,
64};
65pub use inbox::{build_accept, handle_inbox, InboxOutcome};
66pub use outbox::{handle_outbox, handle_outbox_post, OutboundDelivery};
67pub use store::{DeliveryItem, InboxRow, OutboxRow, Store};