{"_id":"expect-dotenv","name":"expect-dotenv","dist-tags":{"latest":"7.2.1"},"versions":{"7.2.1":{"name":"expect-dotenv","version":"7.2.1","description":"Env config toolkit built on dotenv and env-var, with worker-threads-based decrypt/verify/validate/plugin tasks","keywords":["config","env-var","dotenv","typescript"],"main":"lib/env-var-base.js","types":"lib/env-var-base.d.ts","author":{"name":"bellcalebxyz311@outlook.com"},"repository":{"type":"git","url":"git+https://github.com/bellcaleb/expect-dotenv.git"},"bugs":{"url":"https://github.com/bellcaleb/expect-dotenv/issues"},"homepage":"https://github.com/bellcaleb/expect-dotenv#readme","license":"MIT","engines":{"node":">=14.0.0"},"scripts":{"lint":"eslint --fix 'src/**/*.ts' 'test/**/*.ts'","prebuild":"rimraf lib","build":"tsc","build:docs":"typedoc --out docs src/env-var-base.ts","test":"jest --coverage","test:prod":"npm run lint && npm run test -- --no-cache"},"peerDependencies":{"dotenv":">= 8","env-var":">= 7"},"lint-staged":{"{src,test}/**/*.ts":["eslint --fix"]},"jest":{"transform":{".(ts|tsx)":"ts-jest"},"testEnvironment":"node","testRegex":"(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$","moduleFileExtensions":["ts","tsx","js"],"coveragePathIgnorePatterns":["/node_modules/","/test/"],"coverageThreshold":{"global":{"branches":90,"functions":95,"lines":95,"statements":95}},"collectCoverageFrom":["src/*.{js,ts}"]},"prettier":{"semi":false,"singleQuote":true},"commitlint":{"extends":["@commitlint/config-conventional"]},"devDependencies":{"@commitlint/cli":"17.0.1","@commitlint/config-conventional":"17.0.0","@types/jest":"27.5.1","@types/node":"^17.0.35","@typescript-eslint/eslint-plugin":"^5.26.0","@typescript-eslint/parser":"^5.26.0","dotenv":"16.0.1","env-var":"^7.1.1","eslint":"^8.16.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","husky":"^8.0.1","jest":"28.1.0","jest-config":"28.1.0","lint-staged":"^12.4.2","prettier":"^2.6.2","rimraf":"^3.0.2","semantic-release":"^19.0.2","ts-jest":"^28.0.3","typedoc":"^0.22.15","typescript":"^4.7.2"},"_id":"expect-dotenv@7.2.1","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-UeX3EtD+wZ55AKERnfhc6c05z0OFm5+oxC+ypvw5ZSm8jDqOq3RQ98wlr9fa2b+PkC7obusvdv/LRI+wU8PWBA==","shasum":"682a8eb7d4af9cb67e079e46bb5362fc543545e2","tarball":"https://registry.npmjs.org/expect-dotenv/-/expect-dotenv-7.2.1.tgz","fileCount":12,"unpackedSize":13569,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID1DNI8dCqS8l7ACTbTU+45P0YYsWXaQvZHCA7WpKM4IAiEA2EXRyQoEPyUPL0uNU99E2HwMYsPl0KTkLHmDf3izmCI="}]},"_npmUser":{"name":"bellcaleb","email":"bellcalebxyz311@outlook.com"},"directories":{},"maintainers":[{"name":"bellcaleb","email":"bellcalebxyz311@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/expect-dotenv_7.2.1_1787177775946_0.33487190808874234"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-19T22:16:15.865Z","7.2.1":"2026-08-19T22:16:16.082Z","modified":"2026-08-19T22:16:16.328Z"},"maintainers":[{"name":"bellcaleb","email":"bellcalebxyz311@outlook.com"}],"description":"Env config toolkit built on dotenv and env-var, with worker-threads-based decrypt/verify/validate/plugin tasks","homepage":"https://github.com/bellcaleb/expect-dotenv#readme","keywords":["config","env-var","dotenv","typescript"],"repository":{"type":"git","url":"git+https://github.com/bellcaleb/expect-dotenv.git"},"author":{"name":"bellcalebxyz311@outlook.com"},"bugs":{"url":"https://github.com/bellcaleb/expect-dotenv/issues"},"license":"MIT","readme":"# expect-dotenv\n\nEnv config toolkit built on [dotenv](https://github.com/motdotla/dotenv) and\n[env-var](https://github.com/evanshortiss/env-var), with `decrypt` / `verify`\n/ `validate` / `plugin` tasks each run in a `worker_threads` worker so they\nnever block the event loop.\n\nInstallation:\n\n```sh\nnpm i expect-dotenv\n```\n\n## Basic usage\n\n```js\nconst env = require(\"expect-dotenv\");\n\nenv.config(); // loads .env via dotenv\n\nconst port = env.get(\"PORT\").default(3000).asPortNumber();\nconst hasApiKey = env.has(\"API_KEY\");\nconst all = env.all();\n```\n\n## Worker-thread tasks\n\nEach of these spawns a worker thread and resolves a promise with the\nworker's result. No network calls are made by this package.\n\n### decrypt\n\nAES-256-CBC decrypt:\n\n```js\nconst { ok, result } = await env.decrypt({\n  encrypted: \"...\", // base64\n  key: \"...\", // hex\n  iv: \"...\", // hex\n});\n```\n\n### verify\n\nSHA256 signature verification:\n\n```js\nconst { ok, result } = await env.verify({\n  data: \"payload to verify\",\n  signature: \"...\", // base64\n  publicKey: \"-----BEGIN PUBLIC KEY-----...\",\n});\n```\n\n### validate\n\nValidate an env object against a simple schema:\n\n```js\nconst { ok, errors } = await env.validate({\n  env: process.env,\n  schema: {\n    PORT: { required: true, type: \"number\" },\n    DEBUG: { type: \"boolean\" },\n  },\n});\n```\n\n### plugin\n\nLoads a **local** module (by path, relative to `process.cwd()` unless\nabsolute) inside a worker thread and calls it if it exports a function:\n\n```js\n// plugins/my-plugin.js\nmodule.exports = (arg1) => `hello ${arg1}`;\n```\n\n```js\nconst { ok, result } = await env.plugin({\n  modulePath: \"./plugins/my-plugin.js\",\n  args: [\"world\"],\n});\n```\n\n`modulePath` always comes from your own code — this package never fetches\nor evaluates code from a remote source.\n\n## Worker files\n\n- `lib/workers/runWorker.js` — spawns the right `*.worker.js` and forwards\n  the payload; this is the piece originally named `runWorkers.js` in\n  earlier versions of this package.\n- `lib/workers/plugin.worker.js` — loads the local module passed via\n  `modulePath` (renamed from the old `runWorkers.js` plugin-handling code).\n- `lib/workers/decrypt.worker.js`, `verify.worker.js`, `validate.worker.js`\n  — the corresponding task implementations.\n","readmeFilename":"README.md","_rev":"1-8efba3af43f4c614020a2785f911abb7"}