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

dpdpstack-js-sdk

v0.2.0

Published

Official JavaScript/TypeScript SDK for the DPDPStack API (getdpdp.net) — DPDP Act consent, erasure, audit, DSR/breach workflows, and verifiable Certificates of Erasure.

Readme

dpdpstack-js-sdk

Official JS/TS client for the DPDPStack API — DPDP Act consent, erasure, audit, DSR/breach workflows, and verifiable Certificates of Erasure. Zero runtime dependencies; works in Node 18+ and the browser.

This is the SDK for the hosted platform API. The open-source erasure engine is the Python package dpdpstack.

Install

npm install dpdpstack-js-sdk

Or drop it on a page via CDN (exposes window.dpdpstack):

<script src="https://cdn.jsdelivr.net/npm/dpdpstack-js-sdk/dist/dpdpstack.global.js"></script>

API keys

| Key | Prefix | Use | Capabilities | |---|---|---|---| | Secret | dpdp_sk_… | Server-side only | Full access | | Publishable | dpdp_pk_… | Safe in the browser | Read purposes + record consent only |

A publishable key is the only kind that should ever reach a browser. Set an origin allowlist on it in the dashboard. Some endpoints (certificate verify / registry / public-key) are fully public and need no key.

Quick start (server)

import { DPDPStack, DPDPError } from "dpdpstack-js-sdk";

const dpdp = new DPDPStack({ apiKey: process.env.DPDP_SECRET_KEY }); // dpdp_sk_…

await dpdp.grantConsent({ principal_ref: "user_42", purpose: "marketing" });

const cert = await dpdp.certificates.issue({ principal_ref: "user_42", purpose: "marketing" });
const { valid } = await dpdp.certificates.verify(cert.certificate_jwt);

try {
  await dpdp.requestErasure({ principal_ref: "user_42" });
} catch (err) {
  if (err instanceof DPDPError) console.error(err.status, err.detail);
}

principal_ref is your opaque user id (an internal id or hash) — never an email, name, or other PII.

Consent widget (browser)

import { DPDPStack, mountConsentWidget } from "dpdpstack-js-sdk";

const dpdp = new DPDPStack({ apiBase: "/api/v1", apiKey: "dpdp_pk_…" });

const widget = mountConsentWidget("#consent", {
  client: dpdp,
  principalRef: "user_123",
  locale: "en",                 // notices are shown per-locale, English fallback
  onSave: (receipts) => console.log(receipts),
});

widget.setLocale("hi");         // switch language
widget.destroy();               // remove from the DOM

Purposes are fetched via the API when omitted; pass purposes: [...] to render inline. See examples/browser.html.

Configuration

new DPDPStack({
  apiKey: "dpdp_sk_… | dpdp_pk_…",  // omit for public-only calls
  apiBase: "https://getdpdp.net/api/v1", // default; use "/api/v1" for a same-origin proxy
  fetch: customFetch,                // optional (Node < 18, tests)
  headers: { "X-Trace": "…" },       // sent with every request
  credentials: "include",            // optional fetch credentials mode
});

Every non-2xx response throws a DPDPError with .status, .detail, and .body.

Methods

The SDK mirrors the HTTP API; field names match the wire format exactly.

| Area | Methods | |---|---| | Consent | listPurposes() · createPurpose() · grantConsent() · withdrawConsent() · consentStatus(ref) · listConsentRecords() · recordActivity() | | Erasure | requestErasure() · confirmErasure(token) | | Audit | getAuditLog({ principal_ref? }) · verifyAuditChain() · createAuditCheckpoint({ through_sequence? }) | | Retention | retention.list() · retention.upsert() · retention.run({ dry_run? }) · readiness() · stats() | | Certificates | certificates.issue() · certificates.issueConsent() · certificates.verify(jwt) · certificates.publicKey() · certificates.registry(fp) · certificates.issueFromEvidence() | | Evidence | evidence.ingest() · evidence.list({ source?, subject? }) | | DSR | dsr.list() · dsr.create() · dsr.get(id) · dsr.act(id, { action }) | | Breaches | breaches.list() · breaches.report() · breaches.get(id) · breaches.act(id, { action }) · breaches.notifications(id) | | Targets | targets.list() · targets.create() · targets.get(id) · targets.update(id) · targets.remove(id) | | Erasure tasks | erasureTasks.list() · erasureTasks.retry(id) |

Public (no key): certificates.verify, certificates.registry, certificates.publicKey, confirmErasure.

Build from source

npm install
npm run build      # → dist/ (ESM, CJS, IIFE, .d.ts)
npm run typecheck

License

MIT