handler

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package handler is the Lambda entry point: it decodes a Cognito trigger event and routes it to the hook for its trigger source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	PreSignUp         Hook[presignup.Event]
	PostConfirmation  Hook[postconfirmation.Event]
	PreAuthentication Hook[preauthentication.Event]
}

Handler holds the enabled hooks. A nil hook is disabled.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, raw json.RawMessage) (any, error)

Handle decodes one event, routes it to its hook, and returns the event the hook responded with.

An event for a disabled hook or an unknown trigger is an error. Cognito triggers are synchronous, so the error reaches the user (a PreSignUp error rejects the sign-up, and a PreAuthentication error the sign-in) and points at the misconfiguration, instead of letting events through unchecked.

type Hook

type Hook[E any] interface {
	Handle(ctx context.Context, e *E) error
}

Hook handles the events of one Cognito trigger. Handle may change the event; the changed event is the response to Cognito.

Jump to

Keyboard shortcuts

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