handle

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRegisteredClaimProvided is returned when a registered claim is provided.
	ErrRegisteredClaimProvided = errors.New("registered claims should not be provided")
	// ErrJWTAlgNotFound is returned when a JWT alg is not found.
	ErrJWTAlgNotFound = errors.New("JWT alg not found")
)
View Source
var (
	// ErrToken is returned when the JWT is invalid.
	ErrToken = errors.New("JWT invalid")
)

Functions

This section is empty.

Types

type MiddlewareHook

type MiddlewareHook interface {
	Hook(options MiddlewareOptions) MiddlewareOptions
}

MiddlewareHook is a function that can be used to modify the middleware options.

type MiddlewareHookFunc

type MiddlewareHookFunc func(options MiddlewareOptions) MiddlewareOptions

MiddlewareHookFunc is a function that can be used to modify the middleware options.

func (MiddlewareHookFunc) Hook

type MiddlewareOptions

type MiddlewareOptions struct {
	Handler http.Handler
	Path    string
	Toggle  MiddlewareToggle
}

MiddlewareOptions contains options for applying middleware.

type MiddlewareToggle

type MiddlewareToggle struct {
	Admin     bool
	Authn     bool
	CommitTx  bool
	RateLimit bool
}

MiddlewareToggle contains fields to turn middleware on and off.

type Server

type Server struct {
	Config         config.Config
	Ctx            context.Context
	EmailProvider  email.Provider
	HTTPMux        *http.ServeMux
	JWKS           jwkset.Storage
	Limiter        rlimit.RateLimiter
	MagicLink      magiclink.MagicLink
	Store          storage.Storage
	Logger         *slog.Logger
	MiddlewareHook MiddlewareHook
}

Server is the magiclinksdev server.

func (*Server) HandleJWTCreate

func (*Server) HandleJWTValidate

func (*Server) HandleMagicLinkCreate added in v0.6.0

func (s *Server) HandleMagicLinkCreate(ctx context.Context, req model.ValidMagicLinkCreateRequest) (response model.MagicLinkCreateResponse, err error)

func (*Server) HandleMagicLinkEmailCreate added in v0.6.0

func (*Server) HandleOTPCreate added in v0.6.0

func (s *Server) HandleOTPCreate(ctx context.Context, req model.ValidOTPCreateRequest) (response model.OTPCreateResponse, err error)

func (*Server) HandleOTPEmailCreate added in v0.6.0

func (s *Server) HandleOTPEmailCreate(ctx context.Context, req model.ValidOTPEmailCreateRequest) (response model.OTPEmailCreateResponse, err error)

func (*Server) HandleOTPValidate added in v0.6.0

func (s *Server) HandleOTPValidate(ctx context.Context, req model.ValidOTPValidateRequest) (response model.OTPValidateResponse, err error)

func (*Server) HandleServiceAccountCreate

HandleServiceAccountCreate handles the service account creation endpoint.

Jump to

Keyboard shortcuts

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