npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dbsc-server

v1.0.1

Published

Server-side toolkit for Device Bound Session Credentials (DBSC)

Readme

dbsc-server

Server-side toolkit for Device Bound Session Credentials (DBSC).

CI License: MIT Types Runtime dependencies

Status: pre-release. The API can change until 1.0.0. Validated against real Chrome and against the shared cross-implementation test vectors.

Why

Infostealer malware steals session cookies and replays them from another machine. TLS, MFA, and passkeys do not stop this: the attacker skips sign-in completely and uses the stolen session.

DBSC closes this gap. The browser creates a private key in secure hardware. The key cannot leave the device. Your server hands out only short-lived cookies. When a cookie expires, the browser proves possession of the device key and gets a fresh cookie. A stolen cookie dies in minutes, and the thief cannot refresh it, because the thief does not have the device key.

dbsc-server implements the server side of this protocol: the headers, the challenges, the proof verification, and the refresh state machine. You keep your own session system and your own cookies. Zero runtime dependencies. Runs on Node.js, Bun, and Deno.

How it works

For the complete lifecycle across the browser, the secure hardware, the server, and the session store, see the end-to-end sequence diagram.

Install

npm install dbsc-server

Quickstart

import { createDbsc, createDbscHandlers, createMemoryStore } from 'dbsc-server';

const dbsc = createDbsc({ store: createMemoryStore(), challenge: { secret: process.env.DBSC_SECRET } });
const { register, refresh } = createDbscHandlers({
  dbsc,
  bindSession: () => ({
    scope: { includeSite: false },
    credentials: [{ name: 'session', attributes: 'Path=/; Secure; HttpOnly; SameSite=Lax' }],
    setCookies: [mintYourSessionCookie()], // short Max-Age; DBSC refreshes it
  }),
});

register and refresh are plain (Request) => Promise<Response> functions. Route them at your two DBSC endpoints, and set the header from await dbsc.registrationHeader() on your sign-in response. That is the whole integration. See the demo server for a complete example in one file.

Framework adapters

| Framework | Import | Recipe | |---|---|---| | Express / node:http | dbsc-server/express | recipe | | Hono | dbsc-server/hono | recipe | | Next.js (App Router) | dbsc-server/next | recipe | | Elysia | dbsc-server/elysia | recipe | | Fastify | dbsc-server/fastify | recipe | | NestJS | dbsc-server/nestjs | recipe | | Auth.js | core | recipe |

The adapters are thin shims over one WHATWG handler layer. The package imports no framework code.

Scope, and how it compares

This package implements the DBSC standard, the whole standard, and nothing else. Some capabilities are absent on purpose:

| Capability | Here? | Why, and where to look instead | |---|---|---| | Native DBSC (registration, 403 refresh, termination, skipped, well-known) | Yes | The whole point. Validated against real Chrome and shared cross-implementation vectors. | | Zero runtime dependencies, Web Crypto only | Yes | Runs unchanged on Node.js, Bun, and Deno. Nothing to audit but this package. | | Software-key fallback for browsers without DBSC | No, on purpose | Not part of the standard, and without secure hardware the binding is a different, weaker property. dbsc-toolkit offers one if you want it. | | DPoP (RFC 9449) for API tokens | No, on purpose | A different layer: DPoP binds bearer tokens, DBSC binds cookies. Use a DPoP library beside this one. | | Shipped storage adapters | No, on purpose | You implement one small interface over your own database. Recipes included. Shipped adapters rot; interfaces do not. |

Related implementations, all cross-validating against the same shared test vectors: dbsc-toolkit (broader scope: polyfills, DPoP, more adapters), dbsc-php (native-only PHP, extracted from Report URI's production deployment), and @1auth/session-dbsc (part of the 1auth framework). Pick by stack and philosophy; interoperability is shared work.

Documentation

Spec version

This package tracks the W3C editor's draft.

| Item | Value | |---|---| | Header names | Second origin trial (Secure-Session-*), the form GA Chrome ships | | Legacy names | Sec-Session-* accepted on inbound requests (configurable) | | Last validated | 2026-08-19, against Chrome with software keys |

Contributing and security

Issues are welcome; the project does not accept unsolicited pull requests. See CONTRIBUTING.md. Report vulnerabilities per SECURITY.md; do not open a public issue.

License

MIT