{"action":"created","comment":{"url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/comments/172158262","pull_request_review_id":101126849,"id":172158262,"diff_hunk":"@@ -126,3 +127,75 @@\n         headers (assoc headers \"Authorization\" auth)]\n     (assoc req :headers headers)))\n \n+\n+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n+;; Signing a request v2\n+;; https://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/HMACAuth.html#REST_RESTAuth\n+\n+(def x-amz-date-formatter-sign-2\n+  (java.time.format.DateTimeFormatter/ofPattern \"yyyy-MM-dd'T'HH:mm:ss'Z'\"))\n+\n+(defn- hmac-sha-256-sign2\n+   [^bytes secret ^String s]\n+   (-> (javax.crypto.Mac/getInstance \"HmacSHA256\")\n+         (doto (.init (javax.crypto.spec.SecretKeySpec. secret \"HmacSHA256\")))\n+         (.doFinal (.getBytes s \"UTF8\"))))\n+\n+(defn- utf8-natural-byte-cmp\n+   \"Sort the UTF-8 query string components by parameter name with natural byte ordering.\n+   I wonder if it really matters for the input we deal with\"\n+   [^String a ^String b]\n+   (let [sa a sb b\n+         a (.getBytes a \"UTF8\")\n+         b (.getBytes b \"UTF8\")\n+         n (min (alength a) (alength b))]\n+        (loop [i 0]\n+          (if (< i n)\n+            (let [r (- (aget a i) (aget b i))]\n+               (if (zero? r)\n+                 (recur (inc i))\n+                 r))\n+            (- (alength a) (alength b))))))\n+\n+(defn- create-canonicalized-query-string-v2\n+   \"Step 1 : Create a canonicalized query-string for building the signature v2.\"\n+   [& {:keys [query-params]}]\n+   (x/str\n+     (comp\n+       (x/sort-by key utf8-natural-byte-cmp)\n+       (x/for [[k v] %]\n+              (str (codec/url-encode k) \"=\" (codec/url-encode v)))","path":"src/portkey/awssig.clj","position":51,"original_position":51,"commit_id":"152126929fcf818f81afe98ca9cb7e03790044b3","original_commit_id":"152126929fcf818f81afe98ca9cb7e03790044b3","user":{"login":"cgrand","id":47025,"avatar_url":"https://avatars0.githubusercontent.com/u/47025?v=4","gravatar_id":"","url":"https://api.github.com/users/cgrand","html_url":"https://github.com/cgrand","followers_url":"https://api.github.com/users/cgrand/followers","following_url":"https://api.github.com/users/cgrand/following{/other_user}","gists_url":"https://api.github.com/users/cgrand/gists{/gist_id}","starred_url":"https://api.github.com/users/cgrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgrand/subscriptions","organizations_url":"https://api.github.com/users/cgrand/orgs","repos_url":"https://api.github.com/users/cgrand/repos","events_url":"https://api.github.com/users/cgrand/events{/privacy}","received_events_url":"https://api.github.com/users/cgrand/received_events","type":"User","site_admin":false},"body":"Don't forget to the check the hexadecimal digits produced by the encoder are all caps (as required for canonicalization)","created_at":"2018-03-05T11:30:16Z","updated_at":"2018-03-05T11:30:17Z","html_url":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17#discussion_r172158262","pull_request_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/comments/172158262"},"html":{"href":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17#discussion_r172158262"},"pull_request":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17"}},"in_reply_to_id":172101417},"pull_request":{"url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17","id":172724724,"html_url":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17","diff_url":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17.diff","patch_url":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17.patch","issue_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/17","number":17,"state":"open","locked":false,"title":"Feat/sign2","user":{"login":"dupuchba","id":911705,"avatar_url":"https://avatars2.githubusercontent.com/u/911705?v=4","gravatar_id":"","url":"https://api.github.com/users/dupuchba","html_url":"https://github.com/dupuchba","followers_url":"https://api.github.com/users/dupuchba/followers","following_url":"https://api.github.com/users/dupuchba/following{/other_user}","gists_url":"https://api.github.com/users/dupuchba/gists{/gist_id}","starred_url":"https://api.github.com/users/dupuchba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dupuchba/subscriptions","organizations_url":"https://api.github.com/users/dupuchba/orgs","repos_url":"https://api.github.com/users/dupuchba/repos","events_url":"https://api.github.com/users/dupuchba/events{/privacy}","received_events_url":"https://api.github.com/users/dupuchba/received_events","type":"User","site_admin":false},"body":"Signing a request with the v2 protocol\r\nWorking BUT\r\nVersion is hardcoded and `query` protocol generation has not been done yet so it's not tested on all services","created_at":"2018-03-04T15:25:14Z","updated_at":"2018-03-05T11:30:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7abc18cc2f8747ff80390ad9bf6725e6dc86e6bb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17/commits","review_comments_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17/comments","review_comment_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/17/comments","statuses_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/statuses/152126929fcf818f81afe98ca9cb7e03790044b3","head":{"label":"dupuchba:feat/sign2","ref":"feat/sign2","sha":"152126929fcf818f81afe98ca9cb7e03790044b3","user":{"login":"dupuchba","id":911705,"avatar_url":"https://avatars2.githubusercontent.com/u/911705?v=4","gravatar_id":"","url":"https://api.github.com/users/dupuchba","html_url":"https://github.com/dupuchba","followers_url":"https://api.github.com/users/dupuchba/followers","following_url":"https://api.github.com/users/dupuchba/following{/other_user}","gists_url":"https://api.github.com/users/dupuchba/gists{/gist_id}","starred_url":"https://api.github.com/users/dupuchba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dupuchba/subscriptions","organizations_url":"https://api.github.com/users/dupuchba/orgs","repos_url":"https://api.github.com/users/dupuchba/repos","events_url":"https://api.github.com/users/dupuchba/events{/privacy}","received_events_url":"https://api.github.com/users/dupuchba/received_events","type":"User","site_admin":false},"repo":{"id":122183999,"name":"aws-clj-sdk","full_name":"dupuchba/aws-clj-sdk","owner":{"login":"dupuchba","id":911705,"avatar_url":"https://avatars2.githubusercontent.com/u/911705?v=4","gravatar_id":"","url":"https://api.github.com/users/dupuchba","html_url":"https://github.com/dupuchba","followers_url":"https://api.github.com/users/dupuchba/followers","following_url":"https://api.github.com/users/dupuchba/following{/other_user}","gists_url":"https://api.github.com/users/dupuchba/gists{/gist_id}","starred_url":"https://api.github.com/users/dupuchba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dupuchba/subscriptions","organizations_url":"https://api.github.com/users/dupuchba/orgs","repos_url":"https://api.github.com/users/dupuchba/repos","events_url":"https://api.github.com/users/dupuchba/events{/privacy}","received_events_url":"https://api.github.com/users/dupuchba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dupuchba/aws-clj-sdk","description":"Clojure bindings for AWS","fork":true,"url":"https://api.github.com/repos/dupuchba/aws-clj-sdk","forks_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/forks","keys_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/teams","hooks_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/hooks","issue_events_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/events","assignees_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/tags","blobs_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/languages","stargazers_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/stargazers","contributors_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/contributors","subscribers_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/subscribers","subscription_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/subscription","commits_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/merges","archive_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/downloads","issues_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/labels{/name}","releases_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/dupuchba/aws-clj-sdk/deployments","created_at":"2018-02-20T10:28:55Z","updated_at":"2018-02-20T10:28:59Z","pushed_at":"2018-03-05T10:20:57Z","git_url":"git://github.com/dupuchba/aws-clj-sdk.git","ssh_url":"git@github.com:dupuchba/aws-clj-sdk.git","clone_url":"https://github.com/dupuchba/aws-clj-sdk.git","svn_url":"https://github.com/dupuchba/aws-clj-sdk","homepage":null,"size":3733,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"portkey-cloud:master","ref":"master","sha":"b51107ad7c0472ab23360cbcbb50dd9f963cdca8","user":{"login":"portkey-cloud","id":31487802,"avatar_url":"https://avatars0.githubusercontent.com/u/31487802?v=4","gravatar_id":"","url":"https://api.github.com/users/portkey-cloud","html_url":"https://github.com/portkey-cloud","followers_url":"https://api.github.com/users/portkey-cloud/followers","following_url":"https://api.github.com/users/portkey-cloud/following{/other_user}","gists_url":"https://api.github.com/users/portkey-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/portkey-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portkey-cloud/subscriptions","organizations_url":"https://api.github.com/users/portkey-cloud/orgs","repos_url":"https://api.github.com/users/portkey-cloud/repos","events_url":"https://api.github.com/users/portkey-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/portkey-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":102049239,"name":"aws-clj-sdk","full_name":"portkey-cloud/aws-clj-sdk","owner":{"login":"portkey-cloud","id":31487802,"avatar_url":"https://avatars0.githubusercontent.com/u/31487802?v=4","gravatar_id":"","url":"https://api.github.com/users/portkey-cloud","html_url":"https://github.com/portkey-cloud","followers_url":"https://api.github.com/users/portkey-cloud/followers","following_url":"https://api.github.com/users/portkey-cloud/following{/other_user}","gists_url":"https://api.github.com/users/portkey-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/portkey-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portkey-cloud/subscriptions","organizations_url":"https://api.github.com/users/portkey-cloud/orgs","repos_url":"https://api.github.com/users/portkey-cloud/repos","events_url":"https://api.github.com/users/portkey-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/portkey-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/portkey-cloud/aws-clj-sdk","description":"Clojure bindings for AWS","fork":false,"url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk","forks_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/forks","keys_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/teams","hooks_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/hooks","issue_events_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/events","assignees_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/tags","blobs_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/languages","stargazers_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/stargazers","contributors_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/contributors","subscribers_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/subscribers","subscription_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/subscription","commits_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/merges","archive_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/downloads","issues_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/labels{/name}","releases_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/deployments","created_at":"2017-08-31T22:03:04Z","updated_at":"2018-02-27T17:03:06Z","pushed_at":"2018-03-04T15:25:14Z","git_url":"git://github.com/portkey-cloud/aws-clj-sdk.git","ssh_url":"git@github.com:portkey-cloud/aws-clj-sdk.git","clone_url":"https://github.com/portkey-cloud/aws-clj-sdk.git","svn_url":"https://github.com/portkey-cloud/aws-clj-sdk","homepage":null,"size":3698,"stargazers_count":78,"watchers_count":78,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":14,"license":null,"forks":6,"open_issues":14,"watchers":78,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17"},"html":{"href":"https://github.com/portkey-cloud/aws-clj-sdk/pull/17"},"issue":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/17"},"comments":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/portkey-cloud/aws-clj-sdk/statuses/152126929fcf818f81afe98ca9cb7e03790044b3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cgrand"}}