Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.
The pvtsutils npm package provides a set of utilities for working with binary data, particularly in the context of cryptographic operations. It includes functions for encoding and decoding data, converting between different data formats, and performing various binary manipulations.
Base64 Encoding/Decoding
This feature allows you to encode and decode strings to and from Base64 format, which is commonly used in data transmission and storage.
const pvtsutils = require('pvtsutils');
// Encoding a string to Base64
const base64Encoded = pvtsutils.Convert.ToBase64('Hello, World!');
console.log(base64Encoded); // Outputs: 'SGVsbG8sIFdvcmxkIQ=='
// Decoding a Base64 string
const base64Decoded = pvtsutils.Convert.FromBase64(base64Encoded);
console.log(base64Decoded); // Outputs: 'Hello, World!'
Hex Encoding/Decoding
This feature allows you to encode and decode strings to and from Hex format, which is useful for representing binary data in a human-readable form.
const pvtsutils = require('pvtsutils');
// Encoding a string to Hex
const hexEncoded = pvtsutils.Convert.ToHex('Hello, World!');
console.log(hexEncoded); // Outputs: '48656c6c6f2c20576f726c6421'
// Decoding a Hex string
const hexDecoded = pvtsutils.Convert.FromHex(hexEncoded);
console.log(hexDecoded); // Outputs: 'Hello, World!'
ArrayBuffer Conversion
This feature allows you to convert strings to ArrayBuffer and vice versa, which is useful for handling binary data in web applications.
const pvtsutils = require('pvtsutils');
// Converting a string to ArrayBuffer
const arrayBuffer = pvtsutils.Convert.FromUtf8String('Hello, World!');
console.log(arrayBuffer); // Outputs: ArrayBuffer { byteLength: 13 }
// Converting an ArrayBuffer to a string
const utf8String = pvtsutils.Convert.ToUtf8String(arrayBuffer);
console.log(utf8String); // Outputs: 'Hello, World!'
The buffer package provides a way of handling binary data in Node.js. It includes methods for encoding and decoding data in various formats, similar to pvtsutils. However, buffer is more focused on Node.js environments and may not be as versatile for web applications.
The base64-js package is a simple library for encoding and decoding Base64 data. It offers similar functionality to the Base64 encoding/decoding features of pvtsutils but does not include the broader range of binary data utilities.
The crypto-js package provides a variety of cryptographic algorithms and utilities, including encoding and decoding functions. While it offers more cryptographic features than pvtsutils, it may be overkill if you only need basic binary data manipulation.
pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.
npm install pvtsutils
const utils = require("pvtsutils");
The pvtsutils
namespace will always be available globally and also supports AMD loaders.
There is an index.d.ts file which makes easy to use current module as external
Helps to convert string
to ArrayBuffer
and back
Convert support next encoding types hex
, utf8
, binary
, base64
, base64url
. utf8
is default.
Converts string to buffer
const buf = Convert.FromString("some string", "hex");
Converts buffer to string
const str = Convert.ToString(buf, "utf8");
Copies properties from objects to a target object. More info
const obj = assign({}, {name: "Bob"}, {age: 12}); // {name: "Bob", age: 12}
Returns true
if 2 ArrayBuffers are equal
Combines some ArrayBuffer
values
const buf1 = new Uint8Array([1, 2, 3]);
const buf2 = new Uint8Array([4, 5, 6]);
const buf = combine(buf1, buf2); // [1, 2, 3, 4, 5, 6]
Some example capabilities included in pvtsutils include:
FAQs
pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.
The npm package pvtsutils receives a total of 2,551,989 weekly downloads. As such, pvtsutils popularity was classified as popular.
We found that pvtsutils demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.