From bb3f96bffdacefa32d42ad28d787d37735669d95 Mon Sep 17 00:00:00 2001 From: Raku Zeta Date: Mon, 22 Apr 2024 12:52:30 +0800 Subject: [PATCH 1/2] Update plugin.d.ts Signed-off-by: Raku Zeta --- types/plugin.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 5604c79..7b99b73 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -115,21 +115,21 @@ declare namespace fastifyCookie { domain?: string; /** Specifies a function that will be used to encode a cookie's value. Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode a value into a string suited for a cookie's value. */ encode?(val: string): string; - /** The expiration `date` used for the `Expires` attribute. If both `expires` and `maxAge` are set, then `expires` is used. */ + /** The expiration `date` used for the `Expires` attribute. */ expires?: Date; - /** The `boolean` value of the `HttpOnly` attribute. Defaults to true. */ + /** The `boolean` value of the `HttpOnly` attribute. */ httpOnly?: boolean; - /** A `number` in seconds that specifies the `Expires` attribute by adding the specified seconds to the current date. If both `expires` and `maxAge` are set, then `expires` is used. */ + /** A `number` in seconds that specifies the `Max-Age` attribute. */ maxAge?: number; /** A `boolean` indicating whether the cookie is tied to the top-level site where it's initially set and cannot be accessed from elsewhere. */ partitioned?: boolean; - /** The `Path` attribute. Defaults to `/` (the root path). */ + /** The `Path` attribute. */ path?: string; /** A `boolean` or one of the `SameSite` string attributes. E.g.: `lax`, `none` or `strict`. */ sameSite?: 'lax' | 'none' | 'strict' | boolean; /** One of the `Priority` string attributes (`low`, `medium` or `high`) specifying a retention priority for HTTP cookies that will be respected by user agents during cookie eviction. */ priority?: 'low' | 'medium' | 'high'; - /** 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. */ + /** 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. */ secure?: boolean; } From 77236a50c31d1d77262bcff02fa71752c07d7749 Mon Sep 17 00:00:00 2001 From: Raku Zeta Date: Mon, 22 Apr 2024 15:57:21 +0800 Subject: [PATCH 2/2] Update plugin.d.ts Signed-off-by: Raku Zeta --- types/plugin.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 7b99b73..2e0f959 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -117,7 +117,7 @@ declare namespace fastifyCookie { encode?(val: string): string; /** The expiration `date` used for the `Expires` attribute. */ expires?: Date; - /** The `boolean` value of the `HttpOnly` attribute. */ + /** Add the `HttpOnly` attribute. Defaults to `false`. */ httpOnly?: boolean; /** A `number` in seconds that specifies the `Max-Age` attribute. */ maxAge?: number; @@ -129,11 +129,12 @@ declare namespace fastifyCookie { sameSite?: 'lax' | 'none' | 'strict' | boolean; /** One of the `Priority` string attributes (`low`, `medium` or `high`) specifying a retention priority for HTTP cookies that will be respected by user agents during cookie eviction. */ priority?: 'low' | 'medium' | 'high'; - /** 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. */ + /** Add the `Secure` attribute. Defaults to `false`. */ secure?: boolean; } export interface CookieSerializeOptions extends Omit { + /** Add the `Secure` attribute. Value can be set to `"auto"`; in this case the `Secure` attribute will only be added for HTTPS requests. Defaults to `false`. */ secure?: boolean | 'auto'; signed?: boolean; }