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

saltpepperpass-next

v1.0.1

Published

saltpepperpass-next is a Next.js package that securely hashes passwords using bcrypt with customizable salt length, pepper text, and hashing rounds. It enhances password security by salting and peppering before hashing, making it ideal for backend applica

Readme

🧂🔑 saltpepperpass-next

npm version License: MIT

A Next.js package that securely hashes passwords using bcrypt with customizable salt length, pepper text, and hashing rounds. It enhances password security by salting and peppering before hashing, making it ideal for backend applications.

Features

  • Custom salt length configuration
  • Configurable pepper text
  • Adjustable hashing rounds
  • Built on top of battle-tested bcrypt
  • TypeScript support
  • Environment-based configuration
  • Simple API with just two main functions

Installation

npm install saltpepperpass-next

Setup

  1. Create a .env file in your project root with the following variables:
SALTING_TEXT_LENGTH=5  # Length of the random salt string

PEPPER_TEXT=your_pepper_key  # Your secret pepper text

HASHING_ROUNDS=10  # Number of hashing rounds
  1. Import the package:
// Named imports (recommended)
import { generateHash, verifyHash } from "saltpepperpass-next";

// Or using default import
import saltAndPepperPass from "saltpepperpass-next";

// Using CommonJS
const saltAndPepperPass = require("saltpepperpass-next");

Usage

Using Named Imports (Recommended)

import { generateHash, verifyHash } from "saltpepperpass-next";

// Generate hash
const { hash, saltingText } = generateHash("myPassword");

// Verify password
const isValid = verifyHash("myPassword", saltingText, hash);

Using Default Import

import saltAndPepperPass from "saltpepperpass-next";

// Generate a hash
const password = "mySecurePassword123";
const { hash, saltingText } = saltAndPepperPass.generateHash(password);

// Verify a password using stored hash and salt
const isValid = saltAndPepperPass.verifyHash(password, saltingText, hash);

if (isValid) {
  console.log("Password is correct!");
} else {
  console.log("Password is incorrect!");
}

API Reference

generateHash(password: string): HashResult

Generates a hash for the given password using salt and pepper.

Parameters:

  • password (string): The password to hash

Returns:

  • Object with:
    • hash (string): The generated hash
    • saltingText (string): The generated salt

verifyHash(password: string, salt: string, hash: string): boolean

Verifies a password against a stored hash and salt.

Parameters:

  • password (string): The password to verify
  • salt (string): The stored salt
  • hash (string): The stored hash

Returns:

  • boolean: True if the password matches, false otherwise

Types

type TGenerateHashResult = {
  hash: string;
  saltingText: string;
};

type TVerifyHashResult = boolean;

Environment Variables

| Variable | Description | Default | | ------------------- | ---------------------------------- | -------- | | SALTING_TEXT_LENGTH | Length of the random salt string | 5 | | PEPPER_TEXT | Secret pepper text used in hashing | Required | | HASHING_ROUNDS | Number of bcrypt hashing rounds | 10 |

Security Considerations

  • Store both the hash and salt securely in your database
  • Keep your PEPPER_TEXT secret and never expose it
  • Choose an appropriate HASHING_ROUNDS value (higher is more secure but slower)
  • Use environment variables for configuration in production

License

MIT