diff --git a/types/index.d.ts b/types/index.d.ts index 35729f0..043909e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -180,9 +180,20 @@ declare namespace fastifySession { cookiePrefix?: string; } - export interface CookieOptions extends Omit { + export interface CookieOptions extends Omit { /** 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. + * @default 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 that case the `Secure` attribute is false for HTTP and true for HTTPS. + * @default true + */ + secure?: boolean | 'auto'; } export class MemoryStore implements fastifySession.SessionStore { diff --git a/types/index.tst.ts b/types/index.tst.ts index 8312765..920d42a 100644 --- a/types/index.tst.ts +++ b/types/index.tst.ts @@ -56,9 +56,11 @@ app.register(plugin, { } }) -const cookieMaxAge: CookieOptions = {} +const cookieOptions: CookieOptions = {} -expect(cookieMaxAge.maxAge).type.toBe() +expect(cookieOptions.maxAge).type.toBe() +expect(cookieOptions.httpOnly).type.toBe() +expect(cookieOptions.secure).type.toBe() app.register(plugin, { secret,