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/nfdmgmt
Advanced tools
This package is part of NDNts, Named Data Networking libraries for the modern web.
This package implements basic support for NFD Management protocol. It includes both a generic variant and a NFD-specific variant with additional typing.
invokeGeneric
, ControlResponse
invoke
, invokeCsErase
, ControlParameters
list
, StatusDataset
FaceDataset
, FaceQuery
, CsInfo
, StrategyChoice
, RibEntry
This implementation is validated against NFD using nfdmgmt-interop.
import { enableNfdPrefixReg } from "@ndn/nfdmgmt";
// other imports for examples
import { consume, produce } from "@ndn/endpoint";
import { Forwarder, type FwFace } from "@ndn/fw";
import { generateSigningKey } from "@ndn/keychain";
import { UnixTransport } from "@ndn/node-transport";
import { Data, Interest, Name } from "@ndn/packet";
import { delay, fromUtf8, toUtf8 } from "@ndn/util";
import assert from "node:assert/strict";
enableNfdPrefixReg
function enables NFD prefix registration.
The snippet here shows API usage.
If you are using @ndn/cli-common
package, this is called automatically if the uplink connects to NFD.
// Create two forwarders, one as consumer and one as producer.
const fwC = Forwarder.create();
const fwP = Forwarder.create();
// Connect to NFD using Unix socket transport.
const unixSocket = process.env.DEMO_NFD_UNIX ?? "/run/nfd/nfd.sock";
let uplinkC: FwFace;
try {
uplinkC = await UnixTransport.createFace({ fw: fwC }, unixSocket);
} catch {
// Skip the example if NFD is not running.
console.warn("NFD not running");
process.exit(0);
}
const uplinkP = await UnixTransport.createFace({ fw: fwP, addRoutes: [] }, unixSocket);
// Generate a signing key and enable NFD prefix registration.
const [privateKey] = await generateSigningKey("/K");
enableNfdPrefixReg(uplinkP, { signer: privateKey });
// Start a producer.
const producer = produce("/P", async () => {
console.log("producing");
return new Data("/P", Data.FreshnessPeriod(1000), toUtf8("NDNts + NFD"));
}, { fw: fwP });
await delay(500);
// Start a consumer, fetch Data from the producer via NFD.
const data = await consume(new Interest("/P", Interest.MustBeFresh), { fw: fwC });
const payloadText = fromUtf8(data.content);
console.log("received", `${data.name} ${payloadText}`);
assert.equal(payloadText, "NDNts + NFD");
// Close faces.
uplinkC.close();
uplinkP.close();
producer.close();
Previously, NFD Management protocol uses the deprecated Signed Interest 0.2 format.
signInterest02
function provides basic support for this older format.
NFD is now accepting the Signed Interest format in NDN packet spec and this package has switched to it.
However, signInterest02
function is temporarily kept for interoperability with other programs that follows the structure of NFD Management protocol but still requires the old format.
FAQs
NDNts: NFD Management
The npm package @ndn/nfdmgmt receives a total of 15 weekly downloads. As such, @ndn/nfdmgmt popularity was classified as not popular.
We found that @ndn/nfdmgmt 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.