insite-cookie 2.3.3 → 2.4.0
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/LICENSE +1 -1
- package/README.md +123 -4
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +4 -4
- package/package.json +54 -42
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,13 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# insite-cookie
|
|
2
|
+
|
|
3
|
+
Cookie support for inSite — token-based handoff for setting cookies over WebSocket. Browsers do not expose `Set-Cookie` for WebSocket responses; this package uses a token handoff: server sends token via WS, client fetches HTTP endpoint with token, receives `Set-Cookie`.
|
|
4
|
+
|
|
5
|
+
Part of [inSite](../../README.md) — depends on [insite-users-server-ws](../users-server-ws/README.md), [insite-http](../http/README.md), [insite-ws](../ws/README.md), [insite-common](../common/README.md).
|
|
2
6
|
|
|
3
7
|
## Installation
|
|
4
8
|
|
|
5
9
|
```sh
|
|
6
|
-
|
|
10
|
+
npm install insite-cookie
|
|
7
11
|
```
|
|
8
12
|
|
|
9
|
-
Or
|
|
13
|
+
Or:
|
|
10
14
|
|
|
11
15
|
```sh
|
|
12
|
-
|
|
16
|
+
bun add insite-cookie
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
sequenceDiagram
|
|
23
|
+
participant Client
|
|
24
|
+
participant WS as WebSocket
|
|
25
|
+
participant Server
|
|
26
|
+
participant Middleware as Cookie Middleware
|
|
27
|
+
|
|
28
|
+
Client->>WS: connect
|
|
29
|
+
Server->>Client: message ~setcookie token
|
|
30
|
+
Client->>Middleware: GET /cookie?token
|
|
31
|
+
Middleware->>Client: 200 Set-Cookie
|
|
32
|
+
Client->>Client: browser stores cookie
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
**Server**
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { CookieSetter, CookieMiddleware } from "insite-cookie/server";
|
|
41
|
+
import { UsersServer } from "insite-users-server-ws";
|
|
42
|
+
import { HTTPServer } from "insite-http";
|
|
43
|
+
|
|
44
|
+
const usersServer = new UsersServer({ /* ... */ });
|
|
45
|
+
const cookieSetter = new CookieSetter({ usersServer });
|
|
46
|
+
const cookieMiddleware = new CookieMiddleware();
|
|
47
|
+
|
|
48
|
+
const http = new HTTPServer();
|
|
49
|
+
http.use(cookieMiddleware);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Client**
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { CookieSetter } from "insite-cookie/client";
|
|
56
|
+
import { WS } from "insite-ws/client";
|
|
57
|
+
|
|
58
|
+
const ws = new WS({ url: "wss://example.com" });
|
|
59
|
+
new CookieSetter(ws, { url: "/cookie" });
|
|
13
60
|
```
|
|
61
|
+
|
|
62
|
+
Or use [insite-client](../client/README.md) with `cookie: {}`.
|
|
63
|
+
|
|
64
|
+
## API Reference
|
|
65
|
+
|
|
66
|
+
### Exports
|
|
67
|
+
|
|
68
|
+
**Server (`insite-cookie/server`):**
|
|
69
|
+
|
|
70
|
+
| Export | Type | Description |
|
|
71
|
+
|--------|------|-------------|
|
|
72
|
+
| `CookieSetter` | class | Sets cookies via token handoff; session sync on connect/session change |
|
|
73
|
+
| `CookieMiddleware` | class | HTTP middleware for `/cookie?token` |
|
|
74
|
+
| `parseCookie` | function | Parses cookie string to `Record<string, unknown>` |
|
|
75
|
+
| `CookieMiddlewareOptions` | type | CookieMiddleware constructor options |
|
|
76
|
+
|
|
77
|
+
**Client (`insite-cookie/client`):**
|
|
78
|
+
|
|
79
|
+
| Export | Type | Description |
|
|
80
|
+
|--------|------|-------------|
|
|
81
|
+
| `CookieSetter` | class | Listens for `~setcookie`, XHR to set cookies |
|
|
82
|
+
| `Options` | type | Constructor options |
|
|
83
|
+
|
|
84
|
+
**Types:** `Cookie` — `Record<string, string>`; `CookieOptions` — maxAge, expiresAt, domain, path, secure, httpOnly, sameSite
|
|
85
|
+
|
|
86
|
+
### CookieSetter (server)
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
class CookieSetter<AS extends AbilitiesSchema>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Member | Signature | Description |
|
|
93
|
+
|--------|------------|-------------|
|
|
94
|
+
| constructor | `(options: Options<AS>)` | `usersServer` required; `domain` defaults to `process.env.INSITE_HOST`; `maxAge` defaults to session TTL |
|
|
95
|
+
| set | `(wssc, cookie, options) => void` | Queues cookie, sends token; client fetches URL for Set-Cookie |
|
|
96
|
+
| unset | `(wssc, names) => void` | Clears cookies by name |
|
|
97
|
+
| usersServer | `UsersServer<AS>` | Injected |
|
|
98
|
+
| domain | `string \| undefined` | Cookie domain |
|
|
99
|
+
| maxAge | `number` | Cookie max-age in seconds |
|
|
100
|
+
| parse | `static` | Alias for parseCookie |
|
|
101
|
+
|
|
102
|
+
### CookieMiddleware
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
class CookieMiddleware extends ClassMiddleware
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Member | Signature | Description |
|
|
109
|
+
|--------|------------|-------------|
|
|
110
|
+
| constructor | `(options?: CookieMiddlewareOptions)` | `path` defaults to `"/cookie"` |
|
|
111
|
+
| make | `static (arg: MakeArg) => string` | Builds Set-Cookie header |
|
|
112
|
+
| cookify | `static (cookie, options) => string[]` | Builds Set-Cookie array |
|
|
113
|
+
|
|
114
|
+
### CookieSetter (client)
|
|
115
|
+
|
|
116
|
+
| Member | Signature | Description |
|
|
117
|
+
|--------|------------|-------------|
|
|
118
|
+
| constructor | `(ws: WS, options?: Options)` | Subscribes to `~setcookie`; fetches `url?token` |
|
|
119
|
+
| method | `"GET" \| "POST"` | Default `"GET"` |
|
|
120
|
+
| url | `string` | Default `"/cookie"` |
|
|
121
|
+
|
|
122
|
+
**Options:** method, url, onload, onerror
|
|
123
|
+
|
|
124
|
+
## Related
|
|
125
|
+
|
|
126
|
+
- [insite-client](../client/README.md) — pass `cookie: {}` to enable
|
|
127
|
+
- [insite-users-server-ws](../users-server-ws/README.md) — server CookieSetter binds to client-connect, client-session
|
|
128
|
+
- [insite-http](../http/README.md), [insite-ws](../ws/README.md), [insite-common](../common/README.md)
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
package/dist/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{getWithTimeout as f}from"@nesvet/n";import{ClassMiddleware as l}from"insite-http";var n=new Map;var u=class r extends l{constructor(e={}){super();let{path:s="/cookie"}=e;this.listeners={GET:[[s,this.#e]]}}#e=(e,s)=>{let t=e.querystring;return t&&n.has(t)?s.writeHead(200,{"Content-Type":"text/plain; charset=utf-8","Set-Cookie":r.cookify(...f(n,t))}).end():!1};static make({name:e,value:s,maxAge:t,expiresAt:o,domain:a,path:m="/",secure:k=!0,httpOnly:c=!0,sameSite:h="Strict"}){let i=[`${e}=${s}`];return t!==void 0?i.push(`Max-Age=${t}`):o&&i.push(`Max-Age=${Math.round((o.getTime()-Date.now())/1e3)}`),a&&i.push(`Domain=${a}`),m&&i.push(`Path=${m}`),k&&i.push("Secure"),c&&i.push("HttpOnly"),h&&i.push(`SameSite=${h}`),i.join("; ")}static cookify(e,s){return Object.entries(e).map(([t,o])=>this.make({name:t,value:o,...s}))}};function p(r){return r?r.split(/;\s*/).reduce((e,s)=>{let[t,o]=s.split(/=/);try{e[t]=JSON.parse(o)}catch{e[t]=o}return e},{}):{}}import C from"node:crypto";import{random as g,setWithTimeout as y}from"@nesvet/n";var S={set:"~setcookie"};var x=2e3,d=class{constructor({usersServer:e,domain:s,maxAge:t}){this.usersServer=e,this.domain=s??process.env.INSITE_HOST,this.maxAge=t??this.usersServer.users.sessions.collection.expireAfterSeconds,this.usersServer.wss.on("client-connect",this.#t),this.usersServer.wss.on("client-session",this.#s)}#e=new WeakMap;usersServer;domain;maxAge;set(e,s,t){let o=`${Math.round(performance.now()*Number.MAX_SAFE_INTEGER).toString(36)}$${C.randomBytes(g(4,8)).toString("hex")}`;y(n,o,[s,t],x),e.sendMessage(S.set,o)}unset(e,s){this.set(e,s.reduce((t,o)=>(t[o]="",t),{}),{domain:this.domain,maxAge:0})}#t=(e,s)=>{if(this.#e.set(e,null),s.headers.cookie){let{sessionId:t=null}=p(s.headers.cookie);this.#e.set(e,t),t&&this.usersServer.setSession(e,t,!0)}};#s=e=>{this.#e.get(e)!==e.session?._id&&(this.#e.set(e,e.session?._id??null),e.isOpen&&e.session?this.set(e,{sessionId:e.session._id},{domain:this.domain,maxAge:this.maxAge}):this.unset(e,["sessionId"]))};static parse=p};export{u as CookieMiddleware,d as CookieSetter,p as parseCookie};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["export function noop() { /**/ }\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype Value<T> = PromiseLike<T> | T;\ntype Resolve<T> = (value: Value<T>) => void;\ntype Reject = (reason?: any) => void;\n\ntype Options = {\n\tsignal?: AbortSignal;\n\ttimeout?: number;\n};\n\nconst nativesMap = new WeakMap<StatefulPromise<any>, { resolve: Resolve<any>; reject: Reject }>();\n\n\nexport class StatefulPromise<T> extends Promise<T> {\n\tconstructor(\n\t\texecutor?: (resolve: Resolve<T>, reject: Reject) => void,\n\t\toptions?: Options\n\t) {\n\t\tlet nativeResolve: Resolve<T>;\n\t\tlet nativeReject: Reject;\n\t\t\n\t\tsuper((resolve, reject) => {\n\t\t\tnativeResolve = resolve;\n\t\t\tnativeReject = reject;\n\t\t\t\n\t\t});\n\t\t\n\t\tnativesMap.set(this, { resolve: nativeResolve!, reject: nativeReject! });\n\t\t\n\t\tif (options?.signal)\n\t\t\tif (options.signal.aborted)\n\t\t\t\tthis.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\telse {\n\t\t\t\tconst abortListener = () => this.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\t\t\n\t\t\t\toptions.signal.addEventListener(\"abort\", abortListener);\n\t\t\t\t\n\t\t\t\tthis.finally(() => options.signal?.removeEventListener(\"abort\", abortListener));\n\t\t\t}\n\t\t\n\t\tif (typeof options?.timeout === \"number\" && Number.isFinite(options.timeout)) {\n\t\t\tconst timeout = setTimeout(() => this.reject(new DOMException(\"Timeout exceeded\", \"TimeoutError\")), options.timeout);\n\t\t\t\n\t\t\tthis.finally(() => clearTimeout(timeout));\n\t\t}\n\t\t\n\t\texecutor?.(this.resolve, this.reject);\n\t\t\n\t}\n\t\n\tisPending = true;\n\tisFulfilled = false;\n\tisRejected = false;\n\t\n\tstate: \"fulfilled\" | \"pending\" | \"rejected\" = \"pending\";\n\t\n\tresult?: T | unknown;\n\t\n\treadonly resolve = (value: Value<T>) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isFulfilled = true;\n\t\t\tthis.state = \"fulfilled\";\n\t\t\tthis.result = value;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.resolve.call(this, value);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\treadonly reject = (reason?: any) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isRejected = true;\n\t\t\tthis.state = \"rejected\";\n\t\t\tthis.result = reason;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.reject.call(this, reason);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\t\n\tstatic resolved<U>(value: U): StatefulPromise<U> {\n\t\treturn new StatefulPromise<U>(resolve => resolve(value));\n\t}\n\t\n\tstatic rejected(reason: unknown): StatefulPromise<never> {\n\t\treturn new StatefulPromise((_, reject) => reject(reason));\n\t}\n\t\n}\n", "import { noop } from \"./noop.js\";\nimport { StatefulPromise } from \"./StatefulPromise.js\";\n\n\ntype Callback = (...args: any[]) => unknown;// eslint-disable-line @typescript-eslint/no-explicit-any\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\n\ntype DebouncedFunction<C extends Callback> = {\n\t(this: ThisParameterType<C>, ...args: Parameters<C>): Promise<Awaited<ReturnType<C>>>;\n};\n\nexport type Debounced<C extends Callback, R extends ReturnType<C>> = DebouncedFunction<C> & {\n\tcallback: C;\n\tpromise: StatefulPromise<R>;\n\tresolve: (value: R) => void;\n\treject: (reason?: unknown) => void;\n\trun(): Promise<R>;\n\tclear(shouldRun?: boolean): Promise<void>;\n};\n\n\nexport function debounce<C extends Callback, R extends ReturnType<C>>(callback: C, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: ReturnType<typeof setTimeout> | undefined;\n\tlet maxWaitTimeout: ReturnType<typeof setTimeout> | undefined;\n\tlet end: number | undefined;\n\tlet context: ThisParameterType<C>;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: R;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\t\n\t\t\tdebounced.resolve(result);\n\t\t\t\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\t\n\t\trun();\n\t\t\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\ttry {\n\t\t\tresult = await callback.apply(context, args) as R;\n\t\t\t\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tdebounced.reject(error);\n\t\t\t\n\t\t\tthrow error;\n\t\t}\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<C, R> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (!debounced.promise.isPending)\n\t\t\tdebounced.promise = new StatefulPromise<R>((resolve, reject) => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\tdebounced.reject = reject;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\t\n\t\t\t\t\tinitial = false;\n\t\t\t\t\t\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\t\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<C>, {\n\t\tcallback,\n\t\tpromise: StatefulPromise.resolved(undefined as unknown as R),\n\t\tresolve: noop,\n\t\treject: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: StatefulPromise.resolved(undefined), // eslint-disable-line unicorn/no-useless-undefined\n\tresolve: noop,\n\treject: noop,\n\trun: noop,\n\tclear: noop\n}) as Debounced<() => void, void>;\n\n\nexport function throttle(callback: Callback, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "const timeoutsMapMap: Map<Map<any, any>, Map<any, number>> = new Map();// eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport function cleanup<K, V>(map: Map<K, V>, key: K) {\n\tmap.delete(key);\n\t\n\tconst timeoutsMap = timeoutsMapMap.get(map);\n\tif (timeoutsMap) {\n\t\t\n\t\tconst timeout = timeoutsMap.get(key);\n\t\tif (timeout) {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeoutsMap.delete(key);\n\t\t}\n\t\t\n\t\tif (!timeoutsMap.size)\n\t\t\ttimeoutsMapMap.delete(map);\n\t}\n\t\n}\n\nexport function setup<K, V>(map: Map<K, V>, key: K, ms: number) {\n\tconst timeout = setTimeout(() => cleanup(map, key), ms);\n\t\n\ttimeoutsMapMap.get(map)?.set(key, timeout) ??\n\ttimeoutsMapMap.set(map, new Map([ [ key, timeout ] ]));\n\t\n}\n", "import { cleanup } from \"./timeouts.js\";\n\n\nexport function getWithTimeout<K, V>(map: Map<K, V>, key: K) {\n\tconst value = map.get(key);\n\t\n\tcleanup(map, key);\n\t\n\treturn value;\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export function random(from: number, to: number) {\n\treturn Math.floor(Math.random() * (to - from + 1) + from);\n}\n", "import { setup } from \"./timeouts.js\";\n\n\nexport function setWithTimeout<K, V>(map: Map<K, V>, key: K, value: V, ms: number) {\n\tsetup(map, key, ms);\n\t\n\treturn map.set(key, value);\n}\n", "import { getWithTimeout } from \"@nesvet/n\";\nimport { ClassMiddleware, type RequestHandler } from \"insite-http\";\nimport { tokenMap } from \"./tokenMap\";\nimport type { Cookie, CookieOptions } from \"./types\";\n\n\ntype Options = {\n\tpath?: RegExp | string;\n};\n\nexport type { Options as CookieMiddlewareOptions };\n\ntype MakeArg = CookieOptions & {\n\tname: keyof Cookie;\n\tvalue: Cookie[keyof Cookie];\n};\n\n\nexport class CookieMiddleware extends ClassMiddleware {\n\tconstructor(options: Options = {}) {\n\t\tsuper();\n\t\t\n\t\tconst {\n\t\t\tpath = \"/cookie\"\n\t\t} = options;\n\t\t\n\t\tthis.listeners = {\n\t\t\tGET: [ [ path, this.#handler ] ]\n\t\t};\n\t\t\n\t}\n\t\n\t#handler: RequestHandler = (request, response) => {\n\t\tconst token = request.querystring;\n\t\t\n\t\tif (token && tokenMap.has(token))\n\t\t\treturn response.writeHead(200, {\n\t\t\t\t\"Content-Type\": \"text/plain; charset=utf-8\",\n\t\t\t\t\"Set-Cookie\": CookieMiddleware.cookify(...getWithTimeout(tokenMap, token)!)\n\t\t\t}).end();\n\t\t\n\t\treturn false;\n\t};\n\t\n\t\n\tstatic make({ name, value, maxAge, expiresAt, domain, path = \"/\", secure = true, httpOnly = true, sameSite = \"Strict\" }: MakeArg) {\n\t\tconst cookie = [ `${name}=${value}` ];\n\t\t\n\t\tif (maxAge !== undefined)\n\t\t\tcookie.push(`Max-Age=${maxAge}`);\n\t\telse if (expiresAt)\n\t\t\tcookie.push(`Max-Age=${Math.round((expiresAt.getTime() - Date.now()) / 1000)}`);\n\t\t\n\t\tif (domain)\n\t\t\tcookie.push(`Domain=${domain}`);\n\t\t\n\t\tif (path)\n\t\t\tcookie.push(`Path=${path}`);\n\t\t\n\t\tif (secure)\n\t\t\tcookie.push(\"Secure\");\n\t\t\n\t\tif (httpOnly)\n\t\t\tcookie.push(\"HttpOnly\");\n\t\t\n\t\tif (sameSite)\n\t\t\tcookie.push(`SameSite=${sameSite}`);\n\t\t\n\t\treturn cookie.join(\"; \");\n\t}\n\t\n\tstatic cookify(cookie: Cookie, options: CookieOptions) {\n\t\treturn Object.entries(cookie).map(([ name, value ]) => this.make({ name, value, ...options }));\n\t}\n\t\n}\n", "import type { Cookie, CookieOptions } from \"./types\";\n\n\nexport const tokenMap = new Map<string, [ cookie: Cookie, options: CookieOptions ]>();\n", "export function parseCookie(cookie: string) {\n\treturn cookie ? cookie.split(/;\\s*/).reduce((object, keyEqValue) => {\n\t\tconst [ key, value ] = keyEqValue.split(/=/);\n\t\t\n\t\ttry {\n\t\t\tobject[key] = JSON.parse(value);\n\t\t} catch {\n\t\t\tobject[key] = value;\n\t\t}\n\t\t\n\t\treturn object;\n\t}, {} as Record<string, unknown>) : {};\n}\n", "import crypto from \"node:crypto\";\nimport type { IncomingMessage } from \"node:http\";\nimport { random, setWithTimeout } from \"@nesvet/n\";\nimport type { AbilitiesSchema } from \"insite-common\";\nimport type { UsersServer, WSSCWithUser } from \"insite-users-server-ws\";\nimport { headers } from \"../common\";\nimport { parseCookie } from \"./parse\";\nimport { tokenMap } from \"./tokenMap\";\nimport type { Cookie, CookieOptions } from \"./types\";\n\n\nconst cookieTokenTimeout = 2000;\n\nexport type Options<AS extends AbilitiesSchema> = {\n\tusersServer: UsersServer<AS>;\n\tdomain?: string;\n\tmaxAge?: number;\n};\n\n\nexport class CookieSetter<AS extends AbilitiesSchema> {\n\tconstructor({ usersServer, domain, maxAge }: Options<AS>) {\n\t\tthis.usersServer = usersServer;\n\t\tthis.domain = domain ?? process.env.INSITE_HOST;\n\t\tthis.maxAge = maxAge ?? this.usersServer.users.sessions.collection.expireAfterSeconds;\n\t\t\n\t\tthis.usersServer.wss.on(\"client-connect\", this.#handleClientConnect);\n\t\tthis.usersServer.wss.on(\"client-session\", this.#handleClientSession);\n\t\t\n\t}\n\t\n\t#wsSessionIdMap = new WeakMap<WSSCWithUser<AS>, string | null>();\n\t\n\tusersServer;\n\tdomain;\n\tmaxAge;\n\t\n\tset(wssc: WSSCWithUser<AS>, cookie: Cookie, options: CookieOptions) {\n\t\t\n\t\tconst token = `${Math.round(performance.now() * Number.MAX_SAFE_INTEGER).toString(36)}$${crypto.randomBytes(random(4, 8)).toString(\"hex\")}`;\n\t\t\n\t\tsetWithTimeout(tokenMap, token, [ cookie, options ], cookieTokenTimeout);\n\t\t\n\t\twssc.sendMessage(headers.set, token);\n\t\t\n\t}\n\t\n\tunset(wssc: WSSCWithUser<AS>, names: string[]) {\n\t\tthis.set(wssc, names.reduce((cookie, name) => {\n\t\t\tcookie[name] = \"\";\n\t\t\t\n\t\t\treturn cookie;\n\t\t}, {} as Cookie), { domain: this.domain, maxAge: 0 });\n\t\t\n\t}\n\t\n\t#handleClientConnect = (wssc: WSSCWithUser<AS>, request: IncomingMessage) => {\n\t\tthis.#wsSessionIdMap.set(wssc, null);\n\t\t\n\t\tif (request.headers.cookie) {\n\t\t\tconst { sessionId = null } = parseCookie(request.headers.cookie) as { sessionId: string | null };\n\t\t\t\n\t\t\tthis.#wsSessionIdMap.set(wssc, sessionId);\n\t\t\t\n\t\t\tif (sessionId)\n\t\t\t\tthis.usersServer.setSession(wssc, sessionId, true);\n\t\t}\n\t\t\n\t};\n\t\n\t#handleClientSession = (wssc: WSSCWithUser<AS>) => {\n\t\tif (this.#wsSessionIdMap.get(wssc) !== wssc.session?._id) {\n\t\t\tthis.#wsSessionIdMap.set(wssc, wssc.session?._id ?? null);\n\t\t\t\n\t\t\tif (wssc.isOpen && wssc.session)\n\t\t\t\tthis.set(wssc, { sessionId: wssc.session._id }, { domain: this.domain, maxAge: this.maxAge });\n\t\t\telse\n\t\t\t\tthis.unset(wssc, [ \"sessionId\" ]);\n\t\t}\n\t\t\n\t};\n\t\n\t\n\tstatic parse = parseCookie;\n\t\n}\n", "export const headers = {\n\tset: \"~setcookie\"\n};\n\nexport type Method = \"GET\" | \"POST\";\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../src/server/Middleware.ts", "../../src/server/tokenMap.ts", "../../src/server/parse.ts", "../../src/server/Setter.ts", "../../src/common.ts"],
|
|
4
|
+
"sourcesContent": ["import { getWithTimeout } from \"@nesvet/n\";\nimport { ClassMiddleware, type RequestHandler } from \"insite-http\";\nimport { tokenMap } from \"./tokenMap\";\nimport type { Cookie, CookieOptions } from \"./types\";\n\n\ntype Options = {\n\tpath?: RegExp | string;\n};\n\nexport type { Options as CookieMiddlewareOptions };\n\ntype MakeArg = CookieOptions & {\n\tname: keyof Cookie;\n\tvalue: Cookie[keyof Cookie];\n};\n\n\nexport class CookieMiddleware extends ClassMiddleware {\n\tconstructor(options: Options = {}) {\n\t\tsuper();\n\t\t\n\t\tconst {\n\t\t\tpath = \"/cookie\"\n\t\t} = options;\n\t\t\n\t\tthis.listeners = {\n\t\t\tGET: [ [ path, this.#handler ] ]\n\t\t};\n\t\t\n\t}\n\t\n\t#handler: RequestHandler = (request, response) => {\n\t\tconst token = request.querystring;\n\t\t\n\t\tif (token && tokenMap.has(token))\n\t\t\treturn response.writeHead(200, {\n\t\t\t\t\"Content-Type\": \"text/plain; charset=utf-8\",\n\t\t\t\t\"Set-Cookie\": CookieMiddleware.cookify(...getWithTimeout(tokenMap, token)!)\n\t\t\t}).end();\n\t\t\n\t\treturn false;\n\t};\n\t\n\t\n\tstatic make({ name, value, maxAge, expiresAt, domain, path = \"/\", secure = true, httpOnly = true, sameSite = \"Strict\" }: MakeArg) {\n\t\tconst cookie = [ `${name}=${value}` ];\n\t\t\n\t\tif (maxAge !== undefined)\n\t\t\tcookie.push(`Max-Age=${maxAge}`);\n\t\telse if (expiresAt)\n\t\t\tcookie.push(`Max-Age=${Math.round((expiresAt.getTime() - Date.now()) / 1000)}`);\n\t\t\n\t\tif (domain)\n\t\t\tcookie.push(`Domain=${domain}`);\n\t\t\n\t\tif (path)\n\t\t\tcookie.push(`Path=${path}`);\n\t\t\n\t\tif (secure)\n\t\t\tcookie.push(\"Secure\");\n\t\t\n\t\tif (httpOnly)\n\t\t\tcookie.push(\"HttpOnly\");\n\t\t\n\t\tif (sameSite)\n\t\t\tcookie.push(`SameSite=${sameSite}`);\n\t\t\n\t\treturn cookie.join(\"; \");\n\t}\n\t\n\tstatic cookify(cookie: Cookie, options: CookieOptions) {\n\t\treturn Object.entries(cookie).map(([ name, value ]) => this.make({ name, value, ...options }));\n\t}\n\t\n}\n", "import type { Cookie, CookieOptions } from \"./types\";\n\n\nexport const tokenMap = new Map<string, [ cookie: Cookie, options: CookieOptions ]>();\n", "export function parseCookie(cookie: string) {\n\treturn cookie ? cookie.split(/;\\s*/).reduce((object, keyEqValue) => {\n\t\tconst [ key, value ] = keyEqValue.split(/=/);\n\t\t\n\t\ttry {\n\t\t\tobject[key] = JSON.parse(value);\n\t\t} catch {\n\t\t\tobject[key] = value;\n\t\t}\n\t\t\n\t\treturn object;\n\t}, {} as Record<string, unknown>) : {};\n}\n", "import crypto from \"node:crypto\";\nimport type { IncomingMessage } from \"node:http\";\nimport { random, setWithTimeout } from \"@nesvet/n\";\nimport type { AbilitiesSchema } from \"insite-common\";\nimport type { UsersServer, WSSCWithUser } from \"insite-users-server-ws\";\nimport { headers } from \"../common\";\nimport { parseCookie } from \"./parse\";\nimport { tokenMap } from \"./tokenMap\";\nimport type { Cookie, CookieOptions } from \"./types\";\n\n\nconst cookieTokenTimeout = 2000;\n\nexport type Options<AS extends AbilitiesSchema> = {\n\tusersServer: UsersServer<AS>;\n\tdomain?: string;\n\tmaxAge?: number;\n};\n\n\nexport class CookieSetter<AS extends AbilitiesSchema> {\n\tconstructor({ usersServer, domain, maxAge }: Options<AS>) {\n\t\tthis.usersServer = usersServer;\n\t\tthis.domain = domain ?? process.env.INSITE_HOST;\n\t\tthis.maxAge = maxAge ?? this.usersServer.users.sessions.collection.expireAfterSeconds;\n\t\t\n\t\tthis.usersServer.wss.on(\"client-connect\", this.#handleClientConnect);\n\t\tthis.usersServer.wss.on(\"client-session\", this.#handleClientSession);\n\t\t\n\t}\n\t\n\t#wsSessionIdMap = new WeakMap<WSSCWithUser<AS>, string | null>();\n\t\n\tusersServer;\n\tdomain;\n\tmaxAge;\n\t\n\tset(wssc: WSSCWithUser<AS>, cookie: Cookie, options: CookieOptions) {\n\t\t\n\t\tconst token = `${Math.round(performance.now() * Number.MAX_SAFE_INTEGER).toString(36)}$${crypto.randomBytes(random(4, 8)).toString(\"hex\")}`;\n\t\t\n\t\tsetWithTimeout(tokenMap, token, [ cookie, options ], cookieTokenTimeout);\n\t\t\n\t\twssc.sendMessage(headers.set, token);\n\t\t\n\t}\n\t\n\tunset(wssc: WSSCWithUser<AS>, names: string[]) {\n\t\tthis.set(wssc, names.reduce((cookie, name) => {\n\t\t\tcookie[name] = \"\";\n\t\t\t\n\t\t\treturn cookie;\n\t\t}, {} as Cookie), { domain: this.domain, maxAge: 0 });\n\t\t\n\t}\n\t\n\t#handleClientConnect = (wssc: WSSCWithUser<AS>, request: IncomingMessage) => {\n\t\tthis.#wsSessionIdMap.set(wssc, null);\n\t\t\n\t\tif (request.headers.cookie) {\n\t\t\tconst { sessionId = null } = parseCookie(request.headers.cookie) as { sessionId: string | null };\n\t\t\t\n\t\t\tthis.#wsSessionIdMap.set(wssc, sessionId);\n\t\t\t\n\t\t\tif (sessionId)\n\t\t\t\tthis.usersServer.setSession(wssc, sessionId, true);\n\t\t}\n\t\t\n\t};\n\t\n\t#handleClientSession = (wssc: WSSCWithUser<AS>) => {\n\t\tif (this.#wsSessionIdMap.get(wssc) !== wssc.session?._id) {\n\t\t\tthis.#wsSessionIdMap.set(wssc, wssc.session?._id ?? null);\n\t\t\t\n\t\t\tif (wssc.isOpen && wssc.session)\n\t\t\t\tthis.set(wssc, { sessionId: wssc.session._id }, { domain: this.domain, maxAge: this.maxAge });\n\t\t\telse\n\t\t\t\tthis.unset(wssc, [ \"sessionId\" ]);\n\t\t}\n\t\t\n\t};\n\t\n\t\n\tstatic parse = parseCookie;\n\t\n}\n", "export const headers = {\n\tset: \"~setcookie\"\n};\n\nexport type Method = \"GET\" | \"POST\";\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["getWithTimeout", "ClassMiddleware", "tokenMap", "CookieMiddleware", "_CookieMiddleware", "ClassMiddleware", "options", "path", "#handler", "request", "response", "token", "tokenMap", "getWithTimeout", "name", "value", "maxAge", "expiresAt", "domain", "secure", "httpOnly", "sameSite", "cookie", "parseCookie", "cookie", "object", "keyEqValue", "key", "value", "crypto", "random", "setWithTimeout", "headers", "cookieTokenTimeout", "CookieSetter", "usersServer", "domain", "maxAge", "#handleClientConnect", "#handleClientSession", "#wsSessionIdMap", "wssc", "cookie", "options", "token", "crypto", "random", "setWithTimeout", "tokenMap", "headers", "names", "name", "request", "sessionId", "parseCookie"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,44 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
2
|
+
"name": "insite-cookie",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "Cookie-based auth for inSite (client + server)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"insite",
|
|
7
|
+
"cookie",
|
|
8
|
+
"auth",
|
|
9
|
+
"session"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/nesvet/insite#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nesvet/insite/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/nesvet/insite.git",
|
|
18
|
+
"directory": "packages/cookie"
|
|
19
|
+
},
|
|
20
|
+
"funding": {
|
|
21
|
+
"type": "patreon",
|
|
22
|
+
"url": "https://www.patreon.com/nesvet"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
"./server": "./dist/server/index.js",
|
|
29
|
+
"./client": "./dist/client/index.js"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/server.js",
|
|
32
|
+
"module": "./dist/server.js",
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "bun .conveyer.js",
|
|
40
|
+
"postbuild": "tsc -p .",
|
|
41
|
+
"clean": "rm -rf dist",
|
|
42
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@nesvet/n": "^1.2.1",
|
|
47
|
+
"insite-common": "^2.4.0",
|
|
48
|
+
"insite-http": "^2.4.0",
|
|
49
|
+
"insite-users-server-ws": "^2.4.0",
|
|
50
|
+
"insite-ws": "^2.4.0"
|
|
51
|
+
},
|
|
52
|
+
"packageManager": "bun@1.3.9",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20.0.0"
|
|
55
|
+
}
|
|
44
56
|
}
|