{"action":"created","comment":{"url":"https://api.github.com/repos/spreedly/r2d2/pulls/comments/188063971","pull_request_review_id":119968180,"id":188063971,"diff_hunk":"@@ -0,0 +1,5 @@\n+{\n+  \"signature\": \"MEUCIQDzgQkY/Lj42FoZC9wN44Uz0r6uDttc68k2c9oZCzNJPwIgSRukEx30uMjqzFswekoarAtO9p1/E221hNmVuHzDW+M\\u003d\",\n+  \"protocolVersion\": \"ECv1\",","path":"test/fixtures/google/tokenized_card.json","position":3,"original_position":3,"commit_id":"cc60cd651c0d13d548f747c4e82b6fee117a3952","original_commit_id":"cc60cd651c0d13d548f747c4e82b6fee117a3952","user":{"login":"bdewater","id":496367,"avatar_url":"https://avatars1.githubusercontent.com/u/496367?v=4","gravatar_id":"","url":"https://api.github.com/users/bdewater","html_url":"https://github.com/bdewater","followers_url":"https://api.github.com/users/bdewater/followers","following_url":"https://api.github.com/users/bdewater/following{/other_user}","gists_url":"https://api.github.com/users/bdewater/gists{/gist_id}","starred_url":"https://api.github.com/users/bdewater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdewater/subscriptions","organizations_url":"https://api.github.com/users/bdewater/orgs","repos_url":"https://api.github.com/users/bdewater/repos","events_url":"https://api.github.com/users/bdewater/events{/privacy}","received_events_url":"https://api.github.com/users/bdewater/received_events","type":"User","site_admin":false},"body":"Android Pay was unversioned and [Google's documentation](https://developers.google.com/pay/api/web/resources/payment-data-cryptography) says in this case to assume `ECv0`. A factory method would definitely be nice to abstract this concern. I can add this somewhere this week.","created_at":"2018-05-14T19:05:15Z","updated_at":"2018-05-14T19:05:16Z","html_url":"https://github.com/spreedly/r2d2/pull/10#discussion_r188063971","pull_request_url":"https://api.github.com/repos/spreedly/r2d2/pulls/10","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/comments/188063971"},"html":{"href":"https://github.com/spreedly/r2d2/pull/10#discussion_r188063971"},"pull_request":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/10"}},"in_reply_to_id":186804066},"pull_request":{"url":"https://api.github.com/repos/spreedly/r2d2/pulls/10","id":151134618,"html_url":"https://github.com/spreedly/r2d2/pull/10","diff_url":"https://github.com/spreedly/r2d2/pull/10.diff","patch_url":"https://github.com/spreedly/r2d2/pull/10.patch","issue_url":"https://api.github.com/repos/spreedly/r2d2/issues/10","number":10,"state":"open","locked":false,"title":"Google Pay support","user":{"login":"bdewater","id":496367,"avatar_url":"https://avatars1.githubusercontent.com/u/496367?v=4","gravatar_id":"","url":"https://api.github.com/users/bdewater","html_url":"https://github.com/bdewater","followers_url":"https://api.github.com/users/bdewater/followers","following_url":"https://api.github.com/users/bdewater/following{/other_user}","gists_url":"https://api.github.com/users/bdewater/gists{/gist_id}","starred_url":"https://api.github.com/users/bdewater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdewater/subscriptions","organizations_url":"https://api.github.com/users/bdewater/orgs","repos_url":"https://api.github.com/users/bdewater/repos","events_url":"https://api.github.com/users/bdewater/events{/privacy}","received_events_url":"https://api.github.com/users/bdewater/received_events","type":"User","site_admin":false},"body":"This PR adds support for Google Pay tokens as returned by the Google Payment API. Google's announcement is [here](https://www.blog.google/topics/shopping-payments/pay-with-google-and-speed-through-checkout/) and the technical docs are [here](https://developers.google.com/payments/payment-data-cryptography).\r\n\r\nA tl;dr version is that what used to be known as 'Android Pay on the web' is now known as TOKENIZED_CARD, while CARD is the credit card stored on a Google account. In the browser both go through W3C Payment Request with the `https://google.com/pay` payment method. \r\n\r\nAll this is versioned as ECv1 in the technical docs, old Android Pay tokens are retconned as ECv0. For decryption, an important difference between ECv1 TOKENIZED_CARD and ECv0 is the 'info' parameter in the key derivation step. Other than that the algorithms are the same.\r\n\r\nECv1 data is signed by Google. A Google provided Merchant ID is needed to verify it. The URLs to fetch the keys can be found in the [Tink reference implementation](https://github.com/google/tink/blob/e81b0ca90962cf36ed1d6fa34ae046f99368c155/apps/paymentmethodtoken/src/main/java/com/google/crypto/tink/apps/paymentmethodtoken/GooglePaymentsPublicKeysManager.java#L60). An application should store the keys somewhere and respect the `expires` header to periodically refresh them. For now I've left this as an application concern. The code in this PR takes the parsed JSON and is able to handle multiple keys when Google rotates the keys.","created_at":"2017-11-07T14:55:07Z","updated_at":"2018-05-14T19:05:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"628cbf4daf7537f20628169ed26cc804f8fc8fb1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spreedly/r2d2/pulls/10/commits","review_comments_url":"https://api.github.com/repos/spreedly/r2d2/pulls/10/comments","review_comment_url":"https://api.github.com/repos/spreedly/r2d2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spreedly/r2d2/issues/10/comments","statuses_url":"https://api.github.com/repos/spreedly/r2d2/statuses/cc60cd651c0d13d548f747c4e82b6fee117a3952","head":{"label":"bdewater:scrappy-google-payment-tokens","ref":"scrappy-google-payment-tokens","sha":"cc60cd651c0d13d548f747c4e82b6fee117a3952","user":{"login":"bdewater","id":496367,"avatar_url":"https://avatars1.githubusercontent.com/u/496367?v=4","gravatar_id":"","url":"https://api.github.com/users/bdewater","html_url":"https://github.com/bdewater","followers_url":"https://api.github.com/users/bdewater/followers","following_url":"https://api.github.com/users/bdewater/following{/other_user}","gists_url":"https://api.github.com/users/bdewater/gists{/gist_id}","starred_url":"https://api.github.com/users/bdewater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdewater/subscriptions","organizations_url":"https://api.github.com/users/bdewater/orgs","repos_url":"https://api.github.com/users/bdewater/repos","events_url":"https://api.github.com/users/bdewater/events{/privacy}","received_events_url":"https://api.github.com/users/bdewater/received_events","type":"User","site_admin":false},"repo":{"id":108325159,"name":"r2d2","full_name":"bdewater/r2d2","owner":{"login":"bdewater","id":496367,"avatar_url":"https://avatars1.githubusercontent.com/u/496367?v=4","gravatar_id":"","url":"https://api.github.com/users/bdewater","html_url":"https://github.com/bdewater","followers_url":"https://api.github.com/users/bdewater/followers","following_url":"https://api.github.com/users/bdewater/following{/other_user}","gists_url":"https://api.github.com/users/bdewater/gists{/gist_id}","starred_url":"https://api.github.com/users/bdewater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdewater/subscriptions","organizations_url":"https://api.github.com/users/bdewater/orgs","repos_url":"https://api.github.com/users/bdewater/repos","events_url":"https://api.github.com/users/bdewater/events{/privacy}","received_events_url":"https://api.github.com/users/bdewater/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bdewater/r2d2","description":"Ruby library for decrypting Android Pay payment tokens","fork":true,"url":"https://api.github.com/repos/bdewater/r2d2","forks_url":"https://api.github.com/repos/bdewater/r2d2/forks","keys_url":"https://api.github.com/repos/bdewater/r2d2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bdewater/r2d2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bdewater/r2d2/teams","hooks_url":"https://api.github.com/repos/bdewater/r2d2/hooks","issue_events_url":"https://api.github.com/repos/bdewater/r2d2/issues/events{/number}","events_url":"https://api.github.com/repos/bdewater/r2d2/events","assignees_url":"https://api.github.com/repos/bdewater/r2d2/assignees{/user}","branches_url":"https://api.github.com/repos/bdewater/r2d2/branches{/branch}","tags_url":"https://api.github.com/repos/bdewater/r2d2/tags","blobs_url":"https://api.github.com/repos/bdewater/r2d2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bdewater/r2d2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bdewater/r2d2/git/refs{/sha}","trees_url":"https://api.github.com/repos/bdewater/r2d2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bdewater/r2d2/statuses/{sha}","languages_url":"https://api.github.com/repos/bdewater/r2d2/languages","stargazers_url":"https://api.github.com/repos/bdewater/r2d2/stargazers","contributors_url":"https://api.github.com/repos/bdewater/r2d2/contributors","subscribers_url":"https://api.github.com/repos/bdewater/r2d2/subscribers","subscription_url":"https://api.github.com/repos/bdewater/r2d2/subscription","commits_url":"https://api.github.com/repos/bdewater/r2d2/commits{/sha}","git_commits_url":"https://api.github.com/repos/bdewater/r2d2/git/commits{/sha}","comments_url":"https://api.github.com/repos/bdewater/r2d2/comments{/number}","issue_comment_url":"https://api.github.com/repos/bdewater/r2d2/issues/comments{/number}","contents_url":"https://api.github.com/repos/bdewater/r2d2/contents/{+path}","compare_url":"https://api.github.com/repos/bdewater/r2d2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bdewater/r2d2/merges","archive_url":"https://api.github.com/repos/bdewater/r2d2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bdewater/r2d2/downloads","issues_url":"https://api.github.com/repos/bdewater/r2d2/issues{/number}","pulls_url":"https://api.github.com/repos/bdewater/r2d2/pulls{/number}","milestones_url":"https://api.github.com/repos/bdewater/r2d2/milestones{/number}","notifications_url":"https://api.github.com/repos/bdewater/r2d2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bdewater/r2d2/labels{/name}","releases_url":"https://api.github.com/repos/bdewater/r2d2/releases{/id}","deployments_url":"https://api.github.com/repos/bdewater/r2d2/deployments","created_at":"2017-10-25T20:56:24Z","updated_at":"2017-10-25T20:56:26Z","pushed_at":"2018-02-14T09:34:54Z","git_url":"git://github.com/bdewater/r2d2.git","ssh_url":"git@github.com:bdewater/r2d2.git","clone_url":"https://github.com/bdewater/r2d2.git","svn_url":"https://github.com/bdewater/r2d2","homepage":"","size":229,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spreedly:master","ref":"master","sha":"3d3ec25ca8f08ab8ffd4d9950af94ae112505fa9","user":{"login":"spreedly","id":178292,"avatar_url":"https://avatars0.githubusercontent.com/u/178292?v=4","gravatar_id":"","url":"https://api.github.com/users/spreedly","html_url":"https://github.com/spreedly","followers_url":"https://api.github.com/users/spreedly/followers","following_url":"https://api.github.com/users/spreedly/following{/other_user}","gists_url":"https://api.github.com/users/spreedly/gists{/gist_id}","starred_url":"https://api.github.com/users/spreedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spreedly/subscriptions","organizations_url":"https://api.github.com/users/spreedly/orgs","repos_url":"https://api.github.com/users/spreedly/repos","events_url":"https://api.github.com/users/spreedly/events{/privacy}","received_events_url":"https://api.github.com/users/spreedly/received_events","type":"Organization","site_admin":false},"repo":{"id":47289832,"name":"r2d2","full_name":"spreedly/r2d2","owner":{"login":"spreedly","id":178292,"avatar_url":"https://avatars0.githubusercontent.com/u/178292?v=4","gravatar_id":"","url":"https://api.github.com/users/spreedly","html_url":"https://github.com/spreedly","followers_url":"https://api.github.com/users/spreedly/followers","following_url":"https://api.github.com/users/spreedly/following{/other_user}","gists_url":"https://api.github.com/users/spreedly/gists{/gist_id}","starred_url":"https://api.github.com/users/spreedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spreedly/subscriptions","organizations_url":"https://api.github.com/users/spreedly/orgs","repos_url":"https://api.github.com/users/spreedly/repos","events_url":"https://api.github.com/users/spreedly/events{/privacy}","received_events_url":"https://api.github.com/users/spreedly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spreedly/r2d2","description":"Ruby library for decrypting Android Pay payment tokens","fork":false,"url":"https://api.github.com/repos/spreedly/r2d2","forks_url":"https://api.github.com/repos/spreedly/r2d2/forks","keys_url":"https://api.github.com/repos/spreedly/r2d2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spreedly/r2d2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spreedly/r2d2/teams","hooks_url":"https://api.github.com/repos/spreedly/r2d2/hooks","issue_events_url":"https://api.github.com/repos/spreedly/r2d2/issues/events{/number}","events_url":"https://api.github.com/repos/spreedly/r2d2/events","assignees_url":"https://api.github.com/repos/spreedly/r2d2/assignees{/user}","branches_url":"https://api.github.com/repos/spreedly/r2d2/branches{/branch}","tags_url":"https://api.github.com/repos/spreedly/r2d2/tags","blobs_url":"https://api.github.com/repos/spreedly/r2d2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spreedly/r2d2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spreedly/r2d2/git/refs{/sha}","trees_url":"https://api.github.com/repos/spreedly/r2d2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spreedly/r2d2/statuses/{sha}","languages_url":"https://api.github.com/repos/spreedly/r2d2/languages","stargazers_url":"https://api.github.com/repos/spreedly/r2d2/stargazers","contributors_url":"https://api.github.com/repos/spreedly/r2d2/contributors","subscribers_url":"https://api.github.com/repos/spreedly/r2d2/subscribers","subscription_url":"https://api.github.com/repos/spreedly/r2d2/subscription","commits_url":"https://api.github.com/repos/spreedly/r2d2/commits{/sha}","git_commits_url":"https://api.github.com/repos/spreedly/r2d2/git/commits{/sha}","comments_url":"https://api.github.com/repos/spreedly/r2d2/comments{/number}","issue_comment_url":"https://api.github.com/repos/spreedly/r2d2/issues/comments{/number}","contents_url":"https://api.github.com/repos/spreedly/r2d2/contents/{+path}","compare_url":"https://api.github.com/repos/spreedly/r2d2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spreedly/r2d2/merges","archive_url":"https://api.github.com/repos/spreedly/r2d2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spreedly/r2d2/downloads","issues_url":"https://api.github.com/repos/spreedly/r2d2/issues{/number}","pulls_url":"https://api.github.com/repos/spreedly/r2d2/pulls{/number}","milestones_url":"https://api.github.com/repos/spreedly/r2d2/milestones{/number}","notifications_url":"https://api.github.com/repos/spreedly/r2d2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spreedly/r2d2/labels{/name}","releases_url":"https://api.github.com/repos/spreedly/r2d2/releases{/id}","deployments_url":"https://api.github.com/repos/spreedly/r2d2/deployments","created_at":"2015-12-02T21:32:24Z","updated_at":"2018-05-08T17:51:08Z","pushed_at":"2018-05-08T17:51:13Z","git_url":"git://github.com/spreedly/r2d2.git","ssh_url":"git@github.com:spreedly/r2d2.git","clone_url":"https://github.com/spreedly/r2d2.git","svn_url":"https://github.com/spreedly/r2d2","homepage":"","size":215,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/10"},"html":{"href":"https://github.com/spreedly/r2d2/pull/10"},"issue":{"href":"https://api.github.com/repos/spreedly/r2d2/issues/10"},"comments":{"href":"https://api.github.com/repos/spreedly/r2d2/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spreedly/r2d2/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/spreedly/r2d2/statuses/cc60cd651c0d13d548f747c4e82b6fee117a3952"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bdewater"}}