1.0.2 • Published 10 years ago

s3sign v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

s3sign.js

s3sign.js is a lightweight JavaScript library to generate signed S3 URLs. It can be run in a browser and in NodeJS. The s3sign.js library depends on CryptoJS.

The total unminified code size is 14.5 KB, which is much smaller than aws-sdk.js whose minified version is 239 KB today.

  • s3sign.js - 6.4 KB
  • CyrptoJS - 8.1 KB

Most of the code is a straight JavaScript port from the s3-signed-url Perl script.

Demo

You can see a demo here.

Usage

Browser

Include the following scripts in your HTML

  <script src="CryptoJS/hmac-sha1.js"></script>
  <script src="CryptoJS/enc-base64.js"></script>
  <script src="s3sign.js"></script>

Wherever you want to generate a signed URL, you can call

  <script type="text/javascript">
   var signedUrl = s3sign.generateSignedUrl(
        accessKey,            // AWS Access Key
        secretKey,            // AWS secret Key
        expiresInSeconds,     // Expiration time in seconds from now
        httpMethod,           // HTTP method. GET, POST, etc
        s3Bucket,             // Your S3 bucket name
        path                  // Path to your S3 key. Do not include the bucket name in this.
        );

  </script>

NodeJS

Installation:

Example code:

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago