
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@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.
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.