Documentation
¶
Overview ¶
Package signupapi serves the HTTP API for invite-gated sign-up: operator routes for email invites, invite codes, the waitlist, member allowances and the accounts invites admitted, and member routes for a person's own invite codes.
The handler does not authenticate anyone itself. The host passes how to find the signed-in person (Options.Principal) and whether they are a platform administrator (Options.IsAdmin), so the same handler can sit behind SystemAuth's login session or behind a host application's own session. Mount it under a prefix with http.StripPrefix; routes are relative to it.
JSON is snake_case like the rest of SystemAuth, lists are wrapped in a named key, and errors are {"error": "..."}. Responses are never cached, and state-changing requests from another origin are refused.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Invites, Codes and Waitlist are the stores the API manages. Codes
// carries the member invite settings. All three are required.
Invites *signupgate.Store
Codes *signupgate.CodeStore
Waitlist *signupgate.Waitlist
// Principal returns the signed-in person, or an error when the request
// has no valid session. Required.
Principal func(*http.Request) (uuid.UUID, error)
// IsAdmin reports whether a person is a platform administrator, who may
// use the operator routes. Required.
IsAdmin func(context.Context, uuid.UUID) (bool, error)
// SignupURL is the sign-up page invite links open, such as
// https://auth.example.com/signup. Without it, responses carry the code
// but no link.
SignupURL string
// Audit receives an event for every change. Optional.
Audit audit.Emitter
// Logger defaults to slog.Default.
Logger *slog.Logger
}
Options configure the API.