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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dsa-middleware-bb

v0.0.1

Published

CommonJs + TypeScript SDK for Data Security Agent Middleware.

Downloads

15

Readme

🧩 DSA Middleware BB

npm version npm downloads license GitHub issues GitHub stars

A lightweight and secure middleware for integrating Data Security Agent (DSA) capabilities into your Node.js or NestJS applications.

DSA (Data Security Agent) is a lightweight, plug-and-play middleware designed to automatically protect sensitive data in your API responses and files before they leave your server.

It intelligently scans and masks sensitive information such as emails, phone numbers, credit card details, and personal identifiers based on your configured agent rules — ensuring data privacy and compliance without changing your application logic.

🔒 Key Features

  • 🧩 Universal Middleware — works with Express, NestJS, and other Node.js frameworks.
  • ⚙️ Plug-and-Play Setup — integrate in seconds with a single app.use() call.
  • 🧠 Smart Detection Engine — masks sensitive information dynamically before sending a response.
  • 📄 Supports Multiple Formats — compatible with JSON, XML, and even DOCX files.
  • 🧾 Custom Rules — define your own masking logic per agent/account for flexible security policies.

🧰 Use Cases

  • ✅ Mask personal data (email, phone, card numbers) before returning API responses.
  • ✅ Sanitize downloadable files like .docx or .xml automatically.
  • ✅ Enforce organization-wide data security rules centrally.

🧱 How It Works

  • The middleware intercepts every HTTP response before it’s sent to the client.
  • It scans response bodies or file buffers for sensitive data patterns.
  • Matches are masked or replaced according to your DSA agent configuration.
  • The cleaned, privacy-safe data is then delivered to the end user.

🚀 Installation

npm install dsa-middleware-bb
# or
yarn add dsa-middleware-bb

⚙️ Usage in Node.js (CommonJS)

const express = require("express");
const { dsaMiddleware } = require("dsa-middleware-bb");

const app = express();

app.use(
  dsaMiddleware({
    accountId: "<YOUR_ACCOUNT_ID>",
    agentId: "<YOUR_AGENT_ID>",
    email: "<YOUR_EMAIL>",
    password: "<YOUR_PASSWORD>",
    debug: true, // optional: logs internal activity
  })
);

app.get("/", (req, res) => {
  res.send("✅ DSA Middleware Active!");
});

app.listen(3000, () => console.log("Server running on http://localhost:3000"));

⚙️ Usage in TypeScript / NestJS

1️⃣ Install

npm install dsa-middleware-bb

2️⃣ Register Middleware in main.ts

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { dsaMiddleware } from "dsa-middleware-bb";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.use(
    dsaMiddleware({
      accountId: "<YOUR_ACCOUNT_ID>",
      agentId: "<YOUR_AGENT_ID>",
      email: "<YOUR_EMAIL>",
      password: "<YOUR_PASSWORD>",
    })
  );

  await app.listen(3000);
  console.log("🚀 NestJS App running on http://localhost:3000");
}

bootstrap();

⚙️ Configuration Options

| Option | Type | Required | Description | | ----------- | --------- | -------- | ------------------------------------------- | | accountId | string | ✅ Yes | Unique account identifier | | agentId | string | ✅ Yes | Registered agent ID | | email | string | ✅ Yes | Login email for agent authentication | | password | string | ✅ Yes | Login password for agent authentication | | debug | boolean | ❌ No | Enables detailed console logs for debugging |


🧠 Middleware Behavior

Once applied, dsaMiddleware will:

  • Secure and hide sesitive information in each response.
  • Information like Card numbers, Mobile numbers, emails, etc.
  • Everything is masked based on defined rules.

🧩 Example Output (Debug Mode)

✅ Agent registration and authentication successful
 > Scheduling Re-Authentication
 > Re-Authentication Scheduled every 3 minutes
 > Report Sync Scheduled every 1 minutes

📦 Latest Version

Version: 0.0.1
(Always check the npm registry for the latest release.)


🧰 Troubleshooting

| Issue | Possible Cause | Solution | | --------------------- | -------------------- | ----------------------------------------------------------------- | | Invalid credentials | Wrong email/password | Verify your credentials | | Unauthorized agent | Invalid agentId | Check your agent registration | | Request blocked | Missing middleware | Ensure app.use(dsaMiddleware(...)) is placed before your routes |


📜 License

MIT © [Your Organization or Name]


💬 Support

For issues, suggestions, or contributions:
👉 Open a GitHub Issue


💡 Pro Tip

Use environment variables to keep your credentials secure:

ACCOUNT_ID=acc_12345
AGENT_ID=agent_56789
[email protected]
AGENT_PASSWORD=supersecret
app.use(
  dsaMiddleware({
    accountId: process.env.ACCOUNT_ID,
    agentId: process.env.AGENT_ID,
    email: process.env.AGENT_EMAIL,
    password: process.env.AGENT_PASSWORD,
  })
);

🧩 Simple. Secure. Smart — That’s DSA Middleware.

📜 Changelog

See full details in CHANGELOG.md