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

@digitaldefiance/eecp-server

v0.1.2

Published

Express + WebSocket server for EECP operation routing

Readme

@digitaldefiance/eecp-server

Express + WebSocket server for zero-knowledge operation routing. Manages workspace lifecycle, participant authentication, encrypted operation broadcasting, rate limiting, and temporal cleanup with Prometheus metrics.

Features

  • REST API for workspace creation, extension, and revocation
  • WebSocket server for real-time operation streaming
  • Zero-knowledge participant authentication
  • Operation routing and buffering for offline participants
  • Rate limiting, audit logging, and Prometheus metrics

Installation

npm install @digitaldefiance/eecp-server
# or
yarn add @digitaldefiance/eecp-server

Quick Start

import { EECPServer } from '@digitaldefiance/eecp-server';

const server = new EECPServer({
  port: 3000,
  host: '0.0.0.0',
  corsOrigins: ['http://localhost:5173'],
  maxWorkspaceDuration: 24 * 60 * 60 * 1000, // 24 hours
  enableMetrics: true,
});

await server.start();
console.log('EECP Server running on port 3000');

REST API Endpoints

Create Workspace

POST /api/workspaces
Content-Type: application/json

{
  "duration": 3600000,
  "maxParticipants": 10
}

Response:
{
  "workspaceId": "550e8400-e29b-41d4-a716-446655440000",
  "masterKey": "base64-encoded-key",
  "expiresAt": "2026-01-01T12:00:00.000Z"
}

Extend Workspace

POST /api/workspaces/:workspaceId/extend
Content-Type: application/json

{
  "additionalDuration": 3600000,
  "masterKey": "base64-encoded-key"
}

Response:
{
  "newExpiresAt": "2026-01-01T13:00:00.000Z"
}

Revoke Workspace

DELETE /api/workspaces/:workspaceId
Content-Type: application/json

{
  "masterKey": "base64-encoded-key"
}

Response:
{
  "success": true
}

Get Workspace Info

GET /api/workspaces/:workspaceId

Response:
{
  "workspaceId": "550e8400-e29b-41d4-a716-446655440000",
  "expiresAt": "2026-01-01T12:00:00.000Z",
  "participantCount": 3,
  "maxParticipants": 10,
  "createdAt": "2026-01-01T11:00:00.000Z"
}

Health Check

GET /health

Response:
{
  "status": "healthy",
  "uptime": 3600,
  "workspaces": 5,
  "connections": 12
}

WebSocket Protocol

Connection

const ws = new WebSocket('ws://localhost:3000');

// Send authentication
ws.send(JSON.stringify({
  type: 'auth',
  workspaceId: 'workspace-id',
  participantId: 'participant-id',
  signature: 'ecdsa-signature',
  publicKey: 'participant-public-key',
}));

Message Types

Operation Message

{
  type: 'operation',
  workspaceId: 'workspace-id',
  operation: {
    id: 'operation-id',
    participantId: 'participant-id',
    timestamp: 1234567890,
    encryptedContent: Uint8Array,
    timeWindow: {
      start: 1234567890,
      end: 1234571490,
    },
  },
}

Sync Request

{
  type: 'sync',
  workspaceId: 'workspace-id',
  since: 1234567890, // timestamp
}

Participant Joined

{
  type: 'participant-joined',
  workspaceId: 'workspace-id',
  participantId: 'participant-id',
}

Participant Left

{
  type: 'participant-left',
  workspaceId: 'workspace-id',
  participantId: 'participant-id',
}

Configuration Options

interface EECPServerConfig {
  // Server settings
  port?: number; // Default: 3000
  host?: string; // Default: '0.0.0.0'
  
  // CORS settings
  corsOrigins?: string[]; // Default: ['*']
  
  // Workspace settings
  maxWorkspaceDuration?: number; // Default: 24 hours
  defaultWorkspaceDuration?: number; // Default: 1 hour
  maxParticipants?: number; // Default: 100
  
  // Rate limiting
  rateLimit?: {
    windowMs: number; // Default: 60000 (1 minute)
    maxRequests: number; // Default: 100
  };
  
  // Metrics
  enableMetrics?: boolean; // Default: true
  metricsPort?: number; // Default: 9090
  
  // Logging
  logLevel?: 'debug' | 'info' | 'warn' | 'error'; // Default: 'info'
  enableAuditLog?: boolean; // Default: true
}

Prometheus Metrics

The server exposes Prometheus metrics on /metrics (default port 9090):

  • eecp_workspaces_total - Total number of workspaces
  • eecp_workspaces_active - Currently active workspaces
  • eecp_participants_total - Total number of participants
  • eecp_participants_connected - Currently connected participants
  • eecp_operations_total - Total operations processed
  • eecp_operations_rate - Operations per second
  • eecp_websocket_connections - Active WebSocket connections
  • eecp_http_requests_total - Total HTTP requests
  • eecp_http_request_duration_seconds - HTTP request duration

Zero-Knowledge Architecture

The server implements zero-knowledge operation routing:

  1. No plaintext access: Server never sees unencrypted content
  2. Participant authentication: ECDSA signatures verify identity without revealing keys
  3. Operation routing: Server routes encrypted operations without decryption
  4. Temporal cleanup: Expired workspaces are automatically deleted
  5. Audit logging: All operations logged without exposing content

Rate Limiting

Built-in rate limiting protects against abuse:

  • Per-IP rate limiting for REST API
  • Per-participant rate limiting for WebSocket operations
  • Configurable windows and thresholds
  • Automatic cleanup of rate limit data

Testing

The package includes 200+ tests covering:

  • REST API endpoints
  • WebSocket protocol
  • Workspace lifecycle
  • Participant authentication
  • Operation routing
  • Rate limiting
  • Metrics collection
  • Error handling

Run tests:

npm test
# or
yarn test

Deployment Example

import { EECPServer } from '@digitaldefiance/eecp-server';

const server = new EECPServer({
  port: parseInt(process.env.PORT || '3000'),
  host: process.env.HOST || '0.0.0.0',
  corsOrigins: process.env.CORS_ORIGINS?.split(',') || ['*'],
  maxWorkspaceDuration: 24 * 60 * 60 * 1000,
  enableMetrics: true,
  metricsPort: 9090,
  logLevel: 'info',
  rateLimit: {
    windowMs: 60000,
    maxRequests: 100,
  },
});

await server.start();

// Graceful shutdown
process.on('SIGTERM', async () => {
  console.log('Shutting down...');
  await server.stop();
  process.exit(0);
});

Technology Stack

  • Express 5 - HTTP server framework
  • WebSocket - Real-time communication
  • Node.js - Runtime environment
  • Prometheus - Metrics and monitoring

Related Packages

License

MIT