Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

registry-auth-token

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

registry-auth-token - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Change Log

## [4.1.0] - 2020-01-17
### Changes
- Add support for legacy auth token on the registry url (Gustav Blomér)
## [4.0.0] - 2019-06-17

@@ -7,0 +13,0 @@

@@ -8,2 +8,3 @@ var url = require('url')

var tokenKey = ':_authToken'
var legacyTokenKey = ':_auth'
var userKey = ':username'

@@ -84,2 +85,7 @@ var passwordKey = ':_password'

var basicAuthWithToken = getLegacyAuthToken(npmrc[regUrl + legacyTokenKey] || npmrc[regUrl + '/' + legacyTokenKey])
if (basicAuthWithToken) {
return basicAuthWithToken
}
return undefined

@@ -126,1 +132,12 @@ }

}
function getLegacyAuthToken (tok) {
if (!tok) {
return undefined
}
// check if legacy auth token is set as environment variable
var token = replaceEnvironmentVariable(tok)
return { token: token, type: 'Basic' }
}

2

package.json
{
"name": "registry-auth-token",
"version": "4.0.0",
"version": "4.1.0",
"description": "Get the auth token set for an npm registry (if any)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -303,2 +303,21 @@ var fs = require('fs')

it('should return basic token if _auth is base64 encoded', function (done) {
var content = [
'registry=http://registry.foobar.eu/',
'//registry.foobar.eu/:_auth=' + encodeBase64('foobar:foobar')
].join('\n')
fs.writeFile(npmRcPath, content, function (err) {
var getAuthToken = requireUncached('../index')
assert(!err, err)
var token = getAuthToken()
assert.deepStrictEqual(token, {
token: 'Zm9vYmFyOmZvb2Jhcg==',
type: 'Basic'
})
assert.strictEqual(decodeBase64(token.token), 'foobar:foobar')
done()
})
})
it('should return basic token if registry url has port specified', function (done) {

@@ -305,0 +324,0 @@ var content = [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc