@orieljs/cookie 0.1.0-alpha.13 → 0.1.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -65,13 +65,15 @@ declare class AddQueuedCookiesToResponse implements Middleware {
65
65
  * once, outermost in `web`, so every cookie is encrypted exactly once.
66
66
  */
67
67
  declare class EncryptCookies implements Middleware {
68
+ #private;
68
69
  /** Cookie names that are never encrypted (Laravel 11's $middleware->encryptCookies(except: [...])). */
69
70
  static except(cookies: string | string[]): void;
70
71
  /** Forget the names added with except() (for tests). */
71
72
  static flushState(): void;
72
73
  /** Subclasses list cookie names that are not encrypted. */
73
74
  protected except: string[];
74
- protected readonly encrypter: Encrypter;
75
+ /** Resolved when there's a cookie to read or write, so a page that uses none works without APP_KEY. */
76
+ protected get encrypter(): Encrypter;
75
77
  isDisabled(name: string): boolean;
76
78
  handle(request: HttpRequest, next: Next): Promise<Response>;
77
79
  protected decrypt(request: HttpRequest): void;
package/dist/index.js CHANGED
@@ -165,7 +165,11 @@ var EncryptCookies = class {
165
165
  }
166
166
  /** Subclasses list cookie names that are not encrypted. */
167
167
  except = [];
168
- encrypter = inject2(Encrypter);
168
+ #encrypter;
169
+ /** Resolved when there's a cookie to read or write, so a page that uses none works without APP_KEY. */
170
+ get encrypter() {
171
+ return this.#encrypter ??= inject2(Encrypter);
172
+ }
169
173
  isDisabled(name) {
170
174
  return this.except.includes(name) || neverEncrypt.has(name);
171
175
  }
@@ -174,7 +178,6 @@ var EncryptCookies = class {
174
178
  return this.encrypt(await next(request));
175
179
  }
176
180
  decrypt(request) {
177
- const keys = this.encrypter.getAllKeys?.() ?? [this.encrypter.getKey()];
178
181
  const decrypted = {};
179
182
  for (const [name, value] of Object.entries(parseCookieHeader(request.header("cookie")))) {
180
183
  if (this.isDisabled(name)) {
@@ -182,6 +185,7 @@ var EncryptCookies = class {
182
185
  continue;
183
186
  }
184
187
  try {
188
+ const keys = this.encrypter.getAllKeys?.() ?? [this.encrypter.getKey()];
185
189
  const plain = CookieValuePrefix.validate(name, this.encrypter.decrypt(value, false), keys);
186
190
  if (plain !== void 0) decrypted[name] = plain;
187
191
  } catch {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../serialize.ts","../CookieValuePrefix.ts","../CookieJar.ts","../middleware/AddQueuedCookiesToResponse.ts","../middleware/EncryptCookies.ts","../facade.ts","../CookieServiceProvider.ts"],"sourcesContent":["import type { Cookie } from '@orieljs/contracts'\n\nconst SAME_SITE = { lax: 'Lax', strict: 'Strict', none: 'None' } as const\n\n/** A Set-Cookie header value. Negative minutes delete the cookie; 0 is a session cookie. */\nexport function serializeCookie(cookie: Cookie, now: number = Date.now()): string {\n const parts: string[] = []\n if (cookie.minutes < 0) {\n parts.push(`${cookie.name}=`, 'Expires=Thu, 01 Jan 1970 00:00:00 GMT', 'Max-Age=0')\n } else {\n parts.push(`${cookie.name}=${encodeURIComponent(cookie.value)}`)\n if (cookie.minutes > 0) {\n parts.push(`Expires=${new Date(now + cookie.minutes * 60_000).toUTCString()}`, `Max-Age=${cookie.minutes * 60}`)\n }\n }\n parts.push(`Path=${cookie.path}`)\n if (cookie.domain !== undefined && cookie.domain !== '') parts.push(`Domain=${cookie.domain}`)\n if (cookie.secure) parts.push('Secure')\n if (cookie.httpOnly) parts.push('HttpOnly')\n parts.push(`SameSite=${SAME_SITE[cookie.sameSite]}`)\n return parts.join('; ')\n}\n\nexport interface ParsedSetCookie {\n name: string\n value: string\n /** Everything after the name=value pair, including the leading '; ' (empty when there are no attributes). */\n attributes: string\n}\n\nconst decode = (value: string): string => {\n try {\n return decodeURIComponent(value)\n } catch {\n return value\n }\n}\n\n/** Splits a Set-Cookie header value into its name, decoded value and untouched attributes. */\nexport function parseSetCookie(header: string): ParsedSetCookie {\n const semicolon = header.indexOf(';')\n const pair = semicolon === -1 ? header : header.slice(0, semicolon)\n const equals = pair.indexOf('=')\n return {\n name: (equals === -1 ? pair : pair.slice(0, equals)).trim(),\n value: equals === -1 ? '' : decode(pair.slice(equals + 1).trim()),\n attributes: semicolon === -1 ? '' : header.slice(semicolon),\n }\n}\n\n/** Parses a Cookie request header (`a=1; b=2`). The first occurrence of a name wins. */\nexport function parseCookieHeader(header: string | undefined): Record<string, string> {\n const cookies: Record<string, string> = {}\n for (const part of (header ?? '').split(';')) {\n const equals = part.indexOf('=')\n if (equals === -1) continue\n const name = part.slice(0, equals).trim()\n if (name === '' || Object.hasOwn(cookies, name) || name === '__proto__') continue\n cookies[name] = decode(part.slice(equals + 1).trim())\n }\n return cookies\n}\n\n/** A copy of the response whose headers can be changed (Response.redirect() and fetch() headers are immutable). */\nexport function withHeaders(response: Response, change: (headers: Headers) => void): Response {\n const headers = new Headers(response.headers)\n change(headers)\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto'\n\n/**\n * Laravel's CookieValuePrefix: encrypted cookie values start with hmac_sha1(name + 'v2', key) + '|', which binds\n * each value to its cookie name so an encrypted value can't be replayed under another cookie.\n */\nexport const CookieValuePrefix = {\n create(name: string, key: Uint8Array): string {\n return `${createHmac('sha1', key).update(`${name}v2`).digest('hex')}|`\n },\n\n remove(value: string): string {\n return value.slice(41)\n },\n\n /** The value without its prefix when the prefix matches one of the keys, else undefined. */\n validate(name: string, value: string, keys: Uint8Array[]): string | undefined {\n const actual = Buffer.from(value.slice(0, 41))\n for (const key of keys) {\n const expected = Buffer.from(CookieValuePrefix.create(name, key))\n if (actual.length === expected.length && timingSafeEqual(actual, expected)) return CookieValuePrefix.remove(value)\n }\n return undefined\n },\n}\n","import type { Cookie, CookieJar as CookieJarContract } from '@orieljs/contracts'\n\nexport interface CookieDefaults {\n path?: string\n domain?: string | undefined\n secure?: boolean\n sameSite?: Cookie['sameSite']\n}\n\ntype CookieOptions = Partial<Omit<Cookie, 'name' | 'value' | 'minutes'>>\n\n/** Laravel's CookieJar. One per request scope: queued cookies are attached by AddQueuedCookiesToResponse. */\nexport class CookieJar implements CookieJarContract {\n readonly #queued = new Map<string, Cookie>()\n readonly #defaults: Required<Omit<CookieDefaults, 'domain'>> & { domain: string | undefined }\n\n constructor(defaults: CookieDefaults = {}) {\n this.#defaults = {\n path: defaults.path ?? '/',\n domain: defaults.domain ?? undefined,\n secure: defaults.secure ?? false,\n sameSite: defaults.sameSite ?? 'lax',\n }\n }\n\n make(name: string, value: string, minutes = 0, options: CookieOptions = {}): Cookie {\n const domain = options.domain ?? this.#defaults.domain\n return {\n name,\n value,\n minutes,\n path: options.path ?? this.#defaults.path,\n ...(domain === undefined ? {} : { domain }),\n secure: options.secure ?? this.#defaults.secure,\n httpOnly: options.httpOnly ?? true,\n sameSite: options.sameSite ?? this.#defaults.sameSite,\n }\n }\n\n /** 400 days, as in Laravel: the longest lifetime browsers keep a cookie. */\n forever(name: string, value: string, options: CookieOptions = {}): Cookie {\n return this.make(name, value, 576000, options)\n }\n\n /** An expired cookie that makes the browser delete it. */\n forget(name: string, options: CookieOptions = {}): Cookie {\n return this.make(name, '', -2628000, options)\n }\n\n /** Queue a cookie for the response. A cookie with the same name and path replaces the earlier one. */\n queue(cookie: Cookie): void {\n this.#queued.set(`${cookie.name}\\0${cookie.path}`, cookie)\n }\n\n queued(): Cookie[] {\n return [...this.#queued.values()]\n }\n\n hasQueued(name: string, path?: string): boolean {\n return this.queuedCookie(name, path) !== undefined\n }\n\n queuedCookie(name: string, path?: string): Cookie | undefined {\n return this.queued().find((cookie) => cookie.name === name && (path === undefined || cookie.path === path))\n }\n\n unqueue(name: string, path?: string): void {\n for (const [key, cookie] of this.#queued) {\n if (cookie.name === name && (path === undefined || cookie.path === path)) this.#queued.delete(key)\n }\n }\n}\n","import { CookieJar, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { serializeCookie, withHeaders } from '../serialize'\n\n/** Laravel's AddQueuedCookiesToResponse: writes the request's queued cookies as Set-Cookie headers. */\nexport class AddQueuedCookiesToResponse implements Middleware {\n readonly #jar = inject(CookieJar)\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n const response = await next(request)\n const cookies = this.#jar.queued()\n if (cookies.length === 0) return response\n return withHeaders(response, (headers) => {\n for (const cookie of cookies) headers.append('Set-Cookie', serializeCookie(cookie))\n })\n }\n}\n","import { Encrypter, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { CookieValuePrefix } from '../CookieValuePrefix'\nimport { parseCookieHeader, parseSetCookie, withHeaders } from '../serialize'\n\nconst neverEncrypt = new Set<string>()\n\n/** Whether a Set-Cookie deletes the cookie (Max-Age <= 0, or Expires in the past): its value is left alone. */\nfunction isDeletion(attributes: string, now = Date.now()): boolean {\n for (const part of attributes.split(';')) {\n const equals = part.indexOf('=')\n if (equals === -1) continue\n const key = part.slice(0, equals).trim().toLowerCase()\n const value = part.slice(equals + 1).trim()\n if (key === 'max-age' && Number(value) <= 0) return true\n if (key === 'expires' && Date.parse(value) <= now) return true\n }\n return false\n}\n\n/**\n * Laravel's EncryptCookies: request cookies are decrypted (and dropped when they don't decrypt), and every\n * Set-Cookie on the outgoing response is encrypted, whoever wrote it (queued on the CookieJar, or written straight\n * onto the response such as RedirectResponse.withCookie()), except the names in `except` and deletions. It runs\n * once, outermost in `web`, so every cookie is encrypted exactly once.\n */\nexport class EncryptCookies implements Middleware {\n /** Cookie names that are never encrypted (Laravel 11's $middleware->encryptCookies(except: [...])). */\n static except(cookies: string | string[]): void {\n for (const name of Array.isArray(cookies) ? cookies : [cookies]) neverEncrypt.add(name)\n }\n\n /** Forget the names added with except() (for tests). */\n static flushState(): void {\n neverEncrypt.clear()\n }\n\n /** Subclasses list cookie names that are not encrypted. */\n protected except: string[] = []\n\n protected readonly encrypter = inject(Encrypter)\n\n isDisabled(name: string): boolean {\n return this.except.includes(name) || neverEncrypt.has(name)\n }\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n this.decrypt(request)\n return this.encrypt(await next(request))\n }\n\n protected decrypt(request: HttpRequest): void {\n const keys = (this.encrypter as { getAllKeys?(): Uint8Array[] }).getAllKeys?.() ?? [this.encrypter.getKey()]\n const decrypted: Record<string, string> = {}\n for (const [name, value] of Object.entries(parseCookieHeader(request.header('cookie')))) {\n if (this.isDisabled(name)) {\n decrypted[name] = value\n continue\n }\n try {\n const plain = CookieValuePrefix.validate(name, this.encrypter.decrypt<string>(value, false), keys)\n if (plain !== undefined) decrypted[name] = plain\n } catch {\n // A cookie that doesn't decrypt reads as absent (Laravel sets it to null).\n }\n }\n request.setCookies(decrypted)\n }\n\n protected encrypt(response: Response): Response {\n const cookies = response.headers.getSetCookie()\n if (cookies.length === 0) return response\n return withHeaders(response, (headers) => {\n headers.delete('Set-Cookie')\n for (const header of cookies) {\n const { name, value, attributes } = parseSetCookie(header)\n if (this.isDisabled(name) || isDeletion(attributes)) {\n headers.append('Set-Cookie', header)\n continue\n }\n const encrypted = this.encrypter.encrypt(CookieValuePrefix.create(name, this.encrypter.getKey()) + value, false)\n headers.append('Set-Cookie', `${name}=${encodeURIComponent(encrypted)}${attributes}`)\n }\n })\n }\n}\n","import { CookieJar, HttpRequest, type Cookie as CookieShape } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { facade } from '@orieljs/support'\n\n/** The Cookie facade: the request's jar, plus get()/has() reading the (decrypted) request cookies. */\nexport const Cookie = facade(CookieJar, {\n get: (name: string, defaultValue?: string): string | undefined => inject(HttpRequest).cookie(name) ?? defaultValue,\n has: (name: string): boolean => inject(HttpRequest).cookie(name) !== undefined,\n})\n\n/** cookie(): the jar; cookie(name, value, minutes?, options?): a new cookie (queue it, or attach it to a redirect). */\nexport function cookie(): CookieJar\nexport function cookie(name: string, value: string, minutes?: number, options?: Partial<Omit<CookieShape, 'name' | 'value' | 'minutes'>>): CookieShape\nexport function cookie(\n name?: string,\n value?: string,\n minutes?: number,\n options?: Partial<Omit<CookieShape, 'name' | 'value' | 'minutes'>>,\n): CookieJar | CookieShape {\n const jar = inject(CookieJar)\n return name === undefined ? jar : jar.make(name, value ?? '', minutes, options)\n}\n","import { ConfigRepository, CookieJar as CookieJarToken, HttpRequest, Router, type Cookie } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { CookieJar } from './CookieJar'\nimport { AddQueuedCookiesToResponse } from './middleware/AddQueuedCookiesToResponse'\nimport { EncryptCookies } from './middleware/EncryptCookies'\n\nexport class CookieServiceProvider extends ServiceProvider {\n override register(): void {\n // Laravel's CookieServiceProvider takes the jar's defaults from config/session.php.\n this.app.scoped(CookieJarToken, (container) => {\n const config = container.make(ConfigRepository)\n const domain = config.get<string | null | undefined>('session.domain')\n // secure defaults to null (ruling F6); an explicit true/false wins, otherwise it follows the request's scheme\n // (Symfony's setSecureDefault), so cookies built from these defaults (e.g. the remember cookie) are Secure on HTTPS.\n const secureConfig = config.get<boolean | null | undefined>('session.secure', null)\n const secure = secureConfig ?? (container.bound(HttpRequest) && container.make(HttpRequest).url().startsWith('https:'))\n return new CookieJar({\n path: config.get('session.path', '/'),\n domain: domain ?? undefined,\n secure,\n sameSite: config.get<Cookie['sameSite'] | null>('session.same_site', 'lax') ?? 'lax',\n })\n })\n }\n\n override boot(): void {\n if (!this.app.bound(Router)) return\n this.app.make(Router).pushMiddlewareToGroup('web', EncryptCookies).pushMiddlewareToGroup('web', AddQueuedCookiesToResponse)\n }\n}\n"],"mappings":";AAEA,IAAM,YAAY,EAAE,KAAK,OAAO,QAAQ,UAAU,MAAM,OAAO;AAGxD,SAAS,gBAAgBA,SAAgB,MAAc,KAAK,IAAI,GAAW;AAChF,QAAM,QAAkB,CAAC;AACzB,MAAIA,QAAO,UAAU,GAAG;AACtB,UAAM,KAAK,GAAGA,QAAO,IAAI,KAAK,yCAAyC,WAAW;AAAA,EACpF,OAAO;AACL,UAAM,KAAK,GAAGA,QAAO,IAAI,IAAI,mBAAmBA,QAAO,KAAK,CAAC,EAAE;AAC/D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;AACF;","names":["cookie","cookie","CookieJar","CookieJar","cookie","inject","inject","CookieJar","inject","HttpRequest","HttpRequest"]}
1
+ {"version":3,"sources":["../serialize.ts","../CookieValuePrefix.ts","../CookieJar.ts","../middleware/AddQueuedCookiesToResponse.ts","../middleware/EncryptCookies.ts","../facade.ts","../CookieServiceProvider.ts"],"sourcesContent":["import type { Cookie } from '@orieljs/contracts'\n\nconst SAME_SITE = { lax: 'Lax', strict: 'Strict', none: 'None' } as const\n\n/** A Set-Cookie header value. Negative minutes delete the cookie; 0 is a session cookie. */\nexport function serializeCookie(cookie: Cookie, now: number = Date.now()): string {\n const parts: string[] = []\n if (cookie.minutes < 0) {\n parts.push(`${cookie.name}=`, 'Expires=Thu, 01 Jan 1970 00:00:00 GMT', 'Max-Age=0')\n } else {\n parts.push(`${cookie.name}=${encodeURIComponent(cookie.value)}`)\n if (cookie.minutes > 0) {\n parts.push(`Expires=${new Date(now + cookie.minutes * 60_000).toUTCString()}`, `Max-Age=${cookie.minutes * 60}`)\n }\n }\n parts.push(`Path=${cookie.path}`)\n if (cookie.domain !== undefined && cookie.domain !== '') parts.push(`Domain=${cookie.domain}`)\n if (cookie.secure) parts.push('Secure')\n if (cookie.httpOnly) parts.push('HttpOnly')\n parts.push(`SameSite=${SAME_SITE[cookie.sameSite]}`)\n return parts.join('; ')\n}\n\nexport interface ParsedSetCookie {\n name: string\n value: string\n /** Everything after the name=value pair, including the leading '; ' (empty when there are no attributes). */\n attributes: string\n}\n\nconst decode = (value: string): string => {\n try {\n return decodeURIComponent(value)\n } catch {\n return value\n }\n}\n\n/** Splits a Set-Cookie header value into its name, decoded value and untouched attributes. */\nexport function parseSetCookie(header: string): ParsedSetCookie {\n const semicolon = header.indexOf(';')\n const pair = semicolon === -1 ? header : header.slice(0, semicolon)\n const equals = pair.indexOf('=')\n return {\n name: (equals === -1 ? pair : pair.slice(0, equals)).trim(),\n value: equals === -1 ? '' : decode(pair.slice(equals + 1).trim()),\n attributes: semicolon === -1 ? '' : header.slice(semicolon),\n }\n}\n\n/** Parses a Cookie request header (`a=1; b=2`). The first occurrence of a name wins. */\nexport function parseCookieHeader(header: string | undefined): Record<string, string> {\n const cookies: Record<string, string> = {}\n for (const part of (header ?? '').split(';')) {\n const equals = part.indexOf('=')\n if (equals === -1) continue\n const name = part.slice(0, equals).trim()\n if (name === '' || Object.hasOwn(cookies, name) || name === '__proto__') continue\n cookies[name] = decode(part.slice(equals + 1).trim())\n }\n return cookies\n}\n\n/** A copy of the response whose headers can be changed (Response.redirect() and fetch() headers are immutable). */\nexport function withHeaders(response: Response, change: (headers: Headers) => void): Response {\n const headers = new Headers(response.headers)\n change(headers)\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto'\n\n/**\n * Laravel's CookieValuePrefix: encrypted cookie values start with hmac_sha1(name + 'v2', key) + '|', which binds\n * each value to its cookie name so an encrypted value can't be replayed under another cookie.\n */\nexport const CookieValuePrefix = {\n create(name: string, key: Uint8Array): string {\n return `${createHmac('sha1', key).update(`${name}v2`).digest('hex')}|`\n },\n\n remove(value: string): string {\n return value.slice(41)\n },\n\n /** The value without its prefix when the prefix matches one of the keys, else undefined. */\n validate(name: string, value: string, keys: Uint8Array[]): string | undefined {\n const actual = Buffer.from(value.slice(0, 41))\n for (const key of keys) {\n const expected = Buffer.from(CookieValuePrefix.create(name, key))\n if (actual.length === expected.length && timingSafeEqual(actual, expected)) return CookieValuePrefix.remove(value)\n }\n return undefined\n },\n}\n","import type { Cookie, CookieJar as CookieJarContract } from '@orieljs/contracts'\n\nexport interface CookieDefaults {\n path?: string\n domain?: string | undefined\n secure?: boolean\n sameSite?: Cookie['sameSite']\n}\n\ntype CookieOptions = Partial<Omit<Cookie, 'name' | 'value' | 'minutes'>>\n\n/** Laravel's CookieJar. One per request scope: queued cookies are attached by AddQueuedCookiesToResponse. */\nexport class CookieJar implements CookieJarContract {\n readonly #queued = new Map<string, Cookie>()\n readonly #defaults: Required<Omit<CookieDefaults, 'domain'>> & { domain: string | undefined }\n\n constructor(defaults: CookieDefaults = {}) {\n this.#defaults = {\n path: defaults.path ?? '/',\n domain: defaults.domain ?? undefined,\n secure: defaults.secure ?? false,\n sameSite: defaults.sameSite ?? 'lax',\n }\n }\n\n make(name: string, value: string, minutes = 0, options: CookieOptions = {}): Cookie {\n const domain = options.domain ?? this.#defaults.domain\n return {\n name,\n value,\n minutes,\n path: options.path ?? this.#defaults.path,\n ...(domain === undefined ? {} : { domain }),\n secure: options.secure ?? this.#defaults.secure,\n httpOnly: options.httpOnly ?? true,\n sameSite: options.sameSite ?? this.#defaults.sameSite,\n }\n }\n\n /** 400 days, as in Laravel: the longest lifetime browsers keep a cookie. */\n forever(name: string, value: string, options: CookieOptions = {}): Cookie {\n return this.make(name, value, 576000, options)\n }\n\n /** An expired cookie that makes the browser delete it. */\n forget(name: string, options: CookieOptions = {}): Cookie {\n return this.make(name, '', -2628000, options)\n }\n\n /** Queue a cookie for the response. A cookie with the same name and path replaces the earlier one. */\n queue(cookie: Cookie): void {\n this.#queued.set(`${cookie.name}\\0${cookie.path}`, cookie)\n }\n\n queued(): Cookie[] {\n return [...this.#queued.values()]\n }\n\n hasQueued(name: string, path?: string): boolean {\n return this.queuedCookie(name, path) !== undefined\n }\n\n queuedCookie(name: string, path?: string): Cookie | undefined {\n return this.queued().find((cookie) => cookie.name === name && (path === undefined || cookie.path === path))\n }\n\n unqueue(name: string, path?: string): void {\n for (const [key, cookie] of this.#queued) {\n if (cookie.name === name && (path === undefined || cookie.path === path)) this.#queued.delete(key)\n }\n }\n}\n","import { CookieJar, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { serializeCookie, withHeaders } from '../serialize'\n\n/** Laravel's AddQueuedCookiesToResponse: writes the request's queued cookies as Set-Cookie headers. */\nexport class AddQueuedCookiesToResponse implements Middleware {\n readonly #jar = inject(CookieJar)\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n const response = await next(request)\n const cookies = this.#jar.queued()\n if (cookies.length === 0) return response\n return withHeaders(response, (headers) => {\n for (const cookie of cookies) headers.append('Set-Cookie', serializeCookie(cookie))\n })\n }\n}\n","import { Encrypter, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { CookieValuePrefix } from '../CookieValuePrefix'\nimport { parseCookieHeader, parseSetCookie, withHeaders } from '../serialize'\n\nconst neverEncrypt = new Set<string>()\n\n/** Whether a Set-Cookie deletes the cookie (Max-Age <= 0, or Expires in the past): its value is left alone. */\nfunction isDeletion(attributes: string, now = Date.now()): boolean {\n for (const part of attributes.split(';')) {\n const equals = part.indexOf('=')\n if (equals === -1) continue\n const key = part.slice(0, equals).trim().toLowerCase()\n const value = part.slice(equals + 1).trim()\n if (key === 'max-age' && Number(value) <= 0) return true\n if (key === 'expires' && Date.parse(value) <= now) return true\n }\n return false\n}\n\n/**\n * Laravel's EncryptCookies: request cookies are decrypted (and dropped when they don't decrypt), and every\n * Set-Cookie on the outgoing response is encrypted, whoever wrote it (queued on the CookieJar, or written straight\n * onto the response such as RedirectResponse.withCookie()), except the names in `except` and deletions. It runs\n * once, outermost in `web`, so every cookie is encrypted exactly once.\n */\nexport class EncryptCookies implements Middleware {\n /** Cookie names that are never encrypted (Laravel 11's $middleware->encryptCookies(except: [...])). */\n static except(cookies: string | string[]): void {\n for (const name of Array.isArray(cookies) ? cookies : [cookies]) neverEncrypt.add(name)\n }\n\n /** Forget the names added with except() (for tests). */\n static flushState(): void {\n neverEncrypt.clear()\n }\n\n /** Subclasses list cookie names that are not encrypted. */\n protected except: string[] = []\n\n #encrypter: Encrypter | undefined\n\n /** Resolved when there's a cookie to read or write, so a page that uses none works without APP_KEY. */\n protected get encrypter(): Encrypter {\n return (this.#encrypter ??= inject(Encrypter))\n }\n\n isDisabled(name: string): boolean {\n return this.except.includes(name) || neverEncrypt.has(name)\n }\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n this.decrypt(request)\n return this.encrypt(await next(request))\n }\n\n protected decrypt(request: HttpRequest): void {\n const decrypted: Record<string, string> = {}\n for (const [name, value] of Object.entries(parseCookieHeader(request.header('cookie')))) {\n if (this.isDisabled(name)) {\n decrypted[name] = value\n continue\n }\n try {\n const keys = (this.encrypter as { getAllKeys?(): Uint8Array[] }).getAllKeys?.() ?? [this.encrypter.getKey()]\n const plain = CookieValuePrefix.validate(name, this.encrypter.decrypt<string>(value, false), keys)\n if (plain !== undefined) decrypted[name] = plain\n } catch {\n // A cookie that doesn't decrypt reads as absent (Laravel sets it to null). So does one on an app with no key: it\n // can't have set it, and an analytics cookie set by the browser mustn't take the page down.\n }\n }\n request.setCookies(decrypted)\n }\n\n protected encrypt(response: Response): Response {\n const cookies = response.headers.getSetCookie()\n if (cookies.length === 0) return response\n return withHeaders(response, (headers) => {\n headers.delete('Set-Cookie')\n for (const header of cookies) {\n const { name, value, attributes } = parseSetCookie(header)\n if (this.isDisabled(name) || isDeletion(attributes)) {\n headers.append('Set-Cookie', header)\n continue\n }\n const encrypted = this.encrypter.encrypt(CookieValuePrefix.create(name, this.encrypter.getKey()) + value, false)\n headers.append('Set-Cookie', `${name}=${encodeURIComponent(encrypted)}${attributes}`)\n }\n })\n }\n}\n","import { CookieJar, HttpRequest, type Cookie as CookieShape } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { facade } from '@orieljs/support'\n\n/** The Cookie facade: the request's jar, plus get()/has() reading the (decrypted) request cookies. */\nexport const Cookie = facade(CookieJar, {\n get: (name: string, defaultValue?: string): string | undefined => inject(HttpRequest).cookie(name) ?? defaultValue,\n has: (name: string): boolean => inject(HttpRequest).cookie(name) !== undefined,\n})\n\n/** cookie(): the jar; cookie(name, value, minutes?, options?): a new cookie (queue it, or attach it to a redirect). */\nexport function cookie(): CookieJar\nexport function cookie(name: string, value: string, minutes?: number, options?: Partial<Omit<CookieShape, 'name' | 'value' | 'minutes'>>): CookieShape\nexport function cookie(\n name?: string,\n value?: string,\n minutes?: number,\n options?: Partial<Omit<CookieShape, 'name' | 'value' | 'minutes'>>,\n): CookieJar | CookieShape {\n const jar = inject(CookieJar)\n return name === undefined ? jar : jar.make(name, value ?? '', minutes, options)\n}\n","import { ConfigRepository, CookieJar as CookieJarToken, HttpRequest, Router, type Cookie } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { CookieJar } from './CookieJar'\nimport { AddQueuedCookiesToResponse } from './middleware/AddQueuedCookiesToResponse'\nimport { EncryptCookies } from './middleware/EncryptCookies'\n\nexport class CookieServiceProvider extends ServiceProvider {\n override register(): void {\n // Laravel's CookieServiceProvider takes the jar's defaults from config/session.php.\n this.app.scoped(CookieJarToken, (container) => {\n const config = container.make(ConfigRepository)\n const domain = config.get<string | null | undefined>('session.domain')\n // secure defaults to null (ruling F6); an explicit true/false wins, otherwise it follows the request's scheme\n // (Symfony's setSecureDefault), so cookies built from these defaults (e.g. the remember cookie) are Secure on HTTPS.\n const secureConfig = config.get<boolean | null | undefined>('session.secure', null)\n const secure = secureConfig ?? (container.bound(HttpRequest) && container.make(HttpRequest).url().startsWith('https:'))\n return new CookieJar({\n path: config.get('session.path', '/'),\n domain: domain ?? undefined,\n secure,\n sameSite: config.get<Cookie['sameSite'] | null>('session.same_site', 'lax') ?? 'lax',\n })\n })\n }\n\n override boot(): void {\n if (!this.app.bound(Router)) return\n this.app.make(Router).pushMiddlewareToGroup('web', EncryptCookies).pushMiddlewareToGroup('web', AddQueuedCookiesToResponse)\n }\n}\n"],"mappings":";AAEA,IAAM,YAAY,EAAE,KAAK,OAAO,QAAQ,UAAU,MAAM,OAAO;AAGxD,SAAS,gBAAgBA,SAAgB,MAAc,KAAK,IAAI,GAAW;AAChF,QAAM,QAAkB,CAAC;AACzB,MAAIA,QAAO,UAAU,GAAG;AACtB,UAAM,KAAK,GAAGA,QAAO,IAAI,KAAK,yCAAyC,WAAW;AAAA,EACpF,OAAO;AACL,UAAM,KAAK,GAAGA,QAAO,IA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AM,MAAM,EAAG;AAC7B,SAAK,IAAI,KAAK,MAAM,EAAE,sBAAsB,OAAO,cAAc,EAAE,sBAAsB,OAAO,0BAA0B;AAAA,EAC5H;AACF;","names":["cookie","cookie","CookieJar","CookieJar","cookie","inject","inject","CookieJar","inject","HttpRequest","HttpRequest"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orieljs/cookie",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.14",
4
4
  "description": "The Oriel Cookie component.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  "TRADEMARKS.md"
32
32
  ],
33
33
  "dependencies": {
34
- "@orieljs/contracts": "0.1.0-alpha.13",
35
- "@orieljs/container": "0.1.0-alpha.13",
36
- "@orieljs/support": "0.1.0-alpha.13"
34
+ "@orieljs/contracts": "0.1.0-alpha.14",
35
+ "@orieljs/container": "0.1.0-alpha.14",
36
+ "@orieljs/support": "0.1.0-alpha.14"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsup && node ../../../scripts/copy-license.mjs"