GitHub PullRequestReviewCommentEvent at 2014-09-02 07:20:34
Repository: fernet-go
Actor: kr
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/fernet/fernet-go/pulls/comments/16973117","id":16973117,"diff_hunk":"@@ -137,32 +139,113 @@ func genhmac(q, p, k []byte) {\n \th.Sum(q)\n }\n \n+type reader struct {\n+\tkeys []*Key\n+\tttl  time.Duration\n+\tr    io.Reader\n+\tbuf  *bytes.Buffer\n+\terr  error\n+}\n+\n+func (r *reader) Read(p []byte) (n int, err error) {\n+\tif r.err != nil {\n+\t\treturn 0, r.err\n+\t}\n+\n+\tif r.buf == nil {\n+\t\tr.buf = &bytes.Buffer{}\n+\t\tif _, r.err = io.Copy(r.buf, r.r); r.err != nil {\n+\t\t\treturn 0, r.err\n+\t\t}\n+\t\tfor _, k := range r.keys {\n+\t\t\tmsg := verify(nil, r.buf.Bytes(), r.ttl, time.Now(), k)\n+\t\t\tif msg != nil {\n+\t\t\t\tr.buf = bytes.NewBuffer(msg)\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn r.buf.Read(p)\n+}\n+\n+func (r *reader) Reset() {\n+\tr.buf = nil\n+}\n+\n+func NewReader(keys []*Key, ttl time.Duration, r io.Reader) io.Reader {\n+\treturn &reader{keys: keys, ttl: ttl, r: r}\n+}\n+\n+type writer struct {\n+\tkey *Key\n+\tw   io.Writer\n+\tbuf *bytes.Buffer\n+\terr error\n+\tiv  []byte\n+}\n+\n+func (w *writer) Write(p []byte) (n int, err error) {\n+\tif w.err != nil {\n+\t\treturn 0, w.err\n+\t}\n+\n+\treturn w.buf.Write(p)\n+}\n+\n+func (w *writer) Close() error {\n+\tif w.err != nil {\n+\t\treturn w.err\n+\t}\n+\n+\t// Initialize IV\n+\tiv := make([]byte, aes.BlockSize)\n+\tio.ReadFull(rand.Reader, iv)\n+\n+\tb := make([]byte, encodedLen(w.buf.Len()))\n+\tn := gen(b, w.buf.Bytes(), iv, time.Now(), w.key)\n+\n+\tif _, w.err = io.Copy(w.w, bytes.NewBuffer(b[:n])); w.err != nil {","path":"fernet.go","position":85,"original_position":85,"commit_id":"b2d78f2f14eed9c256fb0f68bae2287d74cbc0b9","original_commit_id":"b2d78f2f14eed9c256fb0f68bae2287d74cbc0b9","user":{"login":"kr","id":4178,"avatar_url":"https://avatars.githubusercontent.com/u/4178?v=2","gravatar_id":"b88d0f594813e7c5cd925043396738a7","url":"https://api.github.com/users/kr","html_url":"https://github.com/kr","followers_url":"https://api.github.com/users/kr/followers","following_url":"https://api.github.com/users/kr/following{/other_user}","gists_url":"https://api.github.com/users/kr/gists{/gist_id}","starred_url":"https://api.github.com/users/kr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kr/subscriptions","organizations_url":"https://api.github.com/users/kr/orgs","repos_url":"https://api.github.com/users/kr/repos","events_url":"https://api.github.com/users/kr/events{/privacy}","received_events_url":"https://api.github.com/users/kr/received_events","type":"User","site_admin":false},"body":"_, w.err = w.w.Write(b[:n])","created_at":"2014-09-02T07:20:34Z","updated_at":"2014-09-02T07:20:34Z","html_url":"https://github.com/fernet/fernet-go/pull/10#discussion_r16973117","pull_request_url":"https://api.github.com/repos/fernet/fernet-go/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/comments/16973117"},"html":{"href":"https://github.com/fernet/fernet-go/pull/10#discussion_r16973117"},"pull_request":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/fernet/fernet-go/pulls/10","id":20594635,"html_url":"https://github.com/fernet/fernet-go/pull/10","diff_url":"https://github.com/fernet/fernet-go/pull/10.diff","patch_url":"https://github.com/fernet/fernet-go/pull/10.patch","issue_url":"https://api.github.com/repos/fernet/fernet-go/issues/10","number":10,"state":"open","locked":false,"title":"Add a \"sponge\" reader and writer","user":{"login":"cyberdelia","id":44535,"avatar_url":"https://avatars.githubusercontent.com/u/44535?v=2","gravatar_id":"5a810a7779b19a5ac9e6cffa8531eee6","url":"https://api.github.com/users/cyberdelia","html_url":"https://github.com/cyberdelia","followers_url":"https://api.github.com/users/cyberdelia/followers","following_url":"https://api.github.com/users/cyberdelia/following{/other_user}","gists_url":"https://api.github.com/users/cyberdelia/gists{/gist_id}","starred_url":"https://api.github.com/users/cyberdelia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyberdelia/subscriptions","organizations_url":"https://api.github.com/users/cyberdelia/orgs","repos_url":"https://api.github.com/users/cyberdelia/repos","events_url":"https://api.github.com/users/cyberdelia/events{/privacy}","received_events_url":"https://api.github.com/users/cyberdelia/received_events","type":"User","site_admin":false},"body":"This is a substandard implementation of #8.\r\nThis would close #7, since the ``base64`` encoding is now optional.","created_at":"2014-09-02T06:50:01Z","updated_at":"2014-09-02T07:20:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfb0cc19b67828323c879f03c39a302d67237b78","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fernet/fernet-go/pulls/10/commits","review_comments_url":"https://api.github.com/repos/fernet/fernet-go/pulls/10/comments","review_comment_url":"https://api.github.com/repos/fernet/fernet-go/pulls/comments/{number}","comments_url":"https://api.github.com/repos/fernet/fernet-go/issues/10/comments","statuses_url":"https://api.github.com/repos/fernet/fernet-go/statuses/b2d78f2f14eed9c256fb0f68bae2287d74cbc0b9","head":{"label":"cyberdelia:io","ref":"io","sha":"b2d78f2f14eed9c256fb0f68bae2287d74cbc0b9","user":{"login":"cyberdelia","id":44535,"avatar_url":"https://avatars.githubusercontent.com/u/44535?v=2","gravatar_id":"5a810a7779b19a5ac9e6cffa8531eee6","url":"https://api.github.com/users/cyberdelia","html_url":"https://github.com/cyberdelia","followers_url":"https://api.github.com/users/cyberdelia/followers","following_url":"https://api.github.com/users/cyberdelia/following{/other_user}","gists_url":"https://api.github.com/users/cyberdelia/gists{/gist_id}","starred_url":"https://api.github.com/users/cyberdelia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyberdelia/subscriptions","organizations_url":"https://api.github.com/users/cyberdelia/orgs","repos_url":"https://api.github.com/users/cyberdelia/repos","events_url":"https://api.github.com/users/cyberdelia/events{/privacy}","received_events_url":"https://api.github.com/users/cyberdelia/received_events","type":"User","site_admin":false},"repo":{"id":23560099,"name":"fernet-go","full_name":"cyberdelia/fernet-go","owner":{"login":"cyberdelia","id":44535,"avatar_url":"https://avatars.githubusercontent.com/u/44535?v=2","gravatar_id":"5a810a7779b19a5ac9e6cffa8531eee6","url":"https://api.github.com/users/cyberdelia","html_url":"https://github.com/cyberdelia","followers_url":"https://api.github.com/users/cyberdelia/followers","following_url":"https://api.github.com/users/cyberdelia/following{/other_user}","gists_url":"https://api.github.com/users/cyberdelia/gists{/gist_id}","starred_url":"https://api.github.com/users/cyberdelia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyberdelia/subscriptions","organizations_url":"https://api.github.com/users/cyberdelia/orgs","repos_url":"https://api.github.com/users/cyberdelia/repos","events_url":"https://api.github.com/users/cyberdelia/events{/privacy}","received_events_url":"https://api.github.com/users/cyberdelia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cyberdelia/fernet-go","description":"Fernet generates and verifies HMAC-based authentication tokens.","fork":true,"url":"https://api.github.com/repos/cyberdelia/fernet-go","forks_url":"https://api.github.com/repos/cyberdelia/fernet-go/forks","keys_url":"https://api.github.com/repos/cyberdelia/fernet-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyberdelia/fernet-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyberdelia/fernet-go/teams","hooks_url":"https://api.github.com/repos/cyberdelia/fernet-go/hooks","issue_events_url":"https://api.github.com/repos/cyberdelia/fernet-go/issues/events{/number}","events_url":"https://api.github.com/repos/cyberdelia/fernet-go/events","assignees_url":"https://api.github.com/repos/cyberdelia/fernet-go/assignees{/user}","branches_url":"https://api.github.com/repos/cyberdelia/fernet-go/branches{/branch}","tags_url":"https://api.github.com/repos/cyberdelia/fernet-go/tags","blobs_url":"https://api.github.com/repos/cyberdelia/fernet-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyberdelia/fernet-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyberdelia/fernet-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyberdelia/fernet-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyberdelia/fernet-go/statuses/{sha}","languages_url":"https://api.github.com/repos/cyberdelia/fernet-go/languages","stargazers_url":"https://api.github.com/repos/cyberdelia/fernet-go/stargazers","contributors_url":"https://api.github.com/repos/cyberdelia/fernet-go/contributors","subscribers_url":"https://api.github.com/repos/cyberdelia/fernet-go/subscribers","subscription_url":"https://api.github.com/repos/cyberdelia/fernet-go/subscription","commits_url":"https://api.github.com/repos/cyberdelia/fernet-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyberdelia/fernet-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyberdelia/fernet-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyberdelia/fernet-go/issues/comments/{number}","contents_url":"https://api.github.com/repos/cyberdelia/fernet-go/contents/{+path}","compare_url":"https://api.github.com/repos/cyberdelia/fernet-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyberdelia/fernet-go/merges","archive_url":"https://api.github.com/repos/cyberdelia/fernet-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyberdelia/fernet-go/downloads","issues_url":"https://api.github.com/repos/cyberdelia/fernet-go/issues{/number}","pulls_url":"https://api.github.com/repos/cyberdelia/fernet-go/pulls{/number}","milestones_url":"https://api.github.com/repos/cyberdelia/fernet-go/milestones{/number}","notifications_url":"https://api.github.com/repos/cyberdelia/fernet-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyberdelia/fernet-go/labels{/name}","releases_url":"https://api.github.com/repos/cyberdelia/fernet-go/releases{/id}","created_at":"2014-09-02T00:55:55Z","updated_at":"2014-07-24T13:00:10Z","pushed_at":"2014-09-02T06:45:24Z","git_url":"git://github.com/cyberdelia/fernet-go.git","ssh_url":"git@github.com:cyberdelia/fernet-go.git","clone_url":"https://github.com/cyberdelia/fernet-go.git","svn_url":"https://github.com/cyberdelia/fernet-go","homepage":"http://godoc.org/github.com/fernet/fernet-go","size":102,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fernet:master","ref":"master","sha":"54c3c8fb9a0701721fceaa28780ce25ef447fd4f","user":{"login":"fernet","id":5376898,"avatar_url":"https://avatars.githubusercontent.com/u/5376898?v=2","gravatar_id":null,"url":"https://api.github.com/users/fernet","html_url":"https://github.com/fernet","followers_url":"https://api.github.com/users/fernet/followers","following_url":"https://api.github.com/users/fernet/following{/other_user}","gists_url":"https://api.github.com/users/fernet/gists{/gist_id}","starred_url":"https://api.github.com/users/fernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernet/subscriptions","organizations_url":"https://api.github.com/users/fernet/orgs","repos_url":"https://api.github.com/users/fernet/repos","events_url":"https://api.github.com/users/fernet/events{/privacy}","received_events_url":"https://api.github.com/users/fernet/received_events","type":"Organization","site_admin":false},"repo":{"id":7401858,"name":"fernet-go","full_name":"fernet/fernet-go","owner":{"login":"fernet","id":5376898,"avatar_url":"https://avatars.githubusercontent.com/u/5376898?v=2","gravatar_id":null,"url":"https://api.github.com/users/fernet","html_url":"https://github.com/fernet","followers_url":"https://api.github.com/users/fernet/followers","following_url":"https://api.github.com/users/fernet/following{/other_user}","gists_url":"https://api.github.com/users/fernet/gists{/gist_id}","starred_url":"https://api.github.com/users/fernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernet/subscriptions","organizations_url":"https://api.github.com/users/fernet/orgs","repos_url":"https://api.github.com/users/fernet/repos","events_url":"https://api.github.com/users/fernet/events{/privacy}","received_events_url":"https://api.github.com/users/fernet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fernet/fernet-go","description":"Fernet generates and verifies HMAC-based authentication tokens.","fork":false,"url":"https://api.github.com/repos/fernet/fernet-go","forks_url":"https://api.github.com/repos/fernet/fernet-go/forks","keys_url":"https://api.github.com/repos/fernet/fernet-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fernet/fernet-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fernet/fernet-go/teams","hooks_url":"https://api.github.com/repos/fernet/fernet-go/hooks","issue_events_url":"https://api.github.com/repos/fernet/fernet-go/issues/events{/number}","events_url":"https://api.github.com/repos/fernet/fernet-go/events","assignees_url":"https://api.github.com/repos/fernet/fernet-go/assignees{/user}","branches_url":"https://api.github.com/repos/fernet/fernet-go/branches{/branch}","tags_url":"https://api.github.com/repos/fernet/fernet-go/tags","blobs_url":"https://api.github.com/repos/fernet/fernet-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fernet/fernet-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fernet/fernet-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/fernet/fernet-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fernet/fernet-go/statuses/{sha}","languages_url":"https://api.github.com/repos/fernet/fernet-go/languages","stargazers_url":"https://api.github.com/repos/fernet/fernet-go/stargazers","contributors_url":"https://api.github.com/repos/fernet/fernet-go/contributors","subscribers_url":"https://api.github.com/repos/fernet/fernet-go/subscribers","subscription_url":"https://api.github.com/repos/fernet/fernet-go/subscription","commits_url":"https://api.github.com/repos/fernet/fernet-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/fernet/fernet-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/fernet/fernet-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/fernet/fernet-go/issues/comments/{number}","contents_url":"https://api.github.com/repos/fernet/fernet-go/contents/{+path}","compare_url":"https://api.github.com/repos/fernet/fernet-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fernet/fernet-go/merges","archive_url":"https://api.github.com/repos/fernet/fernet-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fernet/fernet-go/downloads","issues_url":"https://api.github.com/repos/fernet/fernet-go/issues{/number}","pulls_url":"https://api.github.com/repos/fernet/fernet-go/pulls{/number}","milestones_url":"https://api.github.com/repos/fernet/fernet-go/milestones{/number}","notifications_url":"https://api.github.com/repos/fernet/fernet-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fernet/fernet-go/labels{/name}","releases_url":"https://api.github.com/repos/fernet/fernet-go/releases{/id}","created_at":"2013-01-02T03:24:23Z","updated_at":"2014-07-24T13:00:10Z","pushed_at":"2013-09-04T02:58:23Z","git_url":"git://github.com/fernet/fernet-go.git","ssh_url":"git@github.com:fernet/fernet-go.git","clone_url":"https://github.com/fernet/fernet-go.git","svn_url":"https://github.com/fernet/fernet-go","homepage":"http://godoc.org/github.com/fernet/fernet-go","size":152,"stargazers_count":25,"watchers_count":25,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/10"},"html":{"href":"https://github.com/fernet/fernet-go/pull/10"},"issue":{"href":"https://api.github.com/repos/fernet/fernet-go/issues/10"},"comments":{"href":"https://api.github.com/repos/fernet/fernet-go/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/fernet/fernet-go/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/fernet/fernet-go/statuses/b2d78f2f14eed9c256fb0f68bae2287d74cbc0b9"}}}}