Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@ndn/ws-transport
Advanced tools
This package is part of NDNts, Named Data Networking libraries for the modern web.
This package implements a WebSocket transport. It works in both Node.js and browser.
You can create a forwarder face that uses WebSocket transport with WsTransport.createFace()
function.
To create a WebSocket transport without wrapping into L3Face, use WsTransport.connect()
function.
import { WsTransport } from "@ndn/ws-transport";
// other imports for examples
import { consume } from "@ndn/endpoint";
import { Data, Interest, Name } from "@ndn/packet";
if (process.env.CI) { process.exit(0); }
// Create a WebSocket face.
// Unless otherwise specified, the face is added to the default logical forwarder.
// You may set an alternate logical forwarder in the first argument.
//
// A route for "/" prefix is added automatically.
// You may customize the route prefixes via addRoutes property in the first argument.
const uplink = await WsTransport.createFace({}, "wss://hobo.cs.arizona.edu/ws/");
// We can now send Interests and retrieve Data.
let seq = Math.trunc(Math.random() * 1e8);
for (let i = 0; i < 5; ++i) {
try {
const interest = new Interest(`/ndn/edu/arizona/ping/NDNts/${seq++}`);
console.log(`<I ${interest.name}`);
const data = await consume(interest);
console.log(`>D ${data.name}`);
} catch (err: unknown) {
console.warn(err);
}
}
// In case a socket error occurs, the transport will attempt to reconnect automatically,
// although packets transmitted during that time would be lost. The reconnecting logic
// is implemented in L3Face class from @ndn/l3face package.
// When the face is no longer needed, close it.
uplink.close();
FAQs
NDNts: WebSocket Transport
We found that @ndn/ws-transport demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.