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

delta-authentication

v1.0.13

Published

Customizable authentication system with optional encryption.

Downloads

33

Readme

delta-authentication

A customizable authentication system for Node.js with optional encryption and a dynamic user model.

🚀 Installation

Install the package via NPM:

npm install delta-authentication

📌 Automatic Dependency Check

If required packages (express, mongoose, jsonwebtoken) are missing, the package will prompt you to install them automatically.


🔹 Usage

1️⃣ Import and Connect Database

import { connectDB } from "delta-authentication";
connectDB("mongodb://localhost:27017/mydb");

2️⃣ Define a Custom User Model

You can select which fields to include in your schema:

import { createUserModel } from "delta-authentication";

// ✅ Creating different models with custom names
const User = createUserModel("User", ["name", "emailid", "password"]);
const Client = createUserModel("Client", [
  "firstname",
  "emailid",
  "password",
  "phoneno",
]);
const Admin = createUserModel("Admin", [
  "name",
  "emailid",
  "password",
  "address",
]);

Available fields:

  • name
  • firstname
  • middlename
  • lastname
  • emailid (required)
  • password (required)
  • age
  • address
  • phoneno

3️⃣ Set Up Authentication Routes

import { createAuthRoutes } from "delta-authentication";
app.use("/auth", createAuthRoutes(User));

📌 API Endpoints

Signup User

POST /auth/signup

Body:

{
  "name": "John Doe",
  "emailid": "[email protected]",
  "password": "123456"
}

Login User

POST /auth/login

Body:

{
  "emailid": "[email protected]",
  "password": "123456"
}

Response:

{
  "token": "your-jwt-token"
}

🔑 Optional: Enable End-to-End Encryption

By default, only passwords are encrypted. You can enable AES-256 encryption for any field using delta-encrypt-decrypt:

1️⃣ Install the Encryption Package

npm install delta-encrypt-decrypt

2️⃣ Enable Encryption in .env

Set up encryption in your environment variables:

USE_ENCRYPTION=true
SECRET_KEY="Create a 32 character secret key"

3️⃣ Set Up Authentication Routes with Selective Encryption

You can choose which fields to encrypt by passing an array of field names:

import { createAuthRoutes } from "delta-authentication";

app.use(
  "/auth",
  createAuthRoutes(User, {
    encryption: process.env.USE_ENCRYPTION === "true", // Convert string to boolean
    secretKey: process.env.SECRET_KEY, // Provide a 32-character secret key
    encryptFields: ["name", "emailid", "password"], // Select which fields to encrypt
  })
);

🔹 Example: Encrypted Signup Data

If encryptFields = ["name", "emailid", "password"], the stored user data will look like this:

{
  "name": "ENCRYPTED_DATA",
  "emailid": "ENCRYPTED_DATA",
  "password": "ENCRYPTED_DATA",
  "age": 28
}

📜 License

This project is licensed under the MIT License.

💻 Contributing

Feel free to submit issues and pull requests on GitHub.


Happy coding! 🚀