UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 854 B
{"version":3,"file":"validate-csrf.mjs","names":["authServices.csrf.verifyToken"],"sources":["../../../../src/libs/http/middleware/validate-csrf.ts"],"sourcesContent":["import { createMiddleware } from \"hono/factory\";\nimport { authServices } from \"../../../services/index.js\";\nimport type { LucidHonoContext } from \"../../../types/hono.js\";\nimport { LucidAPIError } from \"../../../utils/errors/index.js\";\n\nconst validateCSRF = createMiddleware(async (c: LucidHonoContext, next) => {\n\tconst verifyCSRFRes = authServices.csrf.verifyToken(c);\n\tif (verifyCSRFRes.error) throw new LucidAPIError(verifyCSRFRes.error);\n\n\treturn await next();\n});\n\nexport default validateCSRF;\n"],"mappings":"qKAKA,MAAM,EAAe,EAAiB,MAAO,EAAqB,IAAS,CAC1E,IAAM,EAAgBA,EAA8B,CAAC,EACrD,GAAI,EAAc,MAAO,MAAM,IAAI,EAAc,EAAc,KAAK,EAEpE,OAAO,MAAM,EAAK,CACnB,CAAC"}