Skip to main content
Official isomorphic TypeScript SDK for Blursec — answering one question in front of your /login endpoint: “Is this credential already in the wild?”

What Blursec does

Most authentication breaches don’t happen because someone “hacked” you. They happen because infostealer malware on a user’s device harvested their saved credentials — for your app and every other platform, SaaS, or provider they use — into a stealer-log database, and an attacker logged in with a perfectly valid username + password. Blursec sits in front of your /login endpoint and answers in under 50 ms from a continuously-updated stealer-log feed. If the credential is compromised, the SDK tells you what to do about it. The SDK exposes four things:
  1. blursec.checkCredential(email, password) — Layer 1. K-anonymity SHA-256 lookup. The raw password never leaves your server.
  2. blursec.verifySession(req) — Layer 2. Extracts a session token from a Request, auto-detects JWT vs opaque, hashes appropriately, and looks it up.
  3. blursec.webhooks.verify(...) — Verify HMAC-signed deliveries when a previously-clean session shows up in a fresh stealer-log batch after login.
  4. dryRun: true — Observe-only mode on any check, so you can stage Blursec into production traffic before enforcing.

Install

Requires Node 18+, a modern browser, Cloudflare Workers, Deno, or Bun. Zero runtime dependencies.

The 4-line login endpoint

That’s the integration. Everything else is detail:

How it works (prefix-blinded lookup)

The SDK never sends the raw password to Blursec:
  1. SDK hashes email + ":" + password with SHA-256 locally → 64-char hex digest.
  2. SDK sends only the first 10 hex characters to the API — one-way, irreversible.
  3. API returns every entry in that bucket; the SDK compares suffixes locally.
Neither the password nor the full hash ever leaves your process. See the full walkthrough in Advanced usage.

Runnable examples

Complete, copy-pasteable integrations live in the examples/ folder on GitHub — Express login endpoint, session validation, Cloudflare Worker, React pre-hash form, strict error handling, and more.

Ecosystem packages