WebFinger (RFC 7033) primitives for ActivityPub account discovery.
WebFinger is the discovery mechanism used across the Fediverse to map
acct:user@host identifiers to ActivityPub actor URLs via a
/.well-known/webfinger endpoint returning a JSON Resource
Descriptor (JRD).
Example (client)
# #[cfg(feature = "client")]
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
use actpub_webfinger::{Account, resolve};
let client = reqwest::Client::new();
let account = Account::parse("acct:gargron@mastodon.social")?;
let jrd = resolve(&account, &client).await?;
if let Some(link) = jrd.activitypub_actor() {
println!("Actor URL: {}", link.href.as_ref().unwrap());
}
# Ok(()) }
Example (server)
use ;
let jrd = builder
.alias
.link
.build;
let json = to_string.unwrap;
assert!;