Calculates Authorization header for Amazon AWS REST requests
Simple module to calculate
Authorization header for Amazon AWS REST requests.
Simple it is:
var AwsSign = ;var signer =accessKeyId: 'AKIAIOSFODNN7EXAMPLE'secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY';var opts =method: 'PUT'host: 'johnsmith.s3.amazonaws.com'path: '/photos/puppy.jpg'headers: ...... // Other request options, ignored by AwsSign.;signer;https;
The following keys are mandatory:
Others are optional. A date header (
headers.date) will be added for you if it is not already set.
Node.js has no legacy ;-) so there is no need to support some legacy features of Amazon API for older software. I.e. there is no support for path-style bucket access.
x-amz-date substitution is not supported because Node's http module has no problems setting
x-amz- keys are not supported. I.e. the following part of the example won't work:
X-Amz-Meta-ReviewedBy: firstname.lastname@example.org X-Amz-Meta-ReviewedBy: email@example.com
Use a single header instead:
0.1.x supports the same options as http.request (thanks to Ben Trask).
auth = signer;http;
var opts =method: 'PUT'host: 'johnsmith.s3.amazonaws.com'path: '/photos/puppy.jpg'headers:date: 'Tue, 27 Mar 2007 21:15:45 +0000'contentType: 'image/jpeg';signer;http;
npm install aws-sign
Egor Egorov, firstname.lastname@example.org.