{"name":"registry-auth-token","version":"5.0.3","description":"Get the auth token set for an npm registry (if any)","main":"index.js","scripts":{"test":"mocha --require test/global-hooks.js","posttest":"standard","coverage":"istanbul cover _mocha"},"repository":{"type":"git","url":"git+ssh://git@github.com/rexxars/registry-auth-token.git"},"engines":{"node":">=14"},"keywords":["npm","conf","config","npmconf","registry","auth","token","authtoken"],"author":{"name":"Espen Hovlandsdal","email":"espen@hovlandsdal.com"},"license":"MIT","bugs":{"url":"https://github.com/rexxars/registry-auth-token/issues"},"homepage":"https://github.com/rexxars/registry-auth-token#readme","dependencies":{"@pnpm/npm-conf":"^2.1.0"},"devDependencies":{"istanbul":"^0.4.2","mocha":"^10.0.0","require-uncached":"^1.0.2","standard":"^12.0.1"},"standard":{"ignore":["coverage/**"]},"_id":"registry-auth-token@5.0.3","gitHead":"ce45782c768f8a5f6c4e2b3967af228409fcf0c2","types":"./index.d.ts","_nodeVersion":"20.16.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-1bpc9IyC+e+CNFRaWyn77tk4xGG4PPUyfakSmA6F6cvUDjrm58dfyJ3II+9yb10EDkHoy1LaPSmHaWLOH3m6HA==","shasum":"417d758c8164569de8cf5cabff16cc937902dcc6","tarball":"http://registry-npm.ywwl.com/registry-auth-token/download/registry-auth-token-5.0.3.tgz","fileCount":8,"unpackedSize":15216,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAMKaEu0Rw3EAAJI7Wd10NwPysiiEmZZS1ETYIAx+0zJAiBHFhEE6JUczMlUhyCGY7tcRKDS7PgXDlc9LDomHJ9r2A=="}],"size":5516,"noattachment":false,"key":"/registry-auth-token/-/registry-auth-token-5.0.3.tgz"},"_npmUser":{"name":"rexxars","email":"espen@hovlandsdal.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/registry-auth-token_5.0.3_1732750233729_0.06230798466583365"},"_hasShrinkwrap":false,"readme":"# registry-auth-token\n\n[![npm version](http://img.shields.io/npm/v/registry-auth-token.svg?style=flat-square)](https://www.npmjs.com/package/registry-auth-token)[![npm](https://img.shields.io/npm/dm/registry-auth-token?style=flat-square)](https://www.npmjs.com/package/registry-auth-token)\n\nGet the auth token set for an npm registry from `.npmrc`. Also allows fetching the configured registry URL for a given npm scope.\n\n## Installing\n\n```\nnpm install --save registry-auth-token\n```\n\n## Usage\n\nReturns an object containing `token` and `type`, or `undefined` if no token can be found. `type` can be either `Bearer` or `Basic`.\n\n```js\nconst getAuthToken = require('registry-auth-token')\nconst getRegistryUrl = require('registry-auth-token/registry-url')\n\n// Get auth token and type for default `registry` set in `.npmrc`\nconsole.log(getAuthToken()) // {token: 'someToken', type: 'Bearer'}\n\n// Get auth token for a specific registry URL\nconsole.log(getAuthToken('//registry.foo.bar'))\n\n// Find the registry auth token for a given URL (with deep path):\n// If registry is at `//some.host/registry`\n// URL passed is `//some.host/registry/deep/path`\n// Will find token the closest matching path; `//some.host/registry`\nconsole.log(getAuthToken('//some.host/registry/deep/path', {recursive: true}))\n\n// Use the npm config that is passed in\nconsole.log(getAuthToken('//registry.foo.bar', {\n  npmrc: {\n    'registry': 'http://registry.foo.bar',\n    '//registry.foo.bar/:_authToken': 'qar'\n  }\n}))\n\n// Find the configured registry url for scope `@foobar`.\n// Falls back to the global registry if not defined.\nconsole.log(getRegistryUrl('@foobar'))\n\n// Use the npm config that is passed in\nconsole.log(getRegistryUrl('http://registry.foobar.eu/', {\n  'registry': 'http://registry.foobar.eu/',\n  '//registry.foobar.eu/:_authToken': 'qar'\n}))\n```\n\n## Return value\n\n```js\n// If auth info can be found:\n{token: 'someToken', type: 'Bearer'}\n\n// Or:\n{token: 'someOtherToken', type: 'Basic'}\n\n// Or, if nothing is found:\nundefined\n```\n\n## Security\n\nPlease be careful when using this. Leaking your auth token is dangerous.\n\n## License\n\nMIT © [Espen Hovlandsdal](https://espen.codes/)\n","publish_time":1732750233908,"maintainers":[{"name":"rexxars","email":"espen@hovlandsdal.com"},{"name":"leipert","email":"git@leipert.io"},{"name":"zkochan","email":"z@kochan.io"}],"_cnpm_publish_time":1732750233908,"dist-tags":{"latest":"5.1.1"}}