{"name":"registry-auth-token","version":"5.1.0","keywords":["npm","conf","config","npmconf","registry","auth","token","authtoken"],"author":{"name":"Espen Hovlandsdal","email":"espen@hovlandsdal.com"},"license":"MIT","_id":"registry-auth-token@5.1.0","maintainers":[{"name":"rexxars","email":"espen@hovlandsdal.com"},{"name":"leipert","email":"git@leipert.io"},{"name":"zkochan","email":"z@kochan.io"}],"homepage":"https://github.com/rexxars/registry-auth-token#readme","bugs":{"url":"https://github.com/rexxars/registry-auth-token/issues"},"dist":{"shasum":"3c659047ecd4caebd25bc1570a3aa979ae490eca","tarball":"http://registry-npm.ywwl.com/registry-auth-token/download/registry-auth-token-5.1.0.tgz","fileCount":8,"integrity":"sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw==","signatures":[{"sig":"MEUCIQDv9zWtdyigylPUHbeZIpaD5e7E4oarOB8J/giFtrH5mwIgANg1O+E7sfhrtwMX1/3/51L1jW17nOmZQCQsKJZruuA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15777,"size":5772,"noattachment":false,"key":"/registry-auth-token/-/registry-auth-token-5.1.0.tgz"},"main":"index.js","types":"./index.d.ts","engines":{"node":">=14"},"gitHead":"66f7ed874cea3bacf925c7a29353a821a8a3d886","scripts":{"test":"mocha --require test/global-hooks.js","coverage":"istanbul cover _mocha","posttest":"standard"},"_npmUser":{"name":"rexxars","email":"espen@hovlandsdal.com"},"standard":{"ignore":["coverage/**"]},"repository":{"url":"git+ssh://git@github.com/rexxars/registry-auth-token.git","type":"git"},"_npmVersion":"11.1.0","description":"Get the auth token set for an npm registry (if any)","directories":{},"_nodeVersion":"22.12.0","dependencies":{"@pnpm/npm-conf":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.0.0","istanbul":"^0.4.2","standard":"^12.0.1","require-uncached":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/registry-auth-token_5.1.0_1738979142743_0.3278176661153196","host":"s3://npm-registry-packages-npm-production"},"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":1738979142947,"_cnpm_publish_time":1738979142947,"dist-tags":{"latest":"5.1.1"}}