diff --git a/README.md b/README.md index 937836878..6ee45b205 100644 --- a/README.md +++ b/README.md @@ -754,7 +754,7 @@ The first argument can be either a `url` or an `options` object. The only requir - `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. - `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above. - `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example). -- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. +- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first. - `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. --- diff --git a/package.json b/package.json index 7aefa7702..aeffc76ed 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "main": "index.js", "dependencies": { "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", "bl": "~1.0.0", "caseless": "~0.11.0", "combined-stream": "~1.0.5", @@ -52,6 +51,7 @@ "lint": "eslint lib/ *.js tests/ && echo Lint passed." }, "devDependencies": { + "aws4": "^1.2.1", "bluebird": "^3.0.2", "browserify": "^13.0.0", "browserify-istanbul": "^0.1.5", diff --git a/request.js b/request.js index 8dc900569..e4a181237 100644 --- a/request.js +++ b/request.js @@ -9,7 +9,6 @@ var http = require('http') , bl = require('bl') , hawk = require('hawk') , aws2 = require('aws-sign2') - , aws4 = require('aws4') , httpSignature = require('http-signature') , mime = require('mime-types') , stringstream = require('stringstream') @@ -1232,6 +1231,7 @@ Request.prototype.aws = function (opts, now) { } if (opts.sign_version == 4 || opts.sign_version == '4') { + var aws4 = require('aws4') // use aws4 var options = { host: self.uri.host,