A crate to help you fetch and serve WebFinger resources
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KitaitiMakoto 51b49e8629 Merge pull request 'Specify async-trait version' (#13) from specify-async-trait-version into main 10 months ago
src Remove unnecessary mut 10 months ago
.gitattributes add git attributes and remove executable bit from files in repo 3 years ago
.gitignore Initial commit 5 years ago
.travis.yml add async tests to travis test script 3 years ago
Cargo.toml Specify async-trait version 10 months ago
LICENSE Add a license file (GPL-3.0) 5 years ago
README.md Add some badges! 4 years ago
coverage.sh Try to add codecov 4 years ago


WebFinger Crates.io Libraries.io dependency status for GitHub repo Codecov Build Status

A crate to help you fetch and serve WebFinger resources.


Fetching a resource:

use webfinger::resolve;

fn main() {
    let res = resolve("acct:test@example.org", true).expect("Error while fetching resource");

    println!("Places to get more informations about {}:", res.subject);
    for link in res.links.into_iter() {
        println!("- {}", link.href);

Serving resources:

use webfinger::Resolver;

pub struct MyResolver;

impl Resolver<DatabaseConnection> for MyResolver {
    fn instance_domain<'a>() -> &'a str {

    fn find(acct: String, db: DatabaseConnection) -> Result<Webfinger, ResolverError> {
        if let Some(user) = db.find_user_by_name(acct) {
            Ok(Webfinger {
                subject: acct.clone(),
                aliases: vec![acct.clone()],
                links: vec![
                    Link {
                        rel: "http://webfinger.net/rel/profile-page".to_string(),
                        mime_type: None,
                        href: user.profile_url()
        } else {

fn main() {
    // Start a web server and map /.well-known/webfinger to a function calling MyResolver::endpoint