{"_id":"@dev_innovations_labs/dil-gcm-envelope","_rev":"2-f85396baf58def4ec733ac93e78f92e6","name":"@dev_innovations_labs/dil-gcm-envelope","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@dev_innovations_labs/dil-gcm-envelope","version":"1.0.0","keywords":["aes","aes-256","aes-256-gcm","gcm","encryption","decryption","crypto","cryptography","secure","security","payload","iv","tag","encrypted-api","api-security","typescript","nodejs","react-native","browser","webcrypto","sdk","envelope","data-protection"],"license":"MIT","_id":"@dev_innovations_labs/dil-gcm-envelope@1.0.0","maintainers":[{"name":"sharan036","email":"sharangopal36@gmail.com"}],"dist":{"shasum":"fba531fd39d45715451277c97900457d17b664dc","tarball":"https://registry.npmjs.org/@dev_innovations_labs/dil-gcm-envelope/-/dil-gcm-envelope-1.0.0.tgz","fileCount":10,"integrity":"sha512-opCsyaGwzwVMzzVnGSvx+7chgTj2MFqeV+4prnH3q2KnE9e2tIL1FRPxp39q7JBNxAqDoNvN21NQTfaxI54lfA==","signatures":[{"sig":"MEYCIQCM77ikZucS4Y6L8sqtUFlm+DcFsekCQBRaE7aiRU8O3QIhALQs7zifE3FwW9FhrjQ1UoCt8ZIgtx7mF3sLdWRUHfNa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10454},"main":"dist/index.cjs.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","scripts":{"build":"rm -rf dist && tsc && rollup -c"},"_npmUser":{"name":"sharan036","email":"sharangopal36@gmail.com"},"_npmVersion":"10.9.2","description":"AES-256-GCM envelope helper (payload, iv, tag) — TypeScript SDK","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.2","rollup":"^4.9.5","typescript":"^5.5.0","@types/node":"^20.5.1","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/dil-gcm-envelope_1.0.0_1764831146593_0.5274275873973875","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@dev_innovations_labs/dil-gcm-envelope","version":"1.0.4","description":"AES-256-GCM envelope helper (payload, iv, tag) — TypeScript SDK","main":"dist/index.cjs","module":"dist/index.esm.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.esm.js","require":"./dist/index.cjs"}},"scripts":{"build":"rm -rf dist && tsc && rollup -c"},"keywords":["aes","aes-256","aes-256-gcm","gcm","encryption","decryption","crypto","cryptography","secure","security","payload","iv","tag","encrypted-api","api-security","typescript","nodejs","react-native","browser","webcrypto","sdk","envelope","data-protection"],"devDependencies":{"typescript":"^5.5.0","@types/node":"^20.5.1","rollup":"^4.9.5","@rollup/plugin-typescript":"^11.1.6","@rollup/plugin-terser":"^0.4.4","tslib":"^2.6.2"},"license":"MIT","_id":"@dev_innovations_labs/dil-gcm-envelope@1.0.4","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-h2x/2Qt6gPZ2tvwvW1ZDtB54yXm3gi/ueMNLTSBsfeNzcwDWzDKUU0gbZZv3Qur88jHJkLR07bcGD6L7oFZ8aQ==","shasum":"68f02de63fde0b0ecb01985e6dc4cbbadbd61de0","tarball":"https://registry.npmjs.org/@dev_innovations_labs/dil-gcm-envelope/-/dil-gcm-envelope-1.0.4.tgz","fileCount":10,"unpackedSize":10541,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCjJz2LpCkxs4BkLFiVtcqlKFqqb5Xfdn9ecV3CPyqmGQIhAPFaDS6BZ3D/Pm4p3dnBIFF2XGt5Q5YJHnwxUlTk/L5t"}]},"_npmUser":{"name":"sharan036","email":"sharangopal36@gmail.com"},"directories":{},"maintainers":[{"name":"sharan036","email":"sharangopal36@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dil-gcm-envelope_1.0.4_1764851075641_0.595825131578783"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-04T06:52:26.482Z","modified":"2025-12-04T12:24:35.998Z","1.0.0":"2025-12-04T06:52:26.737Z","1.0.4":"2025-12-04T12:24:35.797Z"},"license":"MIT","keywords":["aes","aes-256","aes-256-gcm","gcm","encryption","decryption","crypto","cryptography","secure","security","payload","iv","tag","encrypted-api","api-security","typescript","nodejs","react-native","browser","webcrypto","sdk","envelope","data-protection"],"description":"AES-256-GCM envelope helper (payload, iv, tag) — TypeScript SDK","maintainers":[{"name":"sharan036","email":"sharangopal36@gmail.com"}],"readme":"# @dev_innovations_labs/dil-gcm-envelope\n\nA lightweight, secure **AES-256-GCM encryption SDK** for Node.js, React Native, and Browser environments.  \nDesigned for apps that need to send **fully encrypted API requests** using the envelope format:\n\n```json\n{\n  \"payload\": \"<base64>\",\n  \"iv\": \"<base64>\",\n  \"tag\": \"<base64>\"\n}\n```\n\nThis SDK ensures secure client–server communication where **no readable data is transmitted over the network**, even before TLS.\n\n---\n\n# 🚀 Features\n\n- 🔐 AES-256-GCM authenticated encryption  \n- 📦 Tiny TypeScript SDK  \n- 🌐 Works in **Node.js**, **React Native**, and **Browsers**  \n- 🎯 Envelope output compatible with encrypted backends  \n- 🔄 Deterministic decrypt → always returns original object  \n- 🔑 Built-in secure key generator  \n- ⚡ Rollup optimized: ESM & CJS builds included  \n\n---\n\n# Installation\n\n```bash\nnpm install @dev_innovations_labs/dil-gcm-envelope\n```\n\nor\n\n```bash\nyarn add @dev_innovations_labs/dil-gcm-envelope\n```\n\n---\n\n# Generate a Key\n\nAES-256 requires a **32-byte (256-bit)** symmetric key.\n\n```ts\nimport { generateKey } from \"@dev_innovations_labs/dil-gcm-envelope\";\n\nconst apiKey = generateKey();\nconsole.log(apiKey); // Base64 string\n```\n\nStore keys securely:\n\n- Backend → `.env`\n- React Native → Keychain / Keystore  \n- Browser → Never hardcode, inject via server  \n\n---\n\n# Node.js Example (Backend)\n\n### Encrypt data\n\n```ts\nimport { encrypt } from \"@dev_innovations_labs/dil-gcm-envelope\";\n\nconst key = process.env.API_ENC_KEY;\n\nconst envelope = await encrypt({ message: \"Hello Backend\" }, key);\n\nconsole.log(envelope);\n```\n\n### Decrypt data\n\n```ts\nimport { decrypt } from \"@dev_innovations_labs/dil-gcm-envelope\";\n\nconst decrypted = await decrypt(envelope, key);\n\nconsole.log(decrypted);\n```\n\n---\n\n# Example: Encrypted Backend Route (Express)\n\n```ts\napp.post(\"/login\", async (req, res) => {\n  const key = process.env.API_ENC_KEY;\n\n  const decryptedBody = await decrypt(req.body, key);\n\n  const response = await encrypt({ status: true, token: \"abc123\" }, key);\n\n  return res.json(response);\n});\n```\n\n---\n\n# React Native Example\n\n```ts\nimport { encrypt, decrypt } from \"@dev_innovations_labs/dil-gcm-envelope\";\n\nglobal.__API_ENC_KEY = \"BASE64-YOUR-KEY\";\n\n(async () => {\n  const env = await encrypt({ phone: \"+91...\" }, global.__API_ENC_KEY);\n  const dec = await decrypt(env, global.__API_ENC_KEY);\n})();\n```\n\n---\n\n# Browser (WebCrypto) Example\n\n```ts\nimport { webEncrypt, webDecrypt } from \"@dev_innovations_labs/dil-gcm-envelope\";\n\nconst encrypted = await webEncrypt({ name: \"Dev\" }, key);\nconst decrypted = await webDecrypt(encrypted, key);\n```\n\n---\n\n# Full Encrypted API Flow\n\n(Frontend → Backend → Frontend)\n\n---\n\n# Security Best Practices\n\n- Never hardcode API keys  \n- Rotate keys periodically  \n- Use HTTPS  \n- Do not log encrypted blobs in production  \n\n---\n\n# License\n\nMIT © Dev Innovations Labs\n","readmeFilename":"README.md"}