
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@decentralchain/browser-bus
Advanced tools
Cross-window browser communication library for DecentralChain DApps and wallet applications
Cross-window browser communication library for DecentralChain DApps and wallet applications.
Enables secure message passing between browser windows, tabs, and iframes using the postMessage API. Used for DApp-to-wallet communication, transaction signing popups, and multi-tab synchronization.
Part of the DecentralChain SDK.
npm install @decentralchain/browser-bus
Requires Node.js >= 24 and an ESM environment (
"type": "module").
import { Bus, WindowAdapter } from '@decentralchain/browser-bus';
const url = 'https://some-iframe-content-url.com';
const iframe = document.createElement('iframe');
WindowAdapter.createSimpleWindowAdapter(iframe).then((adapter) => {
const bus = new Bus(adapter);
bus.once('ready', () => {
// Received message from iframe
});
});
iframe.src = url;
document.body.appendChild(iframe);
import { Bus, WindowAdapter } from '@decentralchain/browser-bus';
WindowAdapter.createSimpleWindowAdapter().then((adapter) => {
const bus = new Bus(adapter);
bus.dispatchEvent('ready', null);
});
BusCreates a bus instance for sending and receiving events and requests.
Constructor:
adapter — an Adapter instance for the messaging transporttimeout (optional) — default response timeout in milliseconds (default: 5000)dispatchEvent(name, data)Send an event to all connected Bus instances.
bus.dispatchEvent('some-event-name', jsonLikeData);
request(name, data?, timeout?)Send a request and receive a response. Returns a Promise.
const result = await bus.request('some-method', jsonLikeData, 100);
on(name, handler)Subscribe to an event.
bus.on('some-event', (data) => {
// handle event
});
once(name, handler)Subscribe to an event once.
bus.once('some-event', (data) => {
// fires only once
});
off(eventName?, handler?)Unsubscribe from events.
bus.off('some-event', handler); // Unsubscribe specific handler
bus.off('some-event'); // Unsubscribe all from 'some-event'
bus.off(); // Unsubscribe from everything
registerRequestHandler(name, handler)Register a handler for incoming requests.
bus.registerRequestHandler('get-random', () => Math.random());
Handlers may return Promises:
bus.registerRequestHandler('get-data', () => Promise.resolve(someData));
WindowAdapterAdapter implementation for cross-window communication via postMessage.
WindowAdapter.createSimpleWindowAdapter(iframe?, options?)Factory method that creates a WindowAdapter for simple parent/iframe communication.
AdapterAbstract base class for custom transport implementations.
.node-version)git clone https://github.com/Decentral-America/browser-bus.git
cd browser-bus
npm install
| Command | Description |
|---|---|
npm run build | Build distribution files |
npm test | Run tests with Vitest |
npm run test:watch | Tests in watch mode |
npm run test:coverage | Tests with V8 coverage |
npm run typecheck | TypeScript type checking |
npm run lint | ESLint |
npm run lint:fix | ESLint with auto-fix |
npm run format | Format with Prettier |
npm run validate | Full CI validation pipeline |
npm run bulletproof | Format + lint fix + typecheck + test |
npm run bulletproof:check | CI-safe: check format + lint + tc + test |
| Package | Description |
|---|---|
@decentralchain/signer | Transaction signing orchestrator |
@decentralchain/cubensis-connect-provider | CubensisConnect wallet provider |
@decentralchain/signature-adapter | Multi-provider signing adapter |
See CONTRIBUTING.md.
To report a vulnerability, see SECURITY.md.
MIT — Copyright (c) DecentralChain
FAQs
Cross-window browser communication library for DecentralChain DApps and wallet applications
We found that @decentralchain/browser-bus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.