/s3post

Go packages to create and sign policies for browser-based file uploads to AWS S3

Primary LanguageGoMIT LicenseMIT

Build Status GoDoc

Package s3post signs POST policy documents for browser-based file uploads to AWS S3. More details on browser-based file uploads can be found in the AWS docs.

Both s3post and policy packages use only stdlib deps, no aws sdk required.

Usage

To use this package, generate a POST policy document then pass that policy into the Sign method to receive a signature to be used in a POST form.

Details on Policy documents can be found in the AWS docs.

The policy package can be used to generate these documents if necessary.

p := s3post.New("us-east-1", secret)
encoded, signed := p.Sign(policyBytes)

See the examples folder for complete usage.

Signature details

The policy document is signed using this calculation:

Signature Calculation