11defmodule ExAws.Auth do
22 import ExAws.Auth.Utils
3- alias Timex.DateFormat
43
54 @ moduledoc false
65
76 def headers ( http_method , url , service , config , headers , body ) do
8- now = % { Timex.Date . now | ms: 0 }
7+ now = :os . timestamp |> :calendar . now_to_universal_time
98 headers = [
109 { "host" , URI . parse ( url ) . host } ,
1110 { "x-amz-date" , amz_date ( now ) } |
@@ -32,8 +31,8 @@ defmodule ExAws.Auth do
3231 end
3332 def handle_temp_credentials ( headers , _ ) , do: headers
3433
35- def auth_header ( access_key , secret_key , http_method , url , region , service , headers , body , now ) do
36- date = DateFormat . format! ( now , "%Y%m%d" , :strftime )
34+ def auth_header ( access_key , secret_key , http_method , url , region , service , headers , body , { date , _ } = now ) do
35+ date = date |> quasi_iso_format
3736 scope = "#{ date } /#{ region } /#{ service } /aws4_request"
3837
3938 signing_key = build_signing_key ( secret_key , date , region , service )
@@ -59,8 +58,8 @@ defmodule ExAws.Auth do
5958 end
6059
6160 def build_string_to_sign ( canonical_request , now , scope ) do
62- timestamp = now |> ExAws.Auth.Utils . amz_date
63- hashed_canonical_request = ExAws.Auth.Utils . hash_sha256 ( canonical_request )
61+ timestamp = now |> amz_date
62+ hashed_canonical_request = hash_sha256 ( canonical_request )
6463
6564 [
6665 "AWS4-HMAC-SHA256" , "\n " ,
0 commit comments