Types and helpers to interact with Webfinger from an actix environment
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.
Arlo (Hyena) 17cc4c9f21 Add matrix link 2 months ago
examples Update to latest actix-web 5 months ago
src Add matrix link 2 months ago
.gitignore Initial commit 8 months ago
Cargo.toml Stable actix 4 months ago
LICENSE Add documentation 8 months ago
README.md Add matrix link 2 months ago


Actix Webfinger

A library to aid in resolving and providing webfinger objects with the Actix Web web framework.

The main functionality this crate provides is through the Webfinger::fetch method for Actix Web-based clients, and the Resolver<S> trait for Actix Web-based servers.


First, add Actix Webfinger as a dependency

actix = "0.8"
actix-web = "1.0.0"
actix-webfinger = "0.2.0"

Then use it in your application

Client Example

use actix::System;
use actix_web::client::Connector;
use actix_webfinger::Webfinger;
use futures::{future::lazy, Future};
use openssl::ssl::{SslConnector, SslMethod};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let sys = System::new("sir-boops");

    let ssl_conn = SslConnector::builder(SslMethod::tls())?.build();
    let conn = Connector::new().ssl(ssl_conn).finish();

    let fut = lazy(move || {
        Webfinger::fetch(conn, "asonix@asonix.dog", "localhost:8000", false)
            .map(move |w: Webfinger| {
                println!("asonix's webfinger:\n{:#?}", w);

            .map_err(|e| eprintln!("Error: {}", e))



Server Example

use actix_web::{web::Data, App, HttpServer};
use actix_webfinger::{Resolver, Webfinger};
use futures::{future::IntoFuture, Future};
use std::error::Error;

#[derive(Clone, Debug)]
pub struct MyState {
    domain: String,

pub struct MyResolver;

impl Resolver<Data<MyState>> for MyResolver {
    type Error = actix_web::error::JsonPayloadError;

    fn find(
        account: &str,
        domain: &str,
        state: &Data<MyState>,
    ) -> Box<dyn Future<Item = Option<Webfinger>, Error = Self::Error>> {
        let w = if domain == state.domain {
            Some(Webfinger::new(&format!("{}@{}", account, domain)))
        } else {


fn main() -> Result<(), Box<dyn Error>> {
    HttpServer::new(|| {
            .data(MyState {
                domain: "asonix.dog".to_owned(),
            .service(actix_webfinger::resource::<_, MyResolver>())



Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.


Copyright © 2019 Riley Trautman

Actix Webfinger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Actix Webfinger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of Tokio ZMQ.

You should have received a copy of the GNU General Public License along with Actix Webfinger. If not, see http://www.gnu.org/licenses/.