1package webfinger
2
3// The Resolver is how the webfinger service looks up a user or resource. The resolver
4// must be provided by the developer using this package, as each webfinger
5// service may be exposing a different set or users or resources or services.
6type Resolver interface {
7
8	// FindUser finds the user given the username and hostname.
9	FindUser(username string, hostname, requestHost string, r []Rel) (*Resource, error)
10
11	// DummyUser allows us to return a dummy user to avoid user-enumeration via webfinger 404s. This
12	// can be done in the webfinger code itself but then it would be obvious which users are real
13	// and which are not real via differences in how the implementation works vs how
14	// the general webfinger code works. This does not match the webfinger specification
15	// but is an extra precaution. Returning a NotFound error here will
16	// keep the webfinger 404 behavior.
17	DummyUser(username string, hostname string, r []Rel) (*Resource, error)
18
19	// IsNotFoundError returns true if the given error is a not found error.
20	IsNotFoundError(err error) bool
21}
22