Skip to main content

webhookMiddleware

@rotorsoft/act-root


@rotorsoft/act-root / act-http/src/receiver/trpc / webhookMiddleware

Function: webhookMiddleware()

webhookMiddleware(options): any

Defined in: libs/act-http/src/receiver/trpc/index.ts:58

Build a tRPC middleware that verifies the request signature (when secret is set), enforces Idempotency-Key, and claims the key on the configured store. See the module-level docs for usage.

The returned function uses permissive any typing because tRPC's MiddlewareFunction type lives in unstable-core-do-not-import (internal namespace, not for external import). Type-safety at the call site comes from t.procedure.use(...) validating the middleware shape against the procedure's context โ€” the operator's tRPC context must include headers and rawBody, and downstream handlers see ctx.idempotency = { key, deduped }.

Parametersโ€‹

optionsโ€‹

CheckWebhookOptions

Returnsโ€‹

any