node-box-sdk
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -15,3 +15,5 @@ var _ = require('lodash'); | ||
config = _.merge(config, options); | ||
utils.configure(options.encrypt); | ||
if (options.encrypt) { | ||
utils.configure(config.encrypt); | ||
} | ||
}; | ||
@@ -67,3 +69,3 @@ | ||
options._tokens = res.body; | ||
options.tokens = utils.encrypt(res.body); | ||
options.tokens = config.encrypt ? utils.encrypt(res.body) : res.body; | ||
@@ -142,3 +144,3 @@ if (options.headers) | ||
if (options.tokens) { | ||
options._tokens = utils.decrypt(options.tokens); | ||
options._tokens = config.encrypt ? utils.decrypt(options.tokens) : options.tokens; | ||
options.headers.Authorization = 'Bearer ' + options._tokens.access_token; | ||
@@ -145,0 +147,0 @@ |
{ | ||
"name": "node-box-sdk", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Node.js Box SDK", | ||
@@ -11,2 +11,6 @@ "main": "box.js", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cydneymikel/node-box-sdk" | ||
}, | ||
"dependencies": { | ||
@@ -25,3 +29,8 @@ "async": "^1.2.0", | ||
"mocha": "^2.2.4" | ||
} | ||
} | ||
}, | ||
"keywords": [ | ||
"Box", | ||
"Box API", | ||
"File Sharing" | ||
] | ||
} |
@@ -39,6 +39,6 @@ # Node.js Box SDK | ||
box.configure({ | ||
client_id: 'content_api_client_id', | ||
client_secret: 'content_api_client_secret', | ||
api_key: 'view_api_client_secret', | ||
encrypt: { password: 'pick_a_password' } | ||
client_id: 'content_api_client_id', // REQUIRED | ||
client_secret: 'content_api_client_secret', // REQUIRED | ||
api_key: 'view_api_client_secret', // REQUIRED | ||
encrypt: { password: 'pick_a_password' } // OPTIONAL | ||
}); | ||
@@ -45,0 +45,0 @@ |
@@ -5,6 +5,3 @@ var config = require('../test/config'); | ||
logLevel: 'error', | ||
pageSettings: { | ||
userName: config.username, | ||
password: config.password | ||
} | ||
pageSettings: config.headlessClient | ||
}); | ||
@@ -11,0 +8,0 @@ casper.options.waitTimeout = 10000; |
@@ -13,8 +13,3 @@ var box = require('../box'); | ||
var redirect; | ||
box.configure({ | ||
client_id: config.client_id, | ||
client_secret: config.client_secret, | ||
api_key: config.api_key, | ||
encrypt: { password: config.encrypt.password } | ||
}); | ||
box.configure(config.box); | ||
global.box = box; | ||
@@ -54,5 +49,8 @@ | ||
it('should generate encrypted tokens for user', function(done) { | ||
it('should generate tokens for user', function(done) { | ||
box.generateToken({ authorization_code: code }, function(err, tokens) { | ||
expect(tokens).to.be.a('string'); | ||
if (config.box.encrypt) | ||
expect(tokens).to.be.a('string'); | ||
else | ||
expect(tokens).to.be.an('object'); | ||
@@ -59,0 +57,0 @@ global.options = { tokens: tokens }; |
{ | ||
"client_id": "", | ||
"client_secret": "", | ||
"api_key": "", | ||
"encrypt": { "password": "node-box" }, | ||
"username": "", | ||
"password": "" | ||
"box": { | ||
"client_id": "", //required | ||
"client_secret": "", //required | ||
"api_key": "", //required | ||
"encrypt": { "password": "" } //optional | ||
}, | ||
"headlessClient": { | ||
"userName": "", //required for tests | ||
"password": "" //required for tests | ||
} | ||
} |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
316672
959
2