You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -41,6 +41,15 @@ Read a cookie through `cookies.get(key, value, options)`. The parameters support
41
41
- signed - Whether `Boolean` needs to verify the cookie, and pass the signed parameter when cooperating with the set. At this time, the front-end cannot tamper with the cookie. The default is true.
42
42
- encrypt - Whether `Boolean` needs to decrypt the cookie, and pass the encrypt parameter when cooperating with the set. At this time, the front-end cannot read the real cookie value, and the default is false.
43
43
44
+
You can also set default options for `get` method by passing `defaultGetCookieOptions` when initializing Cookies:
45
+
46
+
```ts
47
+
const cookies =newCookies(ctx, keys, defaultCookieOptions, { signed: false });
48
+
// Now cookies.get('foo') will use signed: false by default
49
+
```
50
+
51
+
**⚠️ Security Warning: Setting `signed: false` in `defaultGetCookieOptions` is dangerous as it disables cookie signature verification by default. This makes your application vulnerable to cookie tampering attacks. Only use this option if you fully understand the security implications and have a specific reason to disable signature verification.**
52
+
44
53
## Delete cookie
45
54
46
55
Use `cookie.set(key, null)` to delete a cookie. If the `signed` parameter is passed, the signature will also be deleted.
0 commit comments