dbsc-toolkit 2.9.10 → 2.9.12
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 +30 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,12 @@ The cookie copies fine. The key doesn't — it never left the user's device. So
|
|
|
56
56
|
|
|
57
57
|
Chromium 145+ lands on `tier: "dbsc"` (TPM-backed); Firefox/Safari land on `tier: "bound"` (Web Crypto polyfill). Same guard either way.
|
|
58
58
|
|
|
59
|
+
## Why DBSC Toolkit exists
|
|
60
|
+
|
|
61
|
+
Native DBSC currently ships only on Chromium-based browsers. That leaves Firefox, Safari, mobile, and older Chromium users on plain cookies — defeating the point if you're trying to stop cookie theft across your whole user base.
|
|
62
|
+
|
|
63
|
+
DBSC Toolkit extends device-bound sessions to those browsers through a Web Crypto polyfill, so every user gets the same per-request guard. Today it's one of the few open-source implementations providing cross-browser DBSC-style protection for Node.js.
|
|
64
|
+
|
|
59
65
|
## Install
|
|
60
66
|
|
|
61
67
|
```sh
|
|
@@ -69,6 +75,18 @@ npm install express ioredis # Express + Redis
|
|
|
69
75
|
npm install fastify @fastify/cookie pg # Fastify + Postgres
|
|
70
76
|
```
|
|
71
77
|
|
|
78
|
+
## Integration in 3 lines
|
|
79
|
+
|
|
80
|
+
Drop into an existing Express app — no rewrite of your login or session store:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const dbsc = createDbsc({ storage }); // 1. configure once
|
|
84
|
+
dbsc.install(app); // 2. mount protocol routes + SDK
|
|
85
|
+
await dbsc.bind(res, sessionId, { userId }); // 3. bind, in your login route
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Then guard sensitive routes with `requireProof()`. The full picture:
|
|
89
|
+
|
|
72
90
|
## Quick start
|
|
73
91
|
|
|
74
92
|
```ts
|
|
@@ -120,7 +138,7 @@ Complete raw-`http` example: [docs/adapters.md](./docs/adapters.md#writing-your-
|
|
|
120
138
|
|
|
121
139
|
## How it compares
|
|
122
140
|
|
|
123
|
-
| | Plain cookies | JWT (bearer) | Native DBSC (Chrome
|
|
141
|
+
| | Plain cookies | JWT (bearer) | Native DBSC (Chrome 145+) | **dbsc-toolkit** |
|
|
124
142
|
|---|:---:|:---:|:---:|:---:|
|
|
125
143
|
| Replay-resistant (stolen cookie from another device) | ❌ | ❌ | ✅ | ✅ |
|
|
126
144
|
| Works on Chrome / Edge / Brave | ✅ | ✅ | ✅ (TPM) | ✅ |
|
|
@@ -169,11 +187,18 @@ Every session carries a `tier`. You don't gate on it directly — `requireProof(
|
|
|
169
187
|
| [`@dbsc-toolkit/better-auth`](./packages/better-auth/) | First-class [Better Auth](https://better-auth.com) plugin — binds every sign-in method automatically |
|
|
170
188
|
|
|
171
189
|
```ts
|
|
172
|
-
// Better Auth,
|
|
173
|
-
import { dbsc } from "@dbsc-toolkit/better-auth"
|
|
174
|
-
import { dbscExpress } from "@dbsc-toolkit/better-auth/express" // server.ts → dbscExpress(auth).install(app)
|
|
190
|
+
// Better Auth — one plugin line, works on every framework:
|
|
191
|
+
import { dbsc } from "@dbsc-toolkit/better-auth" // auth.ts → plugins: [dbsc()]
|
|
175
192
|
```
|
|
176
193
|
|
|
194
|
+
## Protocol & spec
|
|
195
|
+
|
|
196
|
+
The wire protocol is documented as a language-neutral spec in [`spec/`](./spec/): header formats, JWS and JSON shapes, the storage and cookie contracts, error codes, and real test vectors. `dbsc-toolkit` is the reference implementation — the spec is what lets a conforming DBSC server be built in any language, not just Node.
|
|
197
|
+
|
|
198
|
+
- [`spec/README.md`](./spec/README.md) — start here
|
|
199
|
+
- [`spec/02-native-protocol.md`](./spec/02-native-protocol.md) — the native Chromium flow on the wire
|
|
200
|
+
- [`spec/09-conformance.md`](./spec/09-conformance.md) — what "conforming" means and how to verify it
|
|
201
|
+
|
|
177
202
|
## Roadmap
|
|
178
203
|
|
|
179
204
|
- [x] Express, Fastify, Hono, Next.js adapters
|
|
@@ -187,10 +212,6 @@ import { dbscExpress } from "@dbsc-toolkit/better-auth/express" // server.ts
|
|
|
187
212
|
- [ ] Third-party security audit
|
|
188
213
|
- [ ] WebAuthn step-up integration
|
|
189
214
|
|
|
190
|
-
## Used by
|
|
191
|
-
|
|
192
|
-
Using DBSC Toolkit in production? Open a PR and add your project here.
|
|
193
|
-
|
|
194
215
|
## Subpath imports
|
|
195
216
|
|
|
196
217
|
| Import | What it is |
|
|
@@ -215,7 +236,7 @@ Using DBSC Toolkit in production? Open a PR and add your project here.
|
|
|
215
236
|
|
|
216
237
|
## Status
|
|
217
238
|
|
|
218
|
-
Verified end-to-end on Chrome 147 / Windows / TPM 2.0. Native DBSC requires Chromium
|
|
239
|
+
Verified end-to-end on Chrome 147 / Windows / TPM 2.0. Native DBSC requires Chromium 145+ on Windows or Apple Silicon macOS; the polyfill covers every browser with Web Crypto + IndexedDB. No third-party security audit yet — see [HOW-IT-WORKS.md#production-readiness](./HOW-IT-WORKS.md#production-readiness).
|
|
219
240
|
|
|
220
241
|
## License
|
|
221
242
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbsc-toolkit",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.12",
|
|
4
4
|
"description": "Server-side Device Bound Session Credentials (DBSC) for Node.js 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",
|