Skip to content
/ digit Public

Simple API for building WebFinger resource responses

License

Notifications You must be signed in to change notification settings

benpate/digit

Repository files navigation

digit 👉

GoDoc Version Build Status Go Report Card Codecov

WebFinger for Go

Digit implements the WebFinger protocol. It includes type definitions for WebFinger data structures, along with some utilities for sending and receiving WebFinger requests

Generating WebFinger Data

Digit provides data types with a simple, chainable API for creating new resources.

resource := digit.NewResource("acct:sarah@sky.net").
	Alias("http://sky.net/sarah").
	Alias("http://other.website.com/sarah-connor").
	Property("http://sky.net/ns/role", "employee").
	Link(RelationTypeProfile, "text/html", "https://sky.net/sarah")

result, err := json.Marshal(resource)

Retrieving WebFinger Data

Digit can look up WebFinger metadata using a variety of identifiers

resource, err := digit.Lookup("sarah@sky.net") // Email construction
resource, err := digit.Lookup("sarah@sky.net") // Fediverse "@username" construction
resource, err := digit.Lookup("http://sky.net/sarah") // Canonical URL construction

WebFinger Resources

Pull Requests Welcome

Digit is relatively stable and is performing well in Emissary. However, it is still a work in progress, and will benefit from your experience reports, use cases, and contributions. If you have an idea for making this library better, send in a pull request. We're all in this together! 👉

About

Simple API for building WebFinger resource responses

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages