
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@hyperfrontend/network-protocol
Advanced tools
Production-grade network protocol for secure, real-time cross-window and cross-process communication with built-in encryption, obfuscation, routing, and message queueing.
Production-grade network protocol for secure, real-time cross-window and cross-process communication with built-in encryption, obfuscation, routing, and message queueing.
@hyperfrontend/network-protocol is a comprehensive isomorphic communication framework that provides secure, reliable message passing between browser windows, iframes, Web Workers, and Node.js processes. It implements a multi-layered security protocol combining dynamic key encryption with time-based password rotation, packet obfuscation, and message queueing to ensure confidential, ordered, and resilient communication.
The library features a sophisticated architecture with separate browser and Node.js implementations sharing the same API surface. Messages flow through dedicated processing queues (encryption → serialization → obfuscation for outbound; deobfuscation → deserialization → decryption for inbound) with configurable stop/resume controls. The routing system uses a topic-based pub/sub pattern with dynamic or cached subscription resolution, enabling flexible message distribution across multiple channels.
postMessage) and Node.js (IPC) with platform-specific implementationsjsonschema and to-json-schemaThe protocol implements a functional pipeline architecture where each transformation stage (encryption, serialization, obfuscation) operates independently through dedicated queues. Packets progress through typed transformations: UnencryptedPacket<T> → UnserializedEncryptedPacket → SerializedEncryptedPacket → ObfuscatedPacket (and reverse for inbound). Platform-specific implementations inject dependencies (crypto functions, transport mechanisms) through factory patterns, maintaining pure business logic in the shared lib layer. The v1 protocol uses time-based password generation from @hyperfrontend/cryptography for dynamic encryption keys and obfuscation passwords, refreshing at configurable intervals.
Traditional postMessage or IPC communication sends data in plaintext or with minimal protection, exposing sensitive information to browser extensions, debugging tools, and man-in-the-middle attacks. This library implements defense-in-depth with three security layers: (1) encryption with dynamic, time-rotating keys preventing replay attacks, (2) packet obfuscation making ciphertext unrecognizable as encrypted data, and (3) origin/target validation at protocol level. For applications handling authentication tokens, PII, or proprietary business logic in distributed architectures, this provides production-grade confidentiality without external dependencies on TLS or VPNs.
Micro-frontends, Web Worker architectures, and cross-window communication suffer from message loss and ordering issues when using raw transport mechanisms. The queue-based architecture guarantees message ordering within channels while providing independent stop/resume controls for backpressure management. Validation failures, encryption errors, and routing mismatches are logged and handled without crashing the communication pipeline. This resilience is critical for financial dashboards, real-time collaboration tools, and multi-window trading platforms where message loss causes data inconsistency or user-visible errors.
Building communication systems that work in both browser and Node.js typically requires maintaining separate implementations with different APIs and security models. This library provides identical APIs for both platforms through modular exports (@hyperfrontend/network-protocol/browser/v1 and @hyperfrontend/network-protocol/node/v1), with platform-specific crypto and transport injection. Development teams write channel logic, routing rules, and protocol configurations once, then deploy to browser-to-browser (iframes, popups), browser-to-worker, or Node.js IPC scenarios without code changes. This eliminates cross-platform bugs and accelerates development of Electron apps, server-side rendering systems, or hybrid browser/Node.js architectures.
The protocol uses dependency injection for all security and transport operations, allowing custom encryption algorithms, obfuscation strategies, or transport mechanisms without modifying core protocol logic. Teams can swap AES-GCM for ChaCha20, implement custom key rotation schedules, or integrate hardware security modules through the ProtocolProvider interface. Secondary entry points (/channel, /routing, /security, /queue) enable tree-shaking unused features while composing custom protocols. This modularity is essential for environments with regulatory requirements (HIPAA, GDPR), legacy system integration, or specialized security hardware.
Communication failures in distributed systems are notoriously difficult to debug without proper instrumentation. Every queue, channel, and protocol operation integrates with @hyperfrontend/logging for structured logging with configurable levels and transports. Validation errors include detailed failure reasons via JSON Schema validators. Queue operations track success/failure callbacks enabling metrics collection and dead letter queue patterns. For operations teams managing micro-frontend platforms or multi-process applications, this observability is the difference between hours of debugging and immediate root cause identification.
npm install @hyperfrontend/network-protocol
Note: The
/node/*entry points depend on@hyperfrontend/cryptographywhich useswebcrypto.subtle. This API was experimental in Node.js 18.x. For production use with Node.js entry points, Node.js 19+ is recommended.
import { createProtocol } from '@hyperfrontend/network-protocol/browser/v1'
import { createLogger } from '@hyperfrontend/logging'
// Define send/receive functions for your transport (e.g., postMessage)
const send = (packet: Uint8Array) => {
otherWindow.postMessage(packet, '*')
}
const receive = (handler: (packet: Uint8Array) => void) => {
window.addEventListener('message', (event) => handler(event.data))
}
// Create protocol with logging and key rotation
const logger = createLogger({ level: 'info' })
const createMyProtocol = createProtocol(logger, 60000) // Rotate keys every 60s
// Create a protocol instance
const protocol = createMyProtocol(send, receive)
// Use the protocol for encrypted communication
const unencryptedData = { origin: 'window-a', target: 'window-b', data: { message: 'Hello' } }
const encryptedPacket = await protocol.packetEncryption(unencryptedData)
const obfuscatedPacket = await protocol.packetObfuscation({ ...encryptedPacket, data: 'serialized' })
protocol.send(obfuscatedPacket)
import { createProtocol } from '@hyperfrontend/network-protocol/node/v1'
import { createLogger } from '@hyperfrontend/logging'
// Use Node.js IPC mechanisms
const send = (packet: Uint8Array) => {
process.send!(packet)
}
const receive = (handler: (packet: Uint8Array) => void) => {
process.on('message', handler)
}
const logger = createLogger({ level: 'debug' })
const createMyProtocol = createProtocol(logger, 30000)
const protocol = createMyProtocol(send, receive)
// Same API as browser version
Modular Entry Points (tree-shakeable):
@hyperfrontend/network-protocol/channel - Channel creation, management, and stores@hyperfrontend/network-protocol/routing - Router configuration and topic-based routing@hyperfrontend/network-protocol/security - Security suites (encryption + obfuscation)@hyperfrontend/network-protocol/queue - Message queue creation and management@hyperfrontend/network-protocol/topic - Topic creation and storesPlatform-Specific Protocols:
@hyperfrontend/network-protocol/browser/v1 - V1 protocol with obfuscation-only handshake@hyperfrontend/network-protocol/browser/v2 - V2 protocol with PSK-encrypted handshake@hyperfrontend/network-protocol/node/v1 - Node.js V1 protocol@hyperfrontend/network-protocol/node/v2 - Node.js V2 protocolThe V1 protocol (createObfuscatedHandshakeProtocolFactory) uses time-based obfuscation only for the initial handshake message. During handshake:
This approach is suitable when the transport layer already provides some level of security or when PSK distribution is not feasible.
import { createProtocol } from '@hyperfrontend/network-protocol/browser/v1'
// createProtocol is an alias for createObfuscatedHandshakeProtocolFactory
The V2 protocol (createPSKHandshakeProtocolFactory) adds a Pre-Shared Key (PSK) layer for securing the initial handshake:
This provides defense-in-depth during handshake, protecting the dynamic key exchange from eavesdropping.
import { createProtocol } from '@hyperfrontend/network-protocol/browser/v2'
// createProtocol is an alias for createPSKHandshakeProtocolFactory
// Usage requires a shared key known to both parties
const createMyProtocol = createProtocol(logger, 'my-shared-secret', 60000)
| Use Case | Recommended Protocol |
|---|---|
| TLS-protected transport | V1 (obfuscation-only) |
| Untrusted transport, can share PSK | V2 (PSK handshake) |
| Key exchange protection critical | V2 (PSK handshake) |
| No PSK distribution mechanism | V1 (obfuscation-only) |
Note: Both protocols use dynamic key encryption for all messages after the handshake. The only difference is how the first message (containing the dynamic encryption key) is protected.
Additional Modules:
/browser/data, /node/data - Data transformation utilities/browser/packet, /node/packet - Packet operations (encrypt, decrypt, obfuscate, etc.)/browser/sender, /node/sender - Outbound message handling/browser/receiver, /node/receiver - Inbound message handling/browser/channel, /node/channel - Platform-specific channel implementationsProtocol<T> - Complete protocol implementation with encryption, obfuscation, send/receiveProtocolProvider<T> - Factory function for creating protocol instancesChannel<T> - Named communication channel with queues and routingRouter - Function configuring topic-to-channel subscriptionsTopic - Named message category for routingPacket<T> - Union of all packet types (obfuscated, encrypted, unencrypted)Queue<T> - Message queue with processing and backpressure controlEach module has its own README with purpose, interfaces, factory functions, and usage examples:
| Module | Description | Documentation |
|---|---|---|
| channel/ | Bidirectional communication channels | README |
| packet/ | Packet type hierarchy & transformations | README |
| protocol/ | Protocol composition & v1 implementation | README |
| security/ | Encryption & obfuscation suites | README |
| queue/ | FIFO message processing queues | README |
| sender/ | Outbound message pipeline | README |
| receiver/ | Inbound message pipeline | README |
| data/ | Structured message payloads | README |
| routing/ | Topic-based message routing | README |
| topic/ | Topic store management | README |
Living documentation through executable examples:
channel/channel.integration.spec.ts - Channel composition and bidirectional communicationpacket/packet-transformations.integration.spec.ts - Full packet type transitionspacket/security/encryption.integration.spec.ts - Real encryption/decryption cyclespacket/security/obfuscation.integration.spec.ts - Time-based obfuscation with clock skew handlingsender/sender.integration.spec.ts - Full outbound queue chainreceiver/receiver.integration.spec.ts - Full inbound queue chainsender-receiver.integration.spec.ts - Round-trip message flowsecurity/security-suite.integration.spec.ts - Combined encryption + obfuscationrouting/routing.integration.spec.ts - Topic-based message routingqueue/queue.integration.spec.ts - Queue creation, message flow, stop/resumedata/data.integration.spec.ts - Data creation with real hashing| Platform | Support |
|---|---|
| Browser | ✅ |
| Node.js | ✅ |
| Web Workers | ✅ |
| Deno, Bun, Cloudflare Workers | ✅ |
| Format | File | Tree-Shakeable |
|---|---|---|
| ESM | *.esm.js | ✅ |
| CJS | *.cjs.js | ❌ |
| IIFE | bundle/v1/index.iife.min.js, bundle/v2/index.iife.min.js | ❌ |
| UMD | bundle/v1/index.umd.min.js, bundle/v2/index.umd.min.js | ❌ |
Bundle size: ~66 KB per version (minified, self-contained)
This library provides separate bundles for each protocol version:
<!-- Protocol V2 (recommended) -->
<script src="https://unpkg.com/@hyperfrontend/network-protocol/bundle/v2/index.umd.min.js"></script>
<!-- Protocol V1 -->
<script src="https://unpkg.com/@hyperfrontend/network-protocol/bundle/v1/index.umd.min.js"></script>
<script>
// V2
const { createProtocol } = HyperfrontendNetworkProtocolV2
// V1
const { createProtocol } = HyperfrontendNetworkProtocolV1
</script>
Global variables: HyperfrontendNetworkProtocolV1, HyperfrontendNetworkProtocolV2
This library is part of the hyperfrontend monorepo.
MIT
FAQs
Production-grade network protocol for secure, real-time cross-window and cross-process communication with built-in encryption, obfuscation, routing, and message queueing.
The npm package @hyperfrontend/network-protocol receives a total of 165 weekly downloads. As such, @hyperfrontend/network-protocol popularity was classified as not popular.
We found that @hyperfrontend/network-protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.