{"_id":"@angloqq03/ekr","_rev":"3-1acfeef5605bb949d2e686d0f713be43","name":"@angloqq03/ekr","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@angloqq03/ekr","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@angloqq03/ekr@1.0.0","maintainers":[{"name":"angloqq03","email":"angeloqq03@gmail.com"}],"bin":{"envkeyrotators":"dist/cli.cjs"},"dist":{"shasum":"dde8a5d79fe5f618e610d0d32cb9d843f023c233","tarball":"https://registry.npmjs.org/@angloqq03/ekr/-/ekr-1.0.0.tgz","fileCount":18,"integrity":"sha512-bYX58zNYhmupOBtmxF9a3zzOwUVx1QwXMiBUWPHyDUpguHArUYtzkRdMsqphkgWfKQiYReewZZ/v7aaBEwimHg==","signatures":[{"sig":"MEYCIQDFBRsFjjID3R5hMZpM8YKzsKe42byZdjMN8JaDC5a42QIhAOhwSK3T4+5YCB1O7e3dkNoQJrck6pUWDyctYBOH3QJa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117508},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./node":{"import":"./dist/node.js","require":"./dist/node.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","test:cli":"node ./dist/cli.cjs --file ./.env.sample","test:discover":"node ./dist/cli.cjs --dir ./fixtures --show-source","test:fixtures:env":"node ./dist/cli.cjs --file ./fixtures/sample.env --key KEY1 --format json","test:fixtures:txt":"node ./dist/cli.cjs --file ./fixtures/sample.txt --format dotenv","test:fixtures:json":"node ./dist/cli.cjs --file ./fixtures/sample.json --format json","test:fixtures:keys":"node ./dist/cli.cjs --file ./fixtures/sample.keys --format dotenv"},"_npmUser":{"name":"angloqq03","email":"angeloqq03@gmail.com"},"_npmVersion":"11.8.0","description":"Tiny utility to load keys from `.env`-style files (also `.txt` / `.keys`) and `.json`, then randomly pick an entry (optionally by key).","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ekr_1.0.0_1775241438512_0.9964181643546719","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@angloqq03/ekr","version":"1.1.0","keywords":[],"author":"","license":"ISC","_id":"@angloqq03/ekr@1.1.0","maintainers":[{"name":"angloqq03","email":"angeloqq03@gmail.com"}],"bin":{"envkeyrotators":"dist/cli.cjs"},"dist":{"shasum":"c42598c2267d29d0f49d36534485fc0fe1f7e5c6","tarball":"https://registry.npmjs.org/@angloqq03/ekr/-/ekr-1.1.0.tgz","fileCount":18,"integrity":"sha512-UHXwRuFDHijjlIKjS9mZLUUKndijQ2NByKJWa2ZWGfOKSDTSlkW3IeEcRDHzf2YnzBYWIfs2Ngs1W2ldL9BE0g==","signatures":[{"sig":"MEQCIQDGck45B1Oz3Hgh1zLzbzd1UZavW+ADXjax5lkUGsysJQIfPwVyLXcIt/MJxq4zRKNK9Sf8SrcKGf08Wj1t7Bq2Aw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119099},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./node":{"import":"./dist/node.js","require":"./dist/node.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","test:cli":"node ./dist/cli.cjs --file ./.env.sample","test:discover":"node ./dist/cli.cjs --dir ./fixtures --show-source","test:fixtures:env":"node ./dist/cli.cjs --file ./fixtures/sample.env --key KEY1 --format json","test:fixtures:txt":"node ./dist/cli.cjs --file ./fixtures/sample.txt --format dotenv","test:fixtures:json":"node ./dist/cli.cjs --file ./fixtures/sample.json --format json","test:fixtures:keys":"node ./dist/cli.cjs --file ./fixtures/sample.keys --format dotenv"},"_npmUser":{"name":"angloqq03","email":"angeloqq03@gmail.com"},"_npmVersion":"11.8.0","description":"Pick a random API key (or any env entry) from dotenv-style files and JSON.","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ekr_1.1.0_1775241571678_0.24403084134243436","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@angloqq03/ekr","version":"1.1.1","description":"Pick a random API key (or any env entry) from dotenv-style files and JSON.","type":"module","funding":{"type":"github","url":"https://github.com/sponsors/emailbypasser-del"},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./node":{"import":"./dist/node.js","require":"./dist/node.cjs"}},"bin":{"envkeyrotators":"dist/cli.cjs"},"scripts":{"build":"tsup","dev":"tsup --watch","test:cli":"node ./dist/cli.cjs --file ./.env.sample","test:fixtures:env":"node ./dist/cli.cjs --file ./fixtures/sample.env --key KEY1 --format json","test:fixtures:keys":"node ./dist/cli.cjs --file ./fixtures/sample.keys --format dotenv","test:fixtures:txt":"node ./dist/cli.cjs --file ./fixtures/sample.txt --format dotenv","test:fixtures:json":"node ./dist/cli.cjs --file ./fixtures/sample.json --format json","test:discover":"node ./dist/cli.cjs --dir ./fixtures --show-source"},"keywords":[],"author":"","license":"ISC","devDependencies":{"@types/node":"^22.0.0","tsup":"^8.0.0","typescript":"^5.0.0"},"dependencies":{"@angloqq03/gpv":"^1.1.4"},"gitHead":"f5e32870dd06151bbf318af1d935149cfd335097","_id":"@angloqq03/ekr@1.1.1","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-4kWw73Wpge0zJo7a2s61gaBhKJ0ojFYVRloEuXobnd9KdLen25UCYQTZlKDF2XJlUO2211Ui0mTBg/wt69mfWw==","shasum":"72b6479d069bf068954aec825da77a9efb341678","tarball":"https://registry.npmjs.org/@angloqq03/ekr/-/ekr-1.1.1.tgz","fileCount":18,"unpackedSize":119256,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCcIAo4CapPqiBczh+x0+pKgfn7kxjg8gfi1Cj2JvUxAAIgNbJj9JdwzYicXSbSWKDFojypLeC6Y38lPAf10kPd4ng="}]},"_npmUser":{"name":"angloqq03","email":"angeloqq03@gmail.com"},"directories":{},"maintainers":[{"name":"angloqq03","email":"angeloqq03@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ekr_1.1.1_1775245182118_0.44144829319966417"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T18:37:18.438Z","modified":"2026-04-03T19:39:42.388Z","1.0.0":"2026-04-03T18:37:18.649Z","1.1.0":"2026-04-03T18:39:31.865Z","1.1.1":"2026-04-03T19:39:42.269Z"},"license":"ISC","keywords":[],"description":"Pick a random API key (or any env entry) from dotenv-style files and JSON.","maintainers":[{"name":"angloqq03","email":"angeloqq03@gmail.com"}],"readme":"# @angloqq03/ekr\n\nPick a random API key (or any env entry) from dotenv-style files and JSON.\n\n- Supported formats: `.env` / `.txt` / `.keys` (dotenv lines), plus `.json`\n- Works in the browser (string input) and in Node (file loading + discovery)\n\n## Install\n\n```bash\nnpm i @angloqq03/ekr\n```\n\n## Quick usage (Vite/React/Vue/etc.)\n\n```ts\nimport { parseDotenv, pickRandom } from \"@angloqq03/ekr\";\n\nconst entries = parseDotenv(`\nKEY1=\"A\"\nKEY1=\"B\"\nKEY2=\"C\"\n`);\n\nconst chosen = pickRandom(entries, { key: \"KEY1\" });\nconsole.log(chosen.key, chosen.value);\n```\n\n## File formats\n\n### Dotenv-style (`.env`, `.txt`, `.keys`)\n\nAnything that looks like `KEY=\"VALUE\"` is supported:\n\n```env\nAPI_KEY=\"abc\"\nAPI_KEY=\"def\"\nOTHER=\"123\"\n```\n\nDuplicate keys are kept (so `pickRandom(..., { key: \"API_KEY\" })` makes sense).\n\n### JSON (`.json`)\n\nObject form:\n\n```json\n{ \"API_KEY\": \"abc\", \"OTHER\": \"123\" }\n```\n\nArray form:\n\n```json\n[{ \"key\": \"API_KEY\", \"value\": \"abc\" }, { \"key\": \"API_KEY\", \"value\": \"def\" }]\n```\n\n## Node usage (load from files)\n\n```ts\nimport { pickRandomFromFile } from \"@angloqq03/ekr/node\";\n\nconst entry = await pickRandomFromFile(\"./keys.env\", { key: \"API_KEY\" });\nconsole.log(entry);\n```\n\n### Auto-discover key files in a folder\n\n`pickRandomDiscovered()` searches a directory for supported files and picks from all of them.\n\n```ts\nimport { pickRandomDiscovered } from \"@angloqq03/ekr/node\";\n\nconst entry = await pickRandomDiscovered({ dir: process.cwd(), key: \"API_KEY\" });\nconsole.log(entry.key, entry.value, entry.sourcePath);\n```\n\nDiscovery includes common names like `.env`, `.env.local`, `.keys`, `keys.txt`, `keys.json` and will also scan the directory for files ending in `.env`, `.keys`, `.txt`, `.json`.\n\n## CLI\n\nAfter install:\n\n```bash\nnpx @angloqq03/ekr --file ./.env --key API_KEY\n```\n\nAuto-discover in the current directory:\n\n```bash\nnpx @angloqq03/ekr --dir . --show-source\n```\n\nOutput formats:\n\n```bash\nnpx @angloqq03/ekr --file ./keys.json --format json\nnpx @angloqq03/ekr --file ./keys.env --format value\n```\n\n## API\n\n- `parseDotenv(content, { keepDuplicates?: boolean })`\n- `parseJsonKeys(content)`\n- `pickRandom(entries, { key?: string, rng?: () => number })`\n- `toDotenvLine({ key, value })`\n- Node-only: `pickRandomFromFile(path, { key?, format? })`, `pickRandomDiscovered({ dir?, key? })`\n\n## Notes\n\n- This tool doesn’t modify your `.env` file. It just reads/parses and returns a value.\n- Treat key files as secrets: don’t commit real API keys to git, and don’t ship them to the browser unless you intend them to be public.\n","readmeFilename":"README.md"}