Documentation ¶
Index ¶
- Variables
- type MiddlewareHook
- type MiddlewareHookFunc
- type MiddlewareOptions
- type MiddlewareToggle
- type Server
- func (s *Server) HandleEmailLinkCreate(ctx context.Context, req model.ValidEmailLinkCreateRequest) (model.EmailLinkCreateResponse, error)
- func (s *Server) HandleJWTCreate(ctx context.Context, req model.ValidJWTCreateRequest) (model.JWTCreateResponse, error)
- func (s *Server) HandleJWTValidate(ctx context.Context, req model.ValidJWTValidateRequest) (model.JWTValidateResponse, error)
- func (s *Server) HandleLinkCreate(ctx context.Context, req model.ValidLinkCreateRequest) (response model.LinkCreateResponse, err error)
- func (s *Server) HandleServiceAccountCreate(ctx context.Context, args model.ValidServiceAccountCreateRequest) (model.ServiceAccountCreateResponse, error)
- type SigningBytesClaims
Constants ¶
This section is empty.
Variables ¶
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") )
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 ¶
func (h MiddlewareHookFunc) Hook(options MiddlewareOptions) MiddlewareOptions
Hook implements the MiddlewareHook interface.
type MiddlewareOptions ¶
type MiddlewareOptions struct { Handler http.Handler Path string Toggle MiddlewareToggle }
MiddlewareOptions contains options for applying middleware.
type MiddlewareToggle ¶
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.JWKSet[storage.JWKSetCustomKeyMeta] Limiter rlimit.RateLimiter MagicLink magiclink.MagicLink[storage.MagicLinkCustomCreateArgs, storage.MagicLinkCustomReadResponse, storage.JWKSetCustomKeyMeta] Store storage.Storage Logger *slog.Logger MiddlewareHook MiddlewareHook }
Server is the magiclinksdev server.
func (*Server) HandleEmailLinkCreate ¶
func (s *Server) HandleEmailLinkCreate(ctx context.Context, req model.ValidEmailLinkCreateRequest) (model.EmailLinkCreateResponse, error)
HandleEmailLinkCreate handles the email link creation endpoint.
func (*Server) HandleJWTCreate ¶
func (s *Server) HandleJWTCreate(ctx context.Context, req model.ValidJWTCreateRequest) (model.JWTCreateResponse, error)
HandleJWTCreate handles the creation of a JWT.
func (*Server) HandleJWTValidate ¶
func (s *Server) HandleJWTValidate(ctx context.Context, req model.ValidJWTValidateRequest) (model.JWTValidateResponse, error)
HandleJWTValidate handles the JWT validation endpoint.
func (*Server) HandleLinkCreate ¶
func (s *Server) HandleLinkCreate(ctx context.Context, req model.ValidLinkCreateRequest) (response model.LinkCreateResponse, err error)
HandleLinkCreate handles the link creation endpoint.
func (*Server) HandleServiceAccountCreate ¶
func (s *Server) HandleServiceAccountCreate(ctx context.Context, args model.ValidServiceAccountCreateRequest) (model.ServiceAccountCreateResponse, error)
HandleServiceAccountCreate handles the service account creation endpoint.
type SigningBytesClaims ¶
type SigningBytesClaims struct {
Claims json.RawMessage
}
SigningBytesClaims is a JWT claims type that allows for signing claims represented in bytes.
func (SigningBytesClaims) MarshalJSON ¶
func (s SigningBytesClaims) MarshalJSON() ([]byte, error)
MarshalJSON helps implement the json.Marshaler interface.
func (SigningBytesClaims) Valid ¶
func (s SigningBytesClaims) Valid() error
Valid helps implement the jwt.Claims interface.