
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Encode / decode binary data using Buffer written in TypeScript
npm install -D binar
or
yarn add -D binar
import { DataType, decodeBinar, encodeBinar } from 'binar';
test('binar', () => {
const data = [
[DataType.Null, null],
[DataType.Boolean, false],
[DataType.Boolean, true],
[DataType.Number, 0],
[DataType.Number, 1],
[DataType.Number, -1],
[DataType.Number, Math.random()],
[DataType.String, 'this is string 하하'],
[DataType.Buffer, Buffer.from('another 하하')],
[DataType.BigInt64BE, BigInt(-Math.floor(Math.random() * 2 ** 32))],
[DataType.BigInt64LE, BigInt(-Math.floor(Math.random() * 2 ** 32))],
[DataType.BigUInt64BE, BigInt(Math.floor(Math.random() * 2 ** 32))],
[DataType.BigUInt64LE, BigInt(Math.floor(Math.random() * 2 ** 32))],
[DataType.DoubleBE, -Math.random()],
[DataType.DoubleLE, -Math.random()],
[DataType.FloatBE, -Math.random()],
[DataType.FloatLE, -Math.random()],
[DataType.Int8, -Math.floor(Math.random() * 2 ** 4)],
[DataType.Int16BE, -Math.floor(Math.random() * 2 ** 8)],
[DataType.Int16LE, -Math.floor(Math.random() * 2 ** 8)],
[DataType.Int32BE, -Math.floor(Math.random() * 2 ** 16)],
[DataType.Int32LE, -Math.floor(Math.random() * 2 ** 16)],
[DataType.UInt8, Math.floor(Math.random() * 2 ** 8)],
[DataType.UInt16BE, Math.floor(Math.random() * 2 ** 16)],
[DataType.UInt16LE, Math.floor(Math.random() * 2 ** 16)],
[DataType.UInt32BE, Math.floor(Math.random() * 2 ** 32)],
[DataType.UInt32LE, Math.floor(Math.random() * 2 ** 32)],
];
const buf = encodeBinar(data as any);
console.log(Buffer.from(data.map((x) => x[1]).join(':')).toString('base64'));
console.log(buf.toString('base64'));
const values = decodeBinar(buf);
for (let i = 0, len = values.length; i < len; i += 1) {
const val = values[i];
if (typeof val === 'number') {
expect(values[i]).toBeCloseTo(data[i][1] as any);
} else {
expect(values[i]).toEqual(data[i][1] as any);
}
}
});
FAQs
Encode / decode binary data using Buffer written in TypeScript
The npm package binar receives a total of 2 weekly downloads. As such, binar popularity was classified as not popular.
We found that binar 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.