dbsc-toolkit 2.12.0 → 2.13.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/README.md +11 -10
- package/dist/electron/create-dbsc.d.ts +25 -0
- package/dist/electron/create-dbsc.d.ts.map +1 -0
- package/dist/electron/create-dbsc.js +22 -0
- package/dist/electron/create-dbsc.js.map +1 -0
- package/dist/electron/index.d.ts +30 -0
- package/dist/electron/index.d.ts.map +1 -0
- package/dist/electron/index.js +95 -0
- package/dist/electron/index.js.map +1 -0
- package/dist/electron/require-dpop.d.ts +2 -0
- package/dist/electron/require-dpop.d.ts.map +1 -0
- package/dist/electron/require-dpop.js +3 -0
- package/dist/electron/require-dpop.js.map +1 -0
- package/dist/electron/require-proof.d.ts +2 -0
- package/dist/electron/require-proof.d.ts.map +1 -0
- package/dist/electron/require-proof.js +4 -0
- package/dist/electron/require-proof.js.map +1 -0
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<strong>Stop stolen session cookies from being replayed on another device.</strong><br>
|
|
9
|
-
Device Bound Session Credentials for Node.js — one framework-agnostic core with adapters for Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit and raw <code>node:http</code>, plus a Web Crypto polyfill so every browser is covered, not just Chrome. A language-neutral protocol spec with a Node reference implementation.
|
|
9
|
+
Device Bound Session Credentials for Node.js — one framework-agnostic core with adapters for Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit, Electron and raw <code>node:http</code>, plus a Web Crypto polyfill so every browser is covered, not just Chrome. A language-neutral protocol spec with a Node reference implementation.
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
@@ -120,7 +120,7 @@ Load the polyfill in your HTML so non-Chromium browsers reach `tier: "bound"`:
|
|
|
120
120
|
</script>
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
Full walk-through, failure modes, and migration timeline: **[docs/
|
|
123
|
+
Full walk-through, failure modes, and migration timeline: **[docs/quickstart.md](./docs/quickstart.md)** and **[docs/guide.md](./docs/guide.md)**.
|
|
124
124
|
|
|
125
125
|
### Any framework
|
|
126
126
|
|
|
@@ -135,6 +135,7 @@ The protocol lives in a framework-agnostic core — plain functions plus a `Stor
|
|
|
135
135
|
| NestJS | `dbsc-toolkit/nestjs` |
|
|
136
136
|
| Koa | `dbsc-toolkit/koa` |
|
|
137
137
|
| SvelteKit | `dbsc-toolkit/sveltekit` |
|
|
138
|
+
| Electron (main process) | `dbsc-toolkit/electron` |
|
|
138
139
|
| Any other server (raw `node:http`) | `dbsc-toolkit/node` |
|
|
139
140
|
| [Better Auth](https://better-auth.com) | `@dbsc-toolkit/better-auth` |
|
|
140
141
|
|
|
@@ -213,13 +214,13 @@ const token = signAccessToken({ sub, cnf: { jkt } }); // your JWT lib
|
|
|
213
214
|
app.get("/api/resource", requireDpop({ getBoundJkt }), handler);
|
|
214
215
|
```
|
|
215
216
|
|
|
216
|
-
`requireDpop` is exported from every adapter (Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit, `node:http`). A failed check answers `401` with `WWW-Authenticate: DPoP`. Always pass `getBoundJkt` so the presented token is bound to its key — see [docs/dpop.md](./docs/dpop.md) and [spec/10-dpop.md](./spec/10-dpop.md).
|
|
217
|
+
`requireDpop` is exported from every adapter (Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit, Electron, `node:http`). A failed check answers `401` with `WWW-Authenticate: DPoP`. Always pass `getBoundJkt` so the presented token is bound to its key — see [docs/dpop.md](./docs/dpop.md) and [spec/10-dpop.md](./spec/10-dpop.md).
|
|
217
218
|
|
|
218
219
|
## Ecosystem
|
|
219
220
|
|
|
220
221
|
| Package | What it is |
|
|
221
222
|
|---|---|
|
|
222
|
-
| `dbsc-toolkit` | Core + adapters for Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit & raw `node:http`; memory/Redis/Postgres storage |
|
|
223
|
+
| `dbsc-toolkit` | Core + adapters for Express, Fastify, Hono, Next.js, NestJS, Koa, SvelteKit, Electron & raw `node:http`; memory/Redis/Postgres storage |
|
|
223
224
|
| `dbsc-toolkit/dpop` | Optional DPoP (RFC 9449) — bind bearer/access tokens to a device key |
|
|
224
225
|
| `dbsc-toolkit/client` | Browser SDK + Web Crypto polyfill |
|
|
225
226
|
| [`@dbsc-toolkit/better-auth`](./packages/better-auth/) | First-class [Better Auth](https://better-auth.com) plugin — binds every sign-in method automatically |
|
|
@@ -245,7 +246,7 @@ The wire protocol is documented as a language-neutral spec in [`spec/`](./spec/)
|
|
|
245
246
|
- [x] Per-request proof + body signing + replay cache
|
|
246
247
|
- [x] Multi-subdomain binding (`cookieScope: "site"`)
|
|
247
248
|
- [x] Better Auth plugin
|
|
248
|
-
- [x] NestJS, Koa, SvelteKit & generic `node:http` adapters
|
|
249
|
+
- [x] NestJS, Koa, SvelteKit, Electron & generic `node:http` adapters
|
|
249
250
|
- [x] DPoP (RFC 9449) for bearer-token binding
|
|
250
251
|
- [ ] Bun / Deno native paths
|
|
251
252
|
- [ ] Third-party security audit
|
|
@@ -255,7 +256,7 @@ The wire protocol is documented as a language-neutral spec in [`spec/`](./spec/)
|
|
|
255
256
|
| Import | What it is |
|
|
256
257
|
|---|---|
|
|
257
258
|
| `dbsc-toolkit` | Core: types, crypto, protocol handlers, framework-agnostic |
|
|
258
|
-
| `dbsc-toolkit/express` · `/fastify` · `/hono` · `/nextjs` · `/nestjs` · `/koa` · `/sveltekit` · `/node` | Framework adapters |
|
|
259
|
+
| `dbsc-toolkit/express` · `/fastify` · `/hono` · `/nextjs` · `/nestjs` · `/koa` · `/sveltekit` · `/electron` · `/node` | Framework adapters |
|
|
259
260
|
| `dbsc-toolkit/dpop` | Optional DPoP (RFC 9449) verifier + `requireDpop` per adapter |
|
|
260
261
|
| `dbsc-toolkit/client` | Browser SDK + polyfill |
|
|
261
262
|
| `dbsc-toolkit/storage/{memory,redis,postgres}` | Storage adapters |
|
|
@@ -264,10 +265,10 @@ The wire protocol is documented as a language-neutral spec in [`spec/`](./spec/)
|
|
|
264
265
|
|
|
265
266
|
- **Protocol spec (language-neutral):** [spec/](./spec/) · [conformance](./spec/09-conformance.md) · [test vectors](./spec/vectors)
|
|
266
267
|
- **Concepts & protocol:** [HOW-IT-WORKS.md](./HOW-IT-WORKS.md)
|
|
267
|
-
- **Getting started:** [docs/
|
|
268
|
-
- **Add to an existing app:** [docs/
|
|
269
|
-
- **Per-request signing & replay cache:** [docs/
|
|
270
|
-
- **Bound polyfill wire protocol:** [docs/
|
|
268
|
+
- **Getting started:** [docs/quickstart.md](./docs/quickstart.md)
|
|
269
|
+
- **Add to an existing app:** [docs/guide.md](./docs/guide.md)
|
|
270
|
+
- **Per-request signing & replay cache:** [docs/request-signing.md](./docs/request-signing.md)
|
|
271
|
+
- **Bound polyfill wire protocol:** [docs/polyfill.md](./docs/polyfill.md)
|
|
271
272
|
- **API reference:** [docs/api-reference.md](./docs/api-reference.md)
|
|
272
273
|
- **Adapters (+ build your own):** [docs/adapters.md](./docs/adapters.md)
|
|
273
274
|
- **Storage:** [docs/storage.md](./docs/storage.md) · **Deployment:** [docs/deployment.md](./docs/deployment.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CreateDbscOptions, type DbscKit } from "../node/create-dbsc.js";
|
|
2
|
+
import { type DbscProtocolResult } from "./index.js";
|
|
3
|
+
export type { CreateDbscOptions } from "../node/create-dbsc.js";
|
|
4
|
+
export interface ElectronDbscKit extends DbscKit {
|
|
5
|
+
/**
|
|
6
|
+
* A handler for Electron's `protocol.handle(scheme, handler)`. Pass a Web
|
|
7
|
+
* `Request`, get the `Response` for DBSC protocol routes:
|
|
8
|
+
*
|
|
9
|
+
* protocol.handle("app", (request) => kit.protocolHandler()(request));
|
|
10
|
+
*
|
|
11
|
+
* Non-protocol requests come back as a 404 by default; use
|
|
12
|
+
* `protocolRoute(request)` if you need the resolved session to serve your own
|
|
13
|
+
* routes instead.
|
|
14
|
+
*/
|
|
15
|
+
protocolHandler(): (request: Request) => Promise<Response>;
|
|
16
|
+
/** Lower-level: returns `{ handled, response, session }` so you can branch. */
|
|
17
|
+
protocolRoute(request: Request): Promise<DbscProtocolResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds a DBSC kit for an Electron main process. Everything the raw-http kit
|
|
21
|
+
* offers (`handler`, `bind`, `requireProof`, `requireDpop`, `getSession`) plus a
|
|
22
|
+
* `protocol.handle`-shaped surface so the routes mount on an Electron scheme.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createElectronDbsc(opts: CreateDbscOptions): ElectronDbscKit;
|
|
25
|
+
//# sourceMappingURL=create-dbsc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dbsc.d.ts","sourceRoot":"","sources":["../../src/electron/create-dbsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEzE,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C;;;;;;;;;OASG;IACH,eAAe,IAAI,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,eAAe,CAa3E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createDbsc as createNodeDbsc, } from "../node/create-dbsc.js";
|
|
2
|
+
import { handleDbscProtocol } from "./index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds a DBSC kit for an Electron main process. Everything the raw-http kit
|
|
5
|
+
* offers (`handler`, `bind`, `requireProof`, `requireDpop`, `getSession`) plus a
|
|
6
|
+
* `protocol.handle`-shaped surface so the routes mount on an Electron scheme.
|
|
7
|
+
*/
|
|
8
|
+
export function createElectronDbsc(opts) {
|
|
9
|
+
const kit = createNodeDbsc(opts);
|
|
10
|
+
const handler = kit.handler();
|
|
11
|
+
return {
|
|
12
|
+
...kit,
|
|
13
|
+
protocolRoute: (request) => handleDbscProtocol(request, handler),
|
|
14
|
+
protocolHandler: () => async (request) => {
|
|
15
|
+
const { handled, response } = await handleDbscProtocol(request, handler);
|
|
16
|
+
if (handled)
|
|
17
|
+
return response;
|
|
18
|
+
return new Response(null, { status: 404 });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=create-dbsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dbsc.js","sourceRoot":"","sources":["../../src/electron/create-dbsc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,cAAc,GAG7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAA2B,MAAM,YAAY,CAAC;AAoBzE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAuB;IACxD,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAE9B,OAAO;QACL,GAAG,GAAG;QACN,aAAa,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACzE,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAgB,EAAE,EAAE;YAChD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACzE,IAAI,OAAO;gBAAE,OAAO,QAAQ,CAAC;YAC7B,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type DbscNodeHandler, type DbscNodeSession } from "../node/index.js";
|
|
2
|
+
export { dbsc, bindSession, getDbscSession, readJsonBody, createDbsc, DBSC_INTERNAL, } from "../node/index.js";
|
|
3
|
+
export type { DbscNodeHandler, DbscNodeSession, DbscNodeOptions, DbscInternal, BindSessionOptions, } from "../node/index.js";
|
|
4
|
+
export type { CreateDbscOptions, DbscKit, BindOptions } from "../node/create-dbsc.js";
|
|
5
|
+
export { requireProof, type ElectronProofGuard } from "./require-proof.js";
|
|
6
|
+
export { requireDpop, type ElectronDpopGuard } from "./require-dpop.js";
|
|
7
|
+
export { createElectronDbsc, type ElectronDbscKit } from "./create-dbsc.js";
|
|
8
|
+
/**
|
|
9
|
+
* Electron's `protocol.handle(scheme, handler)` hands you a Web `Request` and
|
|
10
|
+
* wants a `Response`. This adapts that shape onto the existing raw-http handler
|
|
11
|
+
* (no protocol logic is duplicated): it builds a minimal request/response shim,
|
|
12
|
+
* runs the node `dbsc()` handler, and converts the captured response back.
|
|
13
|
+
*
|
|
14
|
+
* When the request is a DBSC protocol route the returned `Response` is the answer
|
|
15
|
+
* to send. Otherwise `dbsc()` did not own the route — `handled` is false, the
|
|
16
|
+
* resolved `session` is provided so the caller can branch, and `respondWith`
|
|
17
|
+
* lets a guard write into the same response shim.
|
|
18
|
+
*/
|
|
19
|
+
export interface DbscProtocolResult {
|
|
20
|
+
handled: boolean;
|
|
21
|
+
response: Response;
|
|
22
|
+
session: DbscNodeSession | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Run a configured `dbsc()` handler against an Electron Web `Request`.
|
|
26
|
+
* Use the kit's `protocolHandler()` for the common case; this is the lower-level
|
|
27
|
+
* primitive if you need the resolved session or to chain a guard.
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleDbscProtocol(request: Request, handler: DbscNodeHandler): Promise<DbscProtocolResult>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/electron/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKpG,OAAO,EACL,IAAI,EACJ,WAAW,EACX,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;CACtC;AAkFD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAM7B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { getDbscSession } from "../node/index.js";
|
|
2
|
+
// Re-export the raw-http surface verbatim. In Electron's main process you can run
|
|
3
|
+
// an ordinary localhost http.Server and wire `dbsc()` at the top of the listener
|
|
4
|
+
// exactly as on the node adapter, then read the session with `getDbscSession`.
|
|
5
|
+
export { dbsc, bindSession, getDbscSession, readJsonBody, createDbsc, DBSC_INTERNAL, } from "../node/index.js";
|
|
6
|
+
export { requireProof } from "./require-proof.js";
|
|
7
|
+
export { requireDpop } from "./require-dpop.js";
|
|
8
|
+
export { createElectronDbsc } from "./create-dbsc.js";
|
|
9
|
+
/** Minimal IncomingMessage shim carrying just what the handler + guards read. */
|
|
10
|
+
function makeReq(request, body) {
|
|
11
|
+
const headers = {};
|
|
12
|
+
request.headers.forEach((value, key) => {
|
|
13
|
+
headers[key.toLowerCase()] = value;
|
|
14
|
+
});
|
|
15
|
+
const u = new URL(request.url);
|
|
16
|
+
// host header drives reqUrl/reqOrigin in the node handler; honor it from the URL.
|
|
17
|
+
if (!headers["host"])
|
|
18
|
+
headers["host"] = u.host;
|
|
19
|
+
let consumed = false;
|
|
20
|
+
const req = {
|
|
21
|
+
method: request.method,
|
|
22
|
+
url: u.pathname + u.search,
|
|
23
|
+
headers,
|
|
24
|
+
socket: { remoteAddress: "127.0.0.1", encrypted: u.protocol === "https:" },
|
|
25
|
+
// readJsonBody does `for await (const chunk of req)`; yield the body once.
|
|
26
|
+
async *[Symbol.asyncIterator]() {
|
|
27
|
+
if (consumed)
|
|
28
|
+
return;
|
|
29
|
+
consumed = true;
|
|
30
|
+
if (body.length)
|
|
31
|
+
yield Buffer.from(body);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
return req;
|
|
35
|
+
}
|
|
36
|
+
function makeRes() {
|
|
37
|
+
let statusCode = 200;
|
|
38
|
+
const headers = new Map();
|
|
39
|
+
const chunks = [];
|
|
40
|
+
const key = (n) => n.toLowerCase();
|
|
41
|
+
const res = {
|
|
42
|
+
get statusCode() {
|
|
43
|
+
return statusCode;
|
|
44
|
+
},
|
|
45
|
+
set statusCode(v) {
|
|
46
|
+
statusCode = v;
|
|
47
|
+
},
|
|
48
|
+
setHeader(name, value) {
|
|
49
|
+
headers.set(key(name), Array.isArray(value) ? value.map(String) : String(value));
|
|
50
|
+
},
|
|
51
|
+
getHeader(name) {
|
|
52
|
+
return headers.get(key(name));
|
|
53
|
+
},
|
|
54
|
+
end(chunk) {
|
|
55
|
+
if (chunk !== undefined) {
|
|
56
|
+
chunks.push(typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
function toResponse() {
|
|
61
|
+
const h = new Headers();
|
|
62
|
+
for (const [name, value] of headers) {
|
|
63
|
+
if (name === "set-cookie") {
|
|
64
|
+
const list = Array.isArray(value) ? value : [value];
|
|
65
|
+
for (const c of list)
|
|
66
|
+
h.append("set-cookie", c);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
h.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const total = chunks.reduce((n, c) => n + c.length, 0);
|
|
73
|
+
const body = new Uint8Array(total);
|
|
74
|
+
let off = 0;
|
|
75
|
+
for (const c of chunks) {
|
|
76
|
+
body.set(c, off);
|
|
77
|
+
off += c.length;
|
|
78
|
+
}
|
|
79
|
+
return new Response(total ? body : null, { status: statusCode, headers: h });
|
|
80
|
+
}
|
|
81
|
+
return { res: res, toResponse };
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Run a configured `dbsc()` handler against an Electron Web `Request`.
|
|
85
|
+
* Use the kit's `protocolHandler()` for the common case; this is the lower-level
|
|
86
|
+
* primitive if you need the resolved session or to chain a guard.
|
|
87
|
+
*/
|
|
88
|
+
export async function handleDbscProtocol(request, handler) {
|
|
89
|
+
const raw = new Uint8Array(await request.clone().arrayBuffer());
|
|
90
|
+
const req = makeReq(request, raw);
|
|
91
|
+
const { res, toResponse } = makeRes();
|
|
92
|
+
const handled = await handler(req, res);
|
|
93
|
+
return { handled, response: toResponse(), session: getDbscSession(req) };
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/electron/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,cAAc,EAA8C,MAAM,kBAAkB,CAAC;AAEpG,kFAAkF;AAClF,iFAAiF;AACjF,+EAA+E;AAC/E,OAAO,EACL,IAAI,EACJ,WAAW,EACX,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,YAAY,EAA2B,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAwB,MAAM,kBAAkB,CAAC;AAmB5E,iFAAiF;AACjF,SAAS,OAAO,CAAC,OAAgB,EAAE,IAAgB;IACjD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,kFAAkF;IAClF,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAE/C,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,GAAG,GAAG;QACV,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM;QAC1B,OAAO;QACP,MAAM,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,KAAK,QA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CAAC;IAC/E,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,GAAgC,EAAE,UAAU,EAAE,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAgB,EAChB,OAAwB;IAExB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAChE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-dpop.d.ts","sourceRoot":"","sources":["../../src/electron/require-dpop.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-dpop.js","sourceRoot":"","sources":["../../src/electron/require-dpop.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,WAAW,EAA2C,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-proof.d.ts","sourceRoot":"","sources":["../../src/electron/require-proof.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-proof.js","sourceRoot":"","sources":["../../src/electron/require-proof.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,oEAAoE;AACpE,OAAO,EAAE,YAAY,EAA6C,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbsc-toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Server-side Device Bound Session Credentials (DBSC) for Node.js — Express, Fastify, Hono and Next.js adapters — plus a Web Crypto polyfill for Firefox, Safari, and older Chromium. Cookie-theft protection on every modern browser.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
"import": "./dist/nestjs/index.js",
|
|
44
44
|
"types": "./dist/nestjs/index.d.ts"
|
|
45
45
|
},
|
|
46
|
+
"./electron": {
|
|
47
|
+
"import": "./dist/electron/index.js",
|
|
48
|
+
"types": "./dist/electron/index.d.ts"
|
|
49
|
+
},
|
|
46
50
|
"./dpop": {
|
|
47
51
|
"import": "./dist/dpop/index.js",
|
|
48
52
|
"types": "./dist/dpop/index.d.ts"
|
|
@@ -84,6 +88,7 @@
|
|
|
84
88
|
"@nestjs/common": ">=10.0.0",
|
|
85
89
|
"@nestjs/core": ">=10.0.0",
|
|
86
90
|
"@sveltejs/kit": ">=2.0.0",
|
|
91
|
+
"electron": ">=28.0.0",
|
|
87
92
|
"express": ">=5.0.0",
|
|
88
93
|
"fastify": ">=5.0.0",
|
|
89
94
|
"hono": ">=4.0.0",
|
|
@@ -111,6 +116,9 @@
|
|
|
111
116
|
"@sveltejs/kit": {
|
|
112
117
|
"optional": true
|
|
113
118
|
},
|
|
119
|
+
"electron": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
114
122
|
"hono": {
|
|
115
123
|
"optional": true
|
|
116
124
|
},
|