diff --git a/types/types.d.ts b/types/types.d.ts index 9dddb4b..908a758 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -2,10 +2,11 @@ import type * as Fastify from 'fastify'; import { FastifyPluginCallback } from 'fastify'; +import { SerializeOptions } from "@fastify/cookie" declare module 'fastify' { interface FastifyInstance { - decryptSession = FastifyRequest>(sessionId: string, request: Request, cookieOpts: fastifySession.CookieOptions, callback: Callback): void; + decryptSession = FastifyRequest>(sessionId: string, request: Request, cookieOpts: SerializeOptions, callback: Callback): void; decryptSession = FastifyRequest>(sessionId: string, request: Request, callback: Callback): void; } @@ -141,7 +142,7 @@ declare namespace fastifySession { * * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie */ - cookie?: CookieOptions; + cookie?: SerializeOptions; /** * A session store. @@ -173,29 +174,6 @@ declare namespace fastifySession { cookiePrefix?: string; } - export interface CookieOptions { - /** The `Path` attribute. Defaults to `/` (the root path). */ - path?: string; - - /** A `number` in milliseconds that specifies the `Expires` attribute by adding the specified milliseconds to the current date. If both `expires` and `maxAge` are set, then `expires` is used. */ - maxAge?: number; - - /** The `boolean` value of the `HttpOnly` attribute. Defaults to true. */ - httpOnly?: boolean; - - /** The `boolean` value of the `Secure` attribute. Set this option to false when communicating over an unencrypted (HTTP) connection. Value can be set to `auto`; in this case the `Secure` attribute will be set to false for HTTP request, in case of HTTPS it will be set to true. Defaults to true. */ - secure?: boolean | 'auto'; - - /** The expiration `date` used for the `Expires` attribute. If both `expires` and `maxAge` are set, then `expires` is used. */ - expires?: Date; - - /** A `boolean` or one of the `SameSite` string attributes. E.g.: `lax`, `node` or `strict`. */ - sameSite?: 'lax' | 'none' | 'strict' | boolean; - - /** The `Domain` attribute. */ - domain?: string; - } - export class MemoryStore implements fastifySession.SessionStore { constructor(map?: Map); set(