dbsc-toolkit cookie session

Device-bound session console

A stolen session cookie pasted into another browser used to work. Here it gets a 403, because the refresh and every guarded request need a signature from a key that never left your device.

Detecting browser… checking storage…

Sign in

Cookie-session mode: express-session issues the id, dbsc.bind() binds it. JWT mode is over here.

Binding tier
awaiting sign-in

After sign-in, the kit binds your session to a device-resident key. The tier shown here tells you which kind.

Polyfill (bound tier)

On by default: non-Chromium browsers get the Web Crypto bound tier. Turn it off to run native-only (bound: false) — then a non-Chromium browser drops to tier: none and requireProof() rejects it, while Chromium still gets native dbsc. Switching re-binds your session, so sign in again if you were signed in.

What it defends against

Only the routes you put requireProof() in front of demand the proof header. Here that's /profile and /payment. Your real app picks its own list (payments, admin actions, password or email change, 2FA enroll). Unguarded routes like /me accept the bare cookie like any normal app.

allow The legit request

Your bound device signs a per-request proof. requireProof() verifies it, then the route runs.

deny The stolen cookie

An attacker exfiltrates the session cookie and pastes it into their browser. They have the cookie. They don't have the key.

deny The tampered body

An MITM sees the signed {amount: 1} and tries to rewrite it to {amount: 1000} mid-flight. The proof signs the body hash too.

deny The replayed request

An attacker captures one valid signed request off the wire and sends it again. The optional replay cache (v2.8+) rejects the second arrival.

DPoP: token binding (RFC 9449)

The same idea applied to bearer tokens instead of cookies. The token is bound to a device key; every API call carries a fresh DPoP proof. A stolen bearer alone proves nothing.

bind Bind a token to this device

Generate a device key in the browser, then sign in. The server issues a bearer token carrying cnf.jkt, the key's thumbprint.

allow Call the API with a proof

Sign a DPoP proof over the method and URL with the device key, send it with the token. requireDpop() verifies both.

deny The stolen bearer token

An attacker exfiltrates the bearer token and replays it with no proof, the way a stolen Authorization header travels today.

Session control

Advanced: config, rate limit, cookie scope

Live demo for dbsc-toolkit. Source on GitHub. This page uses cookie-session login; JWT mode is on a separate page.