naystack - v1.5.10
    Preparing search index...

    Function massageRequest

    • Parses and validates the JSON body for sign-up/login routes: ensures password is present and, if TURNSTILE_KEY is set, validates the Cloudflare Turnstile captcha.

      Parameters

      • req: NextRequest

        The NextRequest (body is read via req.json()).

      • options: InitRoutesOptions

        Same InitRoutesOptions passed to getEmailAuthRoutes; used for onError when validation fails.

      Returns Promise<
          {
              data?: { password: string } & { [key: string]: unknown };
              error?: NextResponse<unknown>;
          },
      >

      Promise of either { error: NextResponse } (validation failed) or { data: { password, ...rest } } with the validated payload.