Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenroose/dart-webfinger
A library that implements the WebFinger protocol defined by RFC 7033.
https://github.com/stevenroose/dart-webfinger
Last synced: about 1 month ago
JSON representation
A library that implements the WebFinger protocol defined by RFC 7033.
- Host: GitHub
- URL: https://github.com/stevenroose/dart-webfinger
- Owner: stevenroose
- License: mit
- Created: 2015-02-26T18:04:43.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-16T18:16:44.000Z (over 8 years ago)
- Last Synced: 2024-10-30T20:24:12.496Z (3 months ago)
- Language: Dart
- Size: 15.6 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# webfinger
This library implements the WebFinger protocol defined in [RFC 7033](https://tools.ietf.org/html/rfc7033).# Usage
```dart
WebFinger webfinger = ...; // see next section// query any URI
webfinger.query("https://packetizer.com/").then((JRDDocument result) {
print(result.subject); // = https://packetizer.com/
print(result.properties["http://packetizer.com/ns/name"]);
});// shortcut for accounts
webfinger.account("[email protected]").then((JRDDocument result) {
// same as webfinger.query("acct:[email protected]")
print(result.subject); // = acct:[email protected]
// iterate over the links
result.links.forEach((JRDLink link) {
print(link.rel);
print(link.href);
});
// or just find a link by its relation
print(result.link("http://specs.openid.net/auth/2.0/provider").href); // = https://openid.packetizer.com/paulej
});// query for only certain relations
webfinger.account("[email protected]", rels: ["http://webfinger.net/rel/avatar"]).then((JRDDocument result) {
print(result.link("http://specs.openid.net/auth/2.0/provider")); // = null
});
```## Creating WebFinger instance
Use the `package:http.Client` interface to provide an HTTP client to the `WebFinger` constructor.
The [`http`](https://pub.dartlang.org/packages/http) package provides both an implementation for the VM and for the browser.### In the VM
```dart
import "package:http/http.dart"
import "Package:webfinger/webfinger.dart"WebFinger webfinger = new WebFinger(new Client());
```### In the browser
```dart
import "package:http/browser_client.dart"
import "Package:webfinger/webfinger.dart"WebFinger webfinger = new WebFinger(new BrowserClient());
```