
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
This module will encode and decode LOB packets to/from JSON and Buffers.
Install: npm install lob-enc
Primary usage:
var lob = require('lob-enc');
var json = {
"type":"test",
"foo":["bar"]
};
var body = new Buffer("any binary!");
var bin = lob.encode(json, body));
// bin will be a buffer with json and body encoded
var packet = lob.decode(bin);
// packet.json == json, and packet.body == body
// do both encode and decode together, for convenience
var packet = lob.packet(json, body);
// object validator
var bool = lob.isPacket(packet);
Also supports reading a packet in a streaming mode:
var stream = lob.stream(function(packet, cbDone){
// packet.json is the complete header
// any packet.body will be subsequently streamed
cbDone();
});
var es = require('event-stream');
stream.pipe(es.wait(function(err, body){
// body is the body of the packet
}));
// test stream in fragments
var bin = new Buffer('001d7b2274797065223a2274657374222c22666f6f223a5b22626172225d7d616e792062696e61727921','hex');
es.readArray([bin.slice(0,10),bin.slice(10,20),bin.slice(20,30),bin.slice(30)]).pipe(stream);
Packets can be read and written in chunks:
// args.ack = true will only send one chunk until another is read, blocking/acking
var chunk = lob.chunking(args, function cbPacket(err, packet){ });
chunk.pipe(socket); // chunks are written to socket
socket.pipe(chunk); // incoming socket data is read back as chunks
chunk.send(packet); // send a packet as one or more chunks
Packets can be cloaked:
var cloaked = lob.cloak(packet);
var packet = lob.decloak(cloaked);
// packet.cloaked = # of rounds
FAQs
Length-Object-Binary Packet Encoding
We found that lob-enc demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.