https://github.com/brianfoshee/s3post
Go packages to create and sign policies for browser-based file uploads to AWS S3
https://github.com/brianfoshee/s3post
aws s3
Last synced: about 2 months ago
JSON representation
Go packages to create and sign policies for browser-based file uploads to AWS S3
- Host: GitHub
- URL: https://github.com/brianfoshee/s3post
- Owner: brianfoshee
- License: mit
- Created: 2016-10-07T02:38:24.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2022-01-28T00:13:56.000Z (over 4 years ago)
- Last Synced: 2025-10-26T20:43:39.597Z (9 months ago)
- Topics: aws, s3
- Language: Go
- Homepage: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html
- Size: 41 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://travis-ci.org/brianfoshee/s3post)
[](https://godoc.org/github.com/brianfoshee/s3post)
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][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][pdocs].
The [policy][policy] package can be used to generate these documents if
necessary.
```go
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:
[](http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html#sigv4-post-signature-calc)
[docs]: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html
[pdocs]: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html
[policy]: https://github.com/brianfoshee/s3post/tree/master/policy