{"action":"created","comment":{"url":"https://api.github.com/repos/optiopay/x/pulls/comments/78964461","id":78964461,"diff_hunk":"@@ -100,9 +108,27 @@ func (v *Verifier) Parse(token string, payload interface{}) (err error) {\n \tif err != nil {\n \t\treturn fmt.Errorf(\"could not verify token: %s\", err)\n \t}\n-\terr = json.Unmarshal(raw, payload)\n+\tcontent := tokenContent{\n+\t\tPayload: payload,\n+\t}\n+\terr = json.Unmarshal(raw, &content)\n \tif err != nil {\n \t\treturn fmt.Errorf(\"could not decode payload: %s\", err)\n \t}\n+\tif when.After(content.Expiry) {\n+\t\treturn fmt.Errorf(\"token has expired\")\n+\t}\n \treturn nil\n }\n+\n+// Decode validates the token at the current time and extracts the payload from it.\n+//\n+// The payload must be a pointer to the interface and must be JSON decodable.\n+func (v *Decoder) Decode(token string, payload interface{}) error {\n+\treturn v.DecodeAsOf(time.Now(), token, payload)\n+}\n+\n+type tokenContent struct {\n+\tExpiry  time.Time   `json:\"expiry\"`","path":"tokens/tokens.go","position":140,"original_position":140,"commit_id":"9565713270357e49faf6383bd8cf0065d0bce7a5","original_commit_id":"9565713270357e49faf6383bd8cf0065d0bce7a5","user":{"login":"jeremyhuiskamp","id":35500,"avatar_url":"https://avatars.githubusercontent.com/u/35500?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyhuiskamp","html_url":"https://github.com/jeremyhuiskamp","followers_url":"https://api.github.com/users/jeremyhuiskamp/followers","following_url":"https://api.github.com/users/jeremyhuiskamp/following{/other_user}","gists_url":"https://api.github.com/users/jeremyhuiskamp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyhuiskamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyhuiskamp/subscriptions","organizations_url":"https://api.github.com/users/jeremyhuiskamp/orgs","repos_url":"https://api.github.com/users/jeremyhuiskamp/repos","events_url":"https://api.github.com/users/jeremyhuiskamp/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyhuiskamp/received_events","type":"User","site_admin":false},"body":"We're not compliant with that definition of `exp` (we serialize as an ISO8601 date while `exp` apparently requires a number).  As we have not made any effort to implement the claims spec, and as \"expiry\" is a better name than \"exp\" (in my opinion anyway), I'm inclined to not bother.","created_at":"2016-09-15T13:36:13Z","updated_at":"2016-09-15T13:36:13Z","html_url":"https://github.com/optiopay/x/pull/10#discussion_r78964461","pull_request_url":"https://api.github.com/repos/optiopay/x/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/optiopay/x/pulls/comments/78964461"},"html":{"href":"https://github.com/optiopay/x/pull/10#discussion_r78964461"},"pull_request":{"href":"https://api.github.com/repos/optiopay/x/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/optiopay/x/pulls/10","id":85266428,"html_url":"https://github.com/optiopay/x/pull/10","diff_url":"https://github.com/optiopay/x/pull/10.diff","patch_url":"https://github.com/optiopay/x/pull/10.patch","issue_url":"https://api.github.com/repos/optiopay/x/issues/10","number":10,"state":"open","locked":false,"title":"Tokens cleanup","user":{"login":"jeremyhuiskamp","id":35500,"avatar_url":"https://avatars.githubusercontent.com/u/35500?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyhuiskamp","html_url":"https://github.com/jeremyhuiskamp","followers_url":"https://api.github.com/users/jeremyhuiskamp/followers","following_url":"https://api.github.com/users/jeremyhuiskamp/following{/other_user}","gists_url":"https://api.github.com/users/jeremyhuiskamp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyhuiskamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyhuiskamp/subscriptions","organizations_url":"https://api.github.com/users/jeremyhuiskamp/orgs","repos_url":"https://api.github.com/users/jeremyhuiskamp/repos","events_url":"https://api.github.com/users/jeremyhuiskamp/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyhuiskamp/received_events","type":"User","site_admin":false},"body":"Refactoring based on code review, and building in expiry support.\r\n\r\nNB: you can no longer opt out of expiry except by choosing a date ridiculously far in the future.","created_at":"2016-09-14T16:59:30Z","updated_at":"2016-09-15T13:36:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8eb4cefb407d0f37828c47f536e7332b84b433d1","assignee":{"login":"alpe","id":28003,"avatar_url":"https://avatars.githubusercontent.com/u/28003?v=3","gravatar_id":"","url":"https://api.github.com/users/alpe","html_url":"https://github.com/alpe","followers_url":"https://api.github.com/users/alpe/followers","following_url":"https://api.github.com/users/alpe/following{/other_user}","gists_url":"https://api.github.com/users/alpe/gists{/gist_id}","starred_url":"https://api.github.com/users/alpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpe/subscriptions","organizations_url":"https://api.github.com/users/alpe/orgs","repos_url":"https://api.github.com/users/alpe/repos","events_url":"https://api.github.com/users/alpe/events{/privacy}","received_events_url":"https://api.github.com/users/alpe/received_events","type":"User","site_admin":false},"assignees":[{"login":"alpe","id":28003,"avatar_url":"https://avatars.githubusercontent.com/u/28003?v=3","gravatar_id":"","url":"https://api.github.com/users/alpe","html_url":"https://github.com/alpe","followers_url":"https://api.github.com/users/alpe/followers","following_url":"https://api.github.com/users/alpe/following{/other_user}","gists_url":"https://api.github.com/users/alpe/gists{/gist_id}","starred_url":"https://api.github.com/users/alpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpe/subscriptions","organizations_url":"https://api.github.com/users/alpe/orgs","repos_url":"https://api.github.com/users/alpe/repos","events_url":"https://api.github.com/users/alpe/events{/privacy}","received_events_url":"https://api.github.com/users/alpe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/optiopay/x/pulls/10/commits","review_comments_url":"https://api.github.com/repos/optiopay/x/pulls/10/comments","review_comment_url":"https://api.github.com/repos/optiopay/x/pulls/comments{/number}","comments_url":"https://api.github.com/repos/optiopay/x/issues/10/comments","statuses_url":"https://api.github.com/repos/optiopay/x/statuses/9565713270357e49faf6383bd8cf0065d0bce7a5","head":{"label":"optiopay:tokens-cleanup","ref":"tokens-cleanup","sha":"9565713270357e49faf6383bd8cf0065d0bce7a5","user":{"login":"optiopay","id":9194339,"avatar_url":"https://avatars.githubusercontent.com/u/9194339?v=3","gravatar_id":"","url":"https://api.github.com/users/optiopay","html_url":"https://github.com/optiopay","followers_url":"https://api.github.com/users/optiopay/followers","following_url":"https://api.github.com/users/optiopay/following{/other_user}","gists_url":"https://api.github.com/users/optiopay/gists{/gist_id}","starred_url":"https://api.github.com/users/optiopay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optiopay/subscriptions","organizations_url":"https://api.github.com/users/optiopay/orgs","repos_url":"https://api.github.com/users/optiopay/repos","events_url":"https://api.github.com/users/optiopay/events{/privacy}","received_events_url":"https://api.github.com/users/optiopay/received_events","type":"Organization","site_admin":false},"repo":{"id":55596148,"name":"x","full_name":"optiopay/x","owner":{"login":"optiopay","id":9194339,"avatar_url":"https://avatars.githubusercontent.com/u/9194339?v=3","gravatar_id":"","url":"https://api.github.com/users/optiopay","html_url":"https://github.com/optiopay","followers_url":"https://api.github.com/users/optiopay/followers","following_url":"https://api.github.com/users/optiopay/following{/other_user}","gists_url":"https://api.github.com/users/optiopay/gists{/gist_id}","starred_url":"https://api.github.com/users/optiopay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optiopay/subscriptions","organizations_url":"https://api.github.com/users/optiopay/orgs","repos_url":"https://api.github.com/users/optiopay/repos","events_url":"https://api.github.com/users/optiopay/events{/privacy}","received_events_url":"https://api.github.com/users/optiopay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optiopay/x","description":"","fork":false,"url":"https://api.github.com/repos/optiopay/x","forks_url":"https://api.github.com/repos/optiopay/x/forks","keys_url":"https://api.github.com/repos/optiopay/x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optiopay/x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optiopay/x/teams","hooks_url":"https://api.github.com/repos/optiopay/x/hooks","issue_events_url":"https://api.github.com/repos/optiopay/x/issues/events{/number}","events_url":"https://api.github.com/repos/optiopay/x/events","assignees_url":"https://api.github.com/repos/optiopay/x/assignees{/user}","branches_url":"https://api.github.com/repos/optiopay/x/branches{/branch}","tags_url":"https://api.github.com/repos/optiopay/x/tags","blobs_url":"https://api.github.com/repos/optiopay/x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optiopay/x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optiopay/x/git/refs{/sha}","trees_url":"https://api.github.com/repos/optiopay/x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optiopay/x/statuses/{sha}","languages_url":"https://api.github.com/repos/optiopay/x/languages","stargazers_url":"https://api.github.com/repos/optiopay/x/stargazers","contributors_url":"https://api.github.com/repos/optiopay/x/contributors","subscribers_url":"https://api.github.com/repos/optiopay/x/subscribers","subscription_url":"https://api.github.com/repos/optiopay/x/subscription","commits_url":"https://api.github.com/repos/optiopay/x/commits{/sha}","git_commits_url":"https://api.github.com/repos/optiopay/x/git/commits{/sha}","comments_url":"https://api.github.com/repos/optiopay/x/comments{/number}","issue_comment_url":"https://api.github.com/repos/optiopay/x/issues/comments{/number}","contents_url":"https://api.github.com/repos/optiopay/x/contents/{+path}","compare_url":"https://api.github.com/repos/optiopay/x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optiopay/x/merges","archive_url":"https://api.github.com/repos/optiopay/x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optiopay/x/downloads","issues_url":"https://api.github.com/repos/optiopay/x/issues{/number}","pulls_url":"https://api.github.com/repos/optiopay/x/pulls{/number}","milestones_url":"https://api.github.com/repos/optiopay/x/milestones{/number}","notifications_url":"https://api.github.com/repos/optiopay/x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optiopay/x/labels{/name}","releases_url":"https://api.github.com/repos/optiopay/x/releases{/id}","deployments_url":"https://api.github.com/repos/optiopay/x/deployments","created_at":"2016-04-06T10:14:51Z","updated_at":"2016-08-04T09:43:02Z","pushed_at":"2016-09-15T08:09:17Z","git_url":"git://github.com/optiopay/x.git","ssh_url":"git@github.com:optiopay/x.git","clone_url":"https://github.com/optiopay/x.git","svn_url":"https://github.com/optiopay/x","homepage":null,"size":43,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"optiopay:master","ref":"master","sha":"2b6e3e5d95a0a9290650eb832fa51ceaf9460401","user":{"login":"optiopay","id":9194339,"avatar_url":"https://avatars.githubusercontent.com/u/9194339?v=3","gravatar_id":"","url":"https://api.github.com/users/optiopay","html_url":"https://github.com/optiopay","followers_url":"https://api.github.com/users/optiopay/followers","following_url":"https://api.github.com/users/optiopay/following{/other_user}","gists_url":"https://api.github.com/users/optiopay/gists{/gist_id}","starred_url":"https://api.github.com/users/optiopay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optiopay/subscriptions","organizations_url":"https://api.github.com/users/optiopay/orgs","repos_url":"https://api.github.com/users/optiopay/repos","events_url":"https://api.github.com/users/optiopay/events{/privacy}","received_events_url":"https://api.github.com/users/optiopay/received_events","type":"Organization","site_admin":false},"repo":{"id":55596148,"name":"x","full_name":"optiopay/x","owner":{"login":"optiopay","id":9194339,"avatar_url":"https://avatars.githubusercontent.com/u/9194339?v=3","gravatar_id":"","url":"https://api.github.com/users/optiopay","html_url":"https://github.com/optiopay","followers_url":"https://api.github.com/users/optiopay/followers","following_url":"https://api.github.com/users/optiopay/following{/other_user}","gists_url":"https://api.github.com/users/optiopay/gists{/gist_id}","starred_url":"https://api.github.com/users/optiopay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optiopay/subscriptions","organizations_url":"https://api.github.com/users/optiopay/orgs","repos_url":"https://api.github.com/users/optiopay/repos","events_url":"https://api.github.com/users/optiopay/events{/privacy}","received_events_url":"https://api.github.com/users/optiopay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optiopay/x","description":"","fork":false,"url":"https://api.github.com/repos/optiopay/x","forks_url":"https://api.github.com/repos/optiopay/x/forks","keys_url":"https://api.github.com/repos/optiopay/x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optiopay/x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optiopay/x/teams","hooks_url":"https://api.github.com/repos/optiopay/x/hooks","issue_events_url":"https://api.github.com/repos/optiopay/x/issues/events{/number}","events_url":"https://api.github.com/repos/optiopay/x/events","assignees_url":"https://api.github.com/repos/optiopay/x/assignees{/user}","branches_url":"https://api.github.com/repos/optiopay/x/branches{/branch}","tags_url":"https://api.github.com/repos/optiopay/x/tags","blobs_url":"https://api.github.com/repos/optiopay/x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optiopay/x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optiopay/x/git/refs{/sha}","trees_url":"https://api.github.com/repos/optiopay/x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optiopay/x/statuses/{sha}","languages_url":"https://api.github.com/repos/optiopay/x/languages","stargazers_url":"https://api.github.com/repos/optiopay/x/stargazers","contributors_url":"https://api.github.com/repos/optiopay/x/contributors","subscribers_url":"https://api.github.com/repos/optiopay/x/subscribers","subscription_url":"https://api.github.com/repos/optiopay/x/subscription","commits_url":"https://api.github.com/repos/optiopay/x/commits{/sha}","git_commits_url":"https://api.github.com/repos/optiopay/x/git/commits{/sha}","comments_url":"https://api.github.com/repos/optiopay/x/comments{/number}","issue_comment_url":"https://api.github.com/repos/optiopay/x/issues/comments{/number}","contents_url":"https://api.github.com/repos/optiopay/x/contents/{+path}","compare_url":"https://api.github.com/repos/optiopay/x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optiopay/x/merges","archive_url":"https://api.github.com/repos/optiopay/x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optiopay/x/downloads","issues_url":"https://api.github.com/repos/optiopay/x/issues{/number}","pulls_url":"https://api.github.com/repos/optiopay/x/pulls{/number}","milestones_url":"https://api.github.com/repos/optiopay/x/milestones{/number}","notifications_url":"https://api.github.com/repos/optiopay/x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optiopay/x/labels{/name}","releases_url":"https://api.github.com/repos/optiopay/x/releases{/id}","deployments_url":"https://api.github.com/repos/optiopay/x/deployments","created_at":"2016-04-06T10:14:51Z","updated_at":"2016-08-04T09:43:02Z","pushed_at":"2016-09-15T08:09:17Z","git_url":"git://github.com/optiopay/x.git","ssh_url":"git@github.com:optiopay/x.git","clone_url":"https://github.com/optiopay/x.git","svn_url":"https://github.com/optiopay/x","homepage":null,"size":43,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/optiopay/x/pulls/10"},"html":{"href":"https://github.com/optiopay/x/pull/10"},"issue":{"href":"https://api.github.com/repos/optiopay/x/issues/10"},"comments":{"href":"https://api.github.com/repos/optiopay/x/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/optiopay/x/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/optiopay/x/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/optiopay/x/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/optiopay/x/statuses/9565713270357e49faf6383bd8cf0065d0bce7a5"}}}}
{"actor":{"display_login":"jeremyhuiskamp"}}