npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dev_innovations_labs/dil-gcm-envelope

v1.0.4

Published

AES-256-GCM envelope helper (payload, iv, tag) — TypeScript SDK

Readme

@dev_innovations_labs/dil-gcm-envelope

A lightweight, secure AES-256-GCM encryption SDK for Node.js, React Native, and Browser environments.
Designed for apps that need to send fully encrypted API requests using the envelope format:

{
  "payload": "<base64>",
  "iv": "<base64>",
  "tag": "<base64>"
}

This SDK ensures secure client–server communication where no readable data is transmitted over the network, even before TLS.


🚀 Features

  • 🔐 AES-256-GCM authenticated encryption
  • 📦 Tiny TypeScript SDK
  • 🌐 Works in Node.js, React Native, and Browsers
  • 🎯 Envelope output compatible with encrypted backends
  • 🔄 Deterministic decrypt → always returns original object
  • 🔑 Built-in secure key generator
  • ⚡ Rollup optimized: ESM & CJS builds included

Installation

npm install @dev_innovations_labs/dil-gcm-envelope

or

yarn add @dev_innovations_labs/dil-gcm-envelope

Generate a Key

AES-256 requires a 32-byte (256-bit) symmetric key.

import { generateKey } from "@dev_innovations_labs/dil-gcm-envelope";

const apiKey = generateKey();
console.log(apiKey); // Base64 string

Store keys securely:

  • Backend → .env
  • React Native → Keychain / Keystore
  • Browser → Never hardcode, inject via server

Node.js Example (Backend)

Encrypt data

import { encrypt } from "@dev_innovations_labs/dil-gcm-envelope";

const key = process.env.API_ENC_KEY;

const envelope = await encrypt({ message: "Hello Backend" }, key);

console.log(envelope);

Decrypt data

import { decrypt } from "@dev_innovations_labs/dil-gcm-envelope";

const decrypted = await decrypt(envelope, key);

console.log(decrypted);

Example: Encrypted Backend Route (Express)

app.post("/login", async (req, res) => {
  const key = process.env.API_ENC_KEY;

  const decryptedBody = await decrypt(req.body, key);

  const response = await encrypt({ status: true, token: "abc123" }, key);

  return res.json(response);
});

React Native Example

import { encrypt, decrypt } from "@dev_innovations_labs/dil-gcm-envelope";

global.__API_ENC_KEY = "BASE64-YOUR-KEY";

(async () => {
  const env = await encrypt({ phone: "+91..." }, global.__API_ENC_KEY);
  const dec = await decrypt(env, global.__API_ENC_KEY);
})();

Browser (WebCrypto) Example

import { webEncrypt, webDecrypt } from "@dev_innovations_labs/dil-gcm-envelope";

const encrypted = await webEncrypt({ name: "Dev" }, key);
const decrypted = await webDecrypt(encrypted, key);

Full Encrypted API Flow

(Frontend → Backend → Frontend)


Security Best Practices

  • Never hardcode API keys
  • Rotate keys periodically
  • Use HTTPS
  • Do not log encrypted blobs in production

License

MIT © Dev Innovations Labs