aws-sign

v1.0.1-beta.0
Calculates Authorization header for Amazon AWS REST requests

node-aws-sign

Simple module to calculate Authorization header for Amazon AWS REST requests.

Simple it is:

const AwsSign = require('aws-sign');
const signer = new AwsSign({
    accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
    secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
});

const opts = {
    method: 'PUT',
    host: 'johnsmith.s3.amazonaws.com',
    path: '/photos/puppy.jpg',
    headers: { ... },
    ... // Other request options, ignored by AwsSign.
};
signer.sign(opts);
https.request(opts, ...);

The following keys are mandatory:

  • method
  • host
  • path

Others are optional. A date header (headers.date) will be added for you if it is not already set.

Non-goals

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 Date header.

Multiple x-amz- keys are not supported. I.e. the following part of the example won't work:

X-Amz-Meta-ReviewedBy: [email protected]
X-Amz-Meta-ReviewedBy: [email protected]

Use a single header instead:

X-Amz-Meta-ReviewedBy: [email protected],[email protected]

Testing

mocha test/

Installation

npm install aws-sign

Author

Egor Egorov, [email protected].

License

MIT.

Metadata

  • MIT
  • Whatever
  • Egor Egorov
  • released 11/12/2020

Downloads