
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
@bit-js/ncrypt
Advanced tools
Fast node crypto utilities.
Signers are instances that can be used to sign and verify data.
// The data can be anything depending on the specific signer
interface Signer {
sign: (data: string) => string;
verify: (data: string, digest: string) => boolean;
}
A fast drop-in replacement of the keygrip
module.
import KeyGrip from "@bit-js/ncrypt/key-grip";
A simple single key signer and verifier.
import BasicSigner from "@bit-js/ncrypt/basic-signer";
const signer = new BasicSigner("secret");
// Return the signed value
signer.sign(value);
// Return whether the hash matches the value
signer.verify(value, hash);
Sign a value and verify it later.
import ValueSigner from "@bit-js/ncrypt/value-signer";
// Pass in a signer (choose one above) for signing and unsigning a value
const valueSigner = new ValueSigner(signer);
// Sign a value
const signedValue = valueSigner.sign("hi there"); // "hi there.[hash]"
// Get the original value if the hash matches, otherwise return null
const originalValue = valueSigner.unsign(signedValue); // "hi there"
Cookie utilities.
Use a cookie pair to send cookie
import { CookiePair } from "@bit-js/ncrypt/cookie";
// Initialize a cookie pair (key is required)
const pair = new CookiePair("id");
// Set the cookie value (optional)
pair.value = 0;
// Set a signer to sign the cookie value (optional)
pair.signer = signer;
// Set cookie expire date (optional)
pair.expires = new Date();
// Set cookie max age (optional)
pair.maxAge = 3600000;
// Whether cookie is accessible through client-side JS (optional)
pair.httpOnly = true;
// Indicates that the cookie should be stored using partitioned storage (optional)
pair.partitioned = true;
// Defines the host to which the cookie will be sent (optional)
pair.domain = domain;
// Indicates the path that must exist in the requested URL for the browser to send the header (optional)
pair.path = path;
// Indicates that the cookie is sent to the server only when a request is made with the https scheme (optional)
pair.secure = true;
// Controls whether or not a cookie is sent with cross-site requests (optional)
pair.sameSite = "Strict";
// Serialize the cookie to string
pair.serialize();
If the pair value is set to null
, pair.serialize()
will produce a cookie that lasts 0 second and only contains the domain
and path
if provided.
If you think this is a good idea then I guess ¯_(ツ)_/¯.
import { reactiveCookie, appendToHeaders } from "@bit-js/ncrypt/cookie";
// Create a Proxy over the original object
const cookie = reactiveCookie({});
// Every property is a cookie pair
const { id } = cookie;
id.value = 0;
id.sameSite = "Strict";
// Append all the pair values to a Headers object
appendToHeaders(new Headers(), cookie);
FAQs
Fast node crypto utilities.
The npm package @bit-js/ncrypt receives a total of 0 weekly downloads. As such, @bit-js/ncrypt popularity was classified as not popular.
We found that @bit-js/ncrypt demonstrated a not healthy version release cadence and project activity because the last version was released 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.