Documentation ¶
Index ¶
- func LookupService(usr *user.User, opt ...UpdateOption) (services.Service, error)
- func SetLogger(l Logger)
- func ValidateStatement(st *keys.Statement) error
- type ContextLogger
- type LogLevel
- type Logger
- type Option
- type Options
- type SearchRequest
- type SearchResult
- type ServiceLookupFn
- type UpdateOption
- type UpdateOptions
- type Users
- func (u *Users) CheckForExisting(ctx context.Context, sc *keys.Sigchain) (keys.ID, error)
- func (u *Users) CheckSigchain(ctx context.Context, sc *keys.Sigchain, opt ...UpdateOption) (*user.Result, error)
- func (u *Users) Client() http.Client
- func (u *Users) Expired(ctx context.Context, dt time.Duration, maxAge time.Duration) ([]keys.ID, error)
- func (u *Users) Find(ctx context.Context, kid keys.ID) (*user.Result, error)
- func (u *Users) Get(ctx context.Context, kid keys.ID) (*user.Result, error)
- func (u *Users) KIDs(ctx context.Context) ([]keys.ID, error)
- func (u *Users) RequestVerify(ctx context.Context, service services.Service, usr *user.User) *user.Result
- func (u *Users) Search(ctx context.Context, req *SearchRequest) ([]*SearchResult, error)
- func (u *Users) Status(ctx context.Context, st user.Status) ([]keys.ID, error)
- func (u *Users) Update(ctx context.Context, kid keys.ID, opt ...UpdateOption) (*user.Result, error)
- func (u *Users) User(ctx context.Context, user string) (*user.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LookupService ¶ added in v0.1.18
LookupService finds service.
func ValidateStatement ¶
ValidateStatement returns error if statement is not a valid user statement.
Types ¶
type ContextLogger ¶
type ContextLogger interface { Debugf(ctx context.Context, format string, args ...interface{}) Infof(ctx context.Context, format string, args ...interface{}) Warningf(ctx context.Context, format string, args ...interface{}) Errorf(ctx context.Context, format string, args ...interface{}) }
ContextLogger interface used in this package with request context.
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) }
Logger interface used in this package.
type SearchRequest ¶
type SearchRequest struct { // Query to search for. Query string // Limit number of results. Limit int }
SearchRequest ...
type SearchResult ¶
type SearchResult struct { KID keys.ID Result *user.Result // Field we matched on (if not the user). Field string }
SearchResult ...
type ServiceLookupFn ¶ added in v0.1.19
ServiceLookupFn for custom service lookup.
type UpdateOption ¶ added in v0.1.18
type UpdateOption func(*UpdateOptions)
UpdateOption ...
func UseService ¶ added in v0.1.19
func UseService(service ServiceLookupFn) UpdateOption
UseService option.
type UpdateOptions ¶ added in v0.1.18
type UpdateOptions struct { // Specify the service to use for the check. // For twitter proxy, use services.Proxy. Service ServiceLookupFn }
UpdateOptions ...
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users keeps track of sigchain user links.
func (*Users) CheckForExisting ¶
CheckForExisting returns key ID of existing user in sigchain different from the specified sigchain.
func (*Users) CheckSigchain ¶
func (u *Users) CheckSigchain(ctx context.Context, sc *keys.Sigchain, opt ...UpdateOption) (*user.Result, error)
CheckSigchain looks for user in a Sigchain and creates a result or updates the current result.
func (*Users) Expired ¶
func (u *Users) Expired(ctx context.Context, dt time.Duration, maxAge time.Duration) ([]keys.ID, error)
Expired returns KIDs that haven't been checked in a duration.
func (*Users) Get ¶
Get user result for KID. Retrieves cached result. If Update(kid) has not been called or there is no user statement, this will return nil.
func (*Users) RequestVerify ¶
func (u *Users) RequestVerify(ctx context.Context, service services.Service, usr *user.User) *user.Result
RequestVerify requests and verifies a user. Doesn't index result.
func (*Users) Search ¶
func (u *Users) Search(ctx context.Context, req *SearchRequest) ([]*SearchResult, error)
Search for users.