A crate to help you fetch and serve WebFinger resources
https://crates.io/crates/webfinger
- Rust 97.2%
- Shell 2.8%
| src | Remove unnecessary mut | |
| .gitattributes | add git attributes and remove executable bit from files in repo | |
| .gitignore | Add support for group: and custom prefixes ( fixes #3 ) | |
| .travis.yml | add async tests to travis test script | |
| Cargo.toml | Specify async-trait version | |
| coverage.sh | Try to add codecov | |
| LICENSE | add git attributes and remove executable bit from files in repo | |
| README.md | add git attributes and remove executable bit from files in repo | |
WebFinger Crates.io Libraries.io dependency status for GitHub repo Codecov Build Status
A crate to help you fetch and serve WebFinger resources.
Examples
Fetching a resource:
usewebfinger::resolve;fn main(){letres=resolve("acct:test@example.org",true).expect("Error while fetching resource");println!("Places to get more informations about {}:",res.subject);forlinkinres.links.into_iter(){println!("- {}",link.href);}}Serving resources:
usewebfinger::Resolver;pubstruct MyResolver;implResolver<DatabaseConnection>forMyResolver{fn instance_domain<'a>()-> &'a str {"instance.tld"}fn find(acct: String,db: DatabaseConnection)-> Result<Webfinger,ResolverError>{ifletSome(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{Err(ResolverError::NotFound)}}}fn main(){// Start a web server and map /.well-known/webfinger to a function calling MyResolver::endpoint
}