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

secureflow-node

v1.0.0

Published

Node.js SDK for SecureFlow API Security & Threat Detection System

Readme

SecureFlow Node.js SDK

The official Node.js Express SDK for integrating SecureFlow - Your Pluggable API Security & Threat Detection System.

Protect your APIs with automated Session Theft detection, Rate Limiting, Brute Force protection, and XSS filtering with a simple plug-and-play middleware.

Installation

npm install secureflow-node

Initialization

Import and initialize the SDK with your Project API Key.

const SecureFlow = require('secureflow-node');

const secureflow = new SecureFlow({
    apiKey: 'YOUR_SECUREFLOW_API_KEY' 
});

API Usage Reference

1. Protecting Routes (Express Middleware)

Protect any Express route by plugging in secureflow.validate(). The middleware automatically blocks requests if the attached Fingerprint triggers a Session-Theft mismatch, Rate Limit violation, or XSS attempt across your SecureFlow deployment.

Note: While making requests to API must pass x-session-id and x-fingerprint in headers (or in req.cookies.sessionId).

const express = require('express');
const app = express();

// Protect a sensitive route
app.get('/api/protected-data', secureflow.validate(), (req, res) => {
    res.json({ data: 'This is highly sensitive data!' });
});

2. Track Successful Logins (Session Binding)

When a user successfully authenticates on your app, report the event to SecureFlow so it can map the device fingerprint to the new session ID.

app.post('/api/login', async (req, res) => {
    const { email, password, fingerprint } = req.body;
    
    // ... Verify password/credentials internally ...
    const sessionId = "a_unique_session_id_generated_by_you";

    try {
        await secureflow.registerLogin(sessionId, fingerprint, email);
        res.json({ success: true, sessionId });
    } catch (error) {
        res.status(500).json({ error: 'Failed to complete login' });
    }
});

3. Track Failed Logins (Brute-Force & Bot Protection)

If a user fails to login, notify SecureFlow to count the failed attempts for that specific device fingerprint. If the threshold is breached, the fingerprint will be locked globally in your application.

app.post('/api/login', async (req, res) => {
    const { email, password, fingerprint } = req.body;
    const isValid = verifyPassword(email, password); // Your logic
    
    if (!isValid) {
        try {
            await secureflow.reportLoginFailure(fingerprint);
            return res.status(401).json({ error: 'Invalid credentials' });
        } catch (error) {
            // Handled locking (e.g. Rate Limit / 423 Locked)
            return res.status(error.response?.status || 500).json({ 
                error: error.response?.data?.message || 'Security lock active' 
            });
        }
    }
});

4. Tracking Logout (Session Unbinding)

Always notify SecureFlow when a user logs out. This invalidates the active sessionId tracking.

app.post('/api/logout', async (req, res) => {
    const sessionId = req.headers['x-session-id'];
    
    try {
      await secureflow.logout(sessionId);
      res.json({ success: true, message: 'Logged out' });
    } catch(err) {
      res.status(500).json({ success: false });
    }
});