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.
The @hapi/b64 package is designed for encoding and decoding data in base64 format. It is part of the hapi ecosystem, which is a rich framework for building applications and services. @hapi/b64 provides a straightforward and efficient way to work with base64 encoded data in Node.js applications.
Encoding data to base64
This feature allows you to encode textual or binary data into base64 format. The provided code sample demonstrates how to encode the string 'Hello, World!' into base64.
"use strict"; const B64 = require('@hapi/b64'); const encoded = B64.encode('Hello, World!'); console.log(encoded);
Decoding base64 data
This feature enables the decoding of base64 encoded data back into its original format. The code sample shows how to decode a base64 encoded string back to 'Hello, World!'.
"use strict"; const B64 = require('@hapi/b64'); const decoded = B64.decode('SGVsbG8sIFdvcmxkIQ=='); console.log(decoded.toString());
base64-js is a package that provides similar base64 encoding and decoding functionalities. Compared to @hapi/b64, base64-js focuses solely on base64 operations and might offer more specialized functions for handling base64 data in various scenarios.
The buffer package includes methods for encoding and decoding base64 data as part of its broader functionality for handling binary data in Node.js. While @hapi/b64 is specifically tailored for base64 encoding and decoding, buffer offers a wider range of capabilities for binary data manipulation.
b64 is part of the hapi ecosystem and was designed to work seamlessly with the hapi web framework and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out hapi – they work even better together.
FAQs
Base64 streaming encoder and decoder
The npm package @hapi/b64 receives a total of 1,011,598 weekly downloads. As such, @hapi/b64 popularity was classified as popular.
We found that @hapi/b64 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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.
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.