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.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, 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'