From df091cde911c6e878db5de292b9b51f0aa75e6dd Mon Sep 17 00:00:00 2001 From: Andres Morey Date: Sun, 21 Jul 2024 23:06:00 -0400 Subject: [PATCH] adds support for cookie attribute --- pnpm-lock.yaml | 6 ------ shared/src/protect.test.ts | 1 + shared/src/protect.ts | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 64cbdab..648b29a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,12 +48,6 @@ importers: specifier: ^2.14.2 version: 2.14.2(vitest@1.5.0(@edge-runtime/vm@3.2.0)(@types/node@20.12.7)) - examples/node-http: - dependencies: - '@edge-csrf/node-http': - specifier: ^0.0.0 - version: link:../../packages/node-http - packages/core: {} packages/express: diff --git a/shared/src/protect.test.ts b/shared/src/protect.test.ts index 11c0922..bfa9838 100644 --- a/shared/src/protect.test.ts +++ b/shared/src/protect.test.ts @@ -11,6 +11,7 @@ describe('CookieOptions tests', () => { expect(cookieOpts.httpOnly).toEqual(true); expect(cookieOpts.maxAge).toEqual(undefined); expect(cookieOpts.name).toEqual('_csrfSecret'); + expect(cookieOpts.partitioned).toEqual(undefined); expect(cookieOpts.path).toEqual('/'); expect(cookieOpts.sameSite).toEqual('strict'); expect(cookieOpts.secure).toEqual(true); diff --git a/shared/src/protect.ts b/shared/src/protect.ts index 60574d3..fa539cd 100644 --- a/shared/src/protect.ts +++ b/shared/src/protect.ts @@ -18,6 +18,8 @@ export class CookieOptions { name: string = '_csrfSecret'; + partitioned: boolean | undefined = undefined; + path: string = '/'; sameSite: boolean | 'none' | 'strict' | 'lax' = 'strict';