Skip to content

Commit

Permalink
release v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
handnot2 committed Jun 5, 2017
1 parent a48434d commit 7a48c82
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## Changelog

### v0.5.0

Fixes:

- Handle normalization of path segments during signature computation (issue #6)

The `normalize-path` tests in the AWS Signature V4 testsuite pass with
with fix.

### v0.4.0

Fixes:
Expand Down
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,53 @@ end
+ [Module Doc](https://hexdocs.pm/sigaws)
+ [Plug built using this](https://hexdocs.pm/plug_sigaws)

## Examples

### Signature to be passed as request headers

url = "http://api.endpoint.host:5000/somthing?a=10&b=20"
headers = %{"header1" => "value1", "header2" => "value2"}
{:ok, %{} = sig_data, _} =
Sigaws.sign_req(url,
headers: headers,
region: "delta-quad",
service: "my-service",
access_key: "some-access-key",
secret: "some-secret")

{:ok, resp} = HTTPoison.get(url, Map.merge(headers, sig_data))

### Signature to be passed in query string ("presigned" URL)

url = "http://api.endpoint.host:5000/somthing?a=10&b=20"
{:ok, %{} = sig_data, _} =
Sigaws.sign_url(url,
body: :unsigned,
expires_in: 5 * 60, # 5 minutes
region: "delta-quad",
service: "my-service",
access_key: "some-access-key",
secret: "some-secret")

presigned_url = Sigaws.Util.add_params_to_url(url, sig_data)

### Signature Verification

The verification process relies on a provider module that implements
`Sigaws.Provider` behavior. The provider is expected to supply the signing
key based on the information present in the context (primarily the access key).

{:ok, %Sigaws.Ctxt{} = ctxt} =
Sigaws.Verify(conn.request_path,
method: conn.method,
params: conn.query_params,
headers: conn.req_headers,
body: get_raw_body(conn),
provider: SigawsQuickStartProvider)

The above example is using the `sigaws_quickstart_provider` Hex package.
Check the blog listed earlier.

## Test Suite

Part of the tests in this package rely on AWS Signature Version 4 Test Suite.
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Sigaws.Mixfile do
use Mix.Project

@version "0.4.0"
@version "0.5.0"
@description """
An Elixir library to sign and verify HTTP requests using AWS Signature V4.
"""
Expand Down

0 comments on commit 7a48c82

Please sign in to comment.