Help us shape the future of Go! Take the 2026 Go Developer Survey

signupapi

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 11 Imported by: 0

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

func New

func New(o Options) (http.Handler, error)

New returns the API handler.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL