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

eigensparse-sdk

v1.0.1

Published

Eigensparse Consent Management SDK - DPDP Act & GDPR Compliant

Readme

Eigensparse SDK

Consent Management for the Modern Web

npm version License: MIT DPDP Compliant GDPR Compliant

Documentation · Dashboard · Report Bug


Overview

Eigensparse SDK enables developers to integrate privacy-first consent management into any application. Built for compliance with DPDP Act 2023 (India) and GDPR (EU).

Why Eigensparse?

  • Legal Compliance — Stay compliant with Indian and EU data protection laws
  • Cryptographic Receipts — SHA-256 signed consent receipts for audit trails
  • Simple Integration — Add consent checks with just a few lines of code
  • Purpose Binding — Granular control over data processing purposes
  • Works Everywhere — Browser, Node.js, and any JavaScript environment

Installation

npm install eigensparse-sdk

Or via CDN:

<script src="https://unpkg.com/eigensparse-sdk/dist/eigensparse.min.js"></script>

Quick Start

1. Get Your API Key

Sign up at eigensparse.com as a Data Fiduciary and get your API key from the dashboard.

2. Initialize the Client

const Eigensparse = require('eigensparse-sdk');

const client = Eigensparse.createClient({
  baseUrl: 'https://eigensparse-api.onrender.com/api',
  apiKey: 'your-api-key'
});

3. Check Consent Before Processing Data

async function processUserData(userEmail) {
  const hasConsent = await client.hasConsent(userEmail, 'marketing-purpose-uuid');

  if (!hasConsent) {
    throw new Error('User consent required for this operation');
  }

  // Safe to process user data
}

Usage Examples

Browser Integration

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/eigensparse-sdk/dist/eigensparse.min.js"></script>
</head>
<body>
  <div id="consent-widget"></div>

  <script>
    const client = Eigensparse.createClient({
      baseUrl: 'https://eigensparse-api.onrender.com/api',
      apiKey: 'your-api-key'
    });

    // Check if user has consented
    async function checkAndShowWidget(userEmail) {
      const hasConsent = await client.hasConsent(userEmail, 'analytics-uuid');

      if (!hasConsent) {
        // Show consent widget
        client.renderWidget('#consent-widget', {
          theme: 'light',
          onConsent: (purposeIds) => {
            console.log('User consented to:', purposeIds);
            location.reload();
          }
        });
      }
    }
  </script>
</body>
</html>

Express.js Middleware

const express = require('express');
const Eigensparse = require('eigensparse-sdk');

const app = express();
const client = Eigensparse.createClient({
  baseUrl: process.env.EIGENSPARSE_URL,
  apiKey: process.env.EIGENSPARSE_API_KEY
});

// Middleware to require consent
function requireConsent(purposeUuid) {
  return async (req, res, next) => {
    try {
      const hasConsent = await client.hasConsent(req.user.email, purposeUuid);

      if (!hasConsent) {
        return res.status(403).json({
          error: 'Consent required',
          purpose_uuid: purposeUuid,
          consent_url: 'https://eigensparse.com/consent'
        });
      }

      next();
    } catch (error) {
      next(error);
    }
  };
}

// Protected route - requires marketing consent
app.get('/api/recommendations', requireConsent('marketing-uuid'), (req, res) => {
  res.json({ recommendations: [...] });
});

// Protected route - requires analytics consent
app.post('/api/track', requireConsent('analytics-uuid'), (req, res) => {
  // Track user behavior
});

React Hook Example

import { useState, useEffect } from 'react';
import Eigensparse from 'eigensparse-sdk';

const client = Eigensparse.createClient({
  baseUrl: process.env.REACT_APP_EIGENSPARSE_URL,
  apiKey: process.env.REACT_APP_EIGENSPARSE_KEY
});

function useConsent(userEmail, purposeUuid) {
  const [hasConsent, setHasConsent] = useState(null);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    client.hasConsent(userEmail, purposeUuid)
      .then(setHasConsent)
      .catch(() => setHasConsent(false))
      .finally(() => setLoading(false));
  }, [userEmail, purposeUuid]);

  return { hasConsent, loading };
}

// Usage
function MarketingBanner({ userEmail }) {
  const { hasConsent, loading } = useConsent(userEmail, 'marketing-uuid');

  if (loading) return <Spinner />;
  if (!hasConsent) return <ConsentRequest />;

  return <PersonalizedBanner />;
}

API Reference

Initialization

const client = Eigensparse.createClient(config);

| Option | Type | Required | Description | |--------|------|----------|-------------| | baseUrl | string | Yes | Eigensparse API URL | | apiKey | string | Yes | Your Data Fiduciary API key | | debug | boolean | No | Enable debug logging |


Consent Methods

checkConsent(email)

Get full consent status for a user.

const status = await client.checkConsent('[email protected]');
// Returns: { has_consent: true, consents: [...] }

hasConsent(email, purposeUuid)

Check if user has consented to a specific purpose.

const allowed = await client.hasConsent('[email protected]', 'purpose-uuid');
// Returns: true | false

getUserConsents(email)

Get all consents for a user.

const consents = await client.getUserConsents('[email protected]');
// Returns: Array of consent objects

Purpose Methods

getPurposes()

Get all purposes defined by your organization.

const purposes = await client.getPurposes();

createPurpose(data)

Create a new data processing purpose.

const purpose = await client.createPurpose({
  name: 'Marketing Analytics',
  description: 'Track user behavior for personalized marketing',
  data_categories: ['Usage Data', 'Device Info'],
  retention_period_days: 365,
  legal_basis: 'consent',
  is_mandatory: false
});

UI Components

renderWidget(selector, options)

Render a consent management widget.

client.renderWidget('#container', {
  theme: 'light',      // 'light' | 'dark'
  locale: 'en',        // 'en' | 'hi'
  onConsent: (ids) => console.log('Consented:', ids),
  onDeny: () => console.log('Denied')
});

showBanner(options) / hideBanner()

Show or hide a consent banner.

client.showBanner({
  onAccept: () => console.log('Accepted'),
  onManage: () => client.renderWidget('#modal')
});

Legal Basis Options

| Value | Use Case | |-------|----------| | consent | User explicitly agrees (marketing, analytics) | | contract | Required to deliver a service | | legal_obligation | Required by law (tax records) | | vital_interests | Protect someone's life | | public_task | Government/public authority | | legitimate_interests | Business necessity (fraud prevention) |


Error Handling

try {
  await client.checkConsent('[email protected]');
} catch (error) {
  if (error instanceof Eigensparse.EigensparseError) {
    console.error('Eigensparse Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Error Code:', error.code);
  }
}

TypeScript Support

Full TypeScript definitions are included.

import Eigensparse, {
  EigensparseClient,
  ConsentStatus,
  Purpose
} from 'eigensparse-sdk';

const client: EigensparseClient = Eigensparse.createClient({
  baseUrl: 'https://eigensparse-api.onrender.com/api',
  apiKey: 'your-api-key'
});

const status: ConsentStatus = await client.checkConsent('[email protected]');
const purposes: Purpose[] = await client.getPurposes();

Resources


License

MIT © Ni8crawler18