UNPKG

@lucidcms/core

Version:

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

2 lines 1.07 kB
import e from"../../../../constants/constants.mjs";import t from"../../../../utils/errors/lucid-api-error.mjs";import n from"../../../../services/auth/get-status.mjs";import r from"../../utils/create-service-context.mjs";import i from"../../middleware/rate-limiter.mjs";import a from"../../openapi/index.mjs";import{minutesToMilliseconds as o}from"date-fns";import{getCookie as s}from"hono/cookie";import{createFactory as c}from"hono/factory";import{describeRoute as l}from"hono-openapi";const u=c().createHandlers(l({description:`Checks whether the current browser cookies represent an active session without refreshing or rotating tokens.`,tags:[`auth`],summary:`Get Auth Status`,responses:a.responses()}),i({mode:`ip`,limit:e.rateLimit.scopes.standard.limit,scope:`auth-status`,windowMs:o(1)}),async i=>{let a=await n(r(i),{accessToken:s(i,e.cookies.accessToken),refreshToken:s(i,e.cookies.refreshToken)});if(a.error)throw new t(a.error);return i.header(`Cache-Control`,`no-store`),i.status(204),i.body(null)});export{u as default}; //# sourceMappingURL=get-status.mjs.map