From 9ad99006e452e6a883f8a0115beef3015f35d511 Mon Sep 17 00:00:00 2001 From: danikp Date: Wed, 19 Aug 2015 20:04:31 +0300 Subject: [PATCH 1/2] update ibrowse to latest fix few warnings --- rebar.config | 2 +- src/ddb.erl | 4 ++-- src/ddb_iam.erl | 2 +- src/ddb_util.erl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rebar.config b/rebar.config index 615bd6a..cd58c5e 100644 --- a/rebar.config +++ b/rebar.config @@ -5,7 +5,7 @@ {deps, [ {jsx, ".*", {git, "git://github.com/talentdeficit/jsx.git", {tag, "v2.7.0"}}}, - {ibrowse, "", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.0.2"}}} + {ibrowse, "", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.1.2"}}} ]}. {require_otp_vsn, "R16|17|18"}. diff --git a/src/ddb.erl b/src/ddb.erl index 4b5c16f..da4a318 100644 --- a/src/ddb.erl +++ b/src/ddb.erl @@ -511,8 +511,8 @@ authorization(AccessKeyId, SecretAccessKey, Headers, Body) -> signature(SecretAccessKey, Headers, Body) -> StringToSign = lists:flatten(["POST", $\n, "/", $\n, $\n, canonical(Headers), $\n, Body]), - BytesToSign = crypto:sha(StringToSign), - base64:encode_to_string(binary_to_list(crypto:sha_mac(SecretAccessKey, BytesToSign))). + BytesToSign = crypto:hash(sha, StringToSign), + base64:encode_to_string(binary_to_list(crypto:hmac(sha, SecretAccessKey, BytesToSign))). -spec canonical(proplists:proplist()) -> [_]. diff --git a/src/ddb_iam.erl b/src/ddb_iam.erl index c95df77..9f55f25 100644 --- a/src/ddb_iam.erl +++ b/src/ddb_iam.erl @@ -93,7 +93,7 @@ request(Action, Endpoint, Duration) -> CanonicalString = mochiweb_util:urlencode(lists:sort(Args)), #url{host=Host, path=Path} = ibrowse_lib:parse_url(Endpoint), S = ["POST", $\n, Host, $\n, Path, $\n, CanonicalString], - Signature = base64:encode_to_string(crypto:sha_mac(SecretAccessKey, S)), + Signature = base64:encode_to_string(crypto:hmac(sha, SecretAccessKey, S)), Args1 = [{"Signature", Signature}|Args], Body = iolist_to_binary(mochiweb_util:urlencode(lists:sort(Args1))), F = fun() -> ibrowse:send_req(Endpoint, [{'Content-type', ?MIME_TYPE}], 'post', Body, []) end, diff --git a/src/ddb_util.erl b/src/ddb_util.erl index 2aff8ce..05f1980 100644 --- a/src/ddb_util.erl +++ b/src/ddb_util.erl @@ -72,7 +72,7 @@ first([{value, _} = R | _]) -> R. %% @end -spec epoch() -> integer(). epoch() -> - {MS, S, _US} = now(), + {MS, S, _US} = os:timestamp(), MS * 1000000 + S. %% @doc Generate the number of seconds since Epoch to `DateTime' From 786c6ed301848310262f58744af6e36d7e1bd9f4 Mon Sep 17 00:00:00 2001 From: danikp Date: Wed, 19 Aug 2015 20:25:22 +0300 Subject: [PATCH 2/2] update for release --- src/ddb.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ddb.app.src b/src/ddb.app.src index 2071fed..bc7d0b6 100644 --- a/src/ddb.app.src +++ b/src/ddb.app.src @@ -4,7 +4,7 @@ {application, ddb, [ {description, "AWS DynamoDB client"}, - {vsn, "0.1.2"}, + {vsn, "0.1.3"}, {registered, [ddb_sup]}, {applications, [ kernel,