{"action":"created","comment":{"url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/comments/180395431","pull_request_review_id":110802503,"id":180395431,"diff_hunk":"@@ -26,6 +26,52 @@ public class SignHostApiClient\n \t\tprivate readonly ISignHostApiClientSettings settings;\n \t\tprivate readonly HttpClient client;\n \n+\t\tpublic static bool IsPostbackChecksumValid(\n+\t\t\tIDictionary<string, string[]> headers,\n+\t\t\tstring body,\n+\t\t\tstring sharedSecret,\n+\t\t\tout Transaction postbackTransaction)\n+\t\t{\n+\t\t\tpostbackTransaction = null;\n+\t\t\tstring[] postbackChecksumArray;\n+\t\t\tstring postbackChecksum;\n+\t\t\tstring calculatedChecksum;\n+\t\t\tPostback postback;\n+\n+\t\t\ttry {\n+\t\t\t\tpostback = JsonConvert.DeserializeObject<Postback>(body);\n+\t\t\t\tpostbackTransaction = postback;\n+\t\t\t} catch (InvalidCastException e) {\n+\t\t\t\treturn false;\n+\t\t\t} catch {\n+\t\t\t\treturn false;\n+\t\t\t}\n+\n+\t\t\tif (headers.ContainsKey(\"Checksum\")) {\n+\t\t\t\theaders.TryGetValue(\"Checksum\", out postbackChecksumArray);\n+\t\t\t\tpostbackChecksum = postbackChecksumArray.First();\n+\t\t\t} else {\n+\t\t\t\tpostbackChecksum = postback.Checksum;\n+\t\t\t}\n+\n+\t\t\tif (!string.IsNullOrEmpty(postbackTransaction.Id) &&\n+\t\t\t\t!string.IsNullOrEmpty(postbackChecksum)) {\n+\t\t\t\tusing (var sha1 = SHA1.Create()) {\n+\t\t\t\t\tvar preCalculatedChecksum = sha1.ComputeHash(Encoding.UTF8.GetBytes(\n+\t\t\t\t\t\t$\"{postbackTransaction.Id}||\" +\n+\t\t\t\t\t\t$\"{(int)postbackTransaction.Status}|\" +\n+\t\t\t\t\t\t$\"{sharedSecret}\"));\n+\t\t\t\t\tcalculatedChecksum = BitConverter.ToString(\n+\t\t\t\t\t\tpreCalculatedChecksum)\n+ \t\t\t\t\t\t.Replace(\"-\", string.Empty)\n+\t\t\t\t\t\t.ToLower();\n+\t\t\t\t}\n+\t\t\t} else {","path":"src/SignhostAPIClient/Rest/SignHostApiClient.cs","position":44,"original_position":44,"commit_id":"e05b3acb7e3945e65273f4c27498d6cdfd80a154","original_commit_id":"e05b3acb7e3945e65273f4c27498d6cdfd80a154","user":{"login":"MrJoe","id":134532,"avatar_url":"https://avatars3.githubusercontent.com/u/134532?v=4","gravatar_id":"","url":"https://api.github.com/users/MrJoe","html_url":"https://github.com/MrJoe","followers_url":"https://api.github.com/users/MrJoe/followers","following_url":"https://api.github.com/users/MrJoe/following{/other_user}","gists_url":"https://api.github.com/users/MrJoe/gists{/gist_id}","starred_url":"https://api.github.com/users/MrJoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrJoe/subscriptions","organizations_url":"https://api.github.com/users/MrJoe/orgs","repos_url":"https://api.github.com/users/MrJoe/repos","events_url":"https://api.github.com/users/MrJoe/events{/privacy}","received_events_url":"https://api.github.com/users/MrJoe/received_events","type":"User","site_admin":false},"body":"Should be:\r\n```\r\n}\r\nelse {\r\n```","created_at":"2018-04-10T12:10:02Z","updated_at":"2018-04-10T12:10:39Z","html_url":"https://github.com/Evidos/SignhostClientLibrary/pull/20#discussion_r180395431","pull_request_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/comments/180395431"},"html":{"href":"https://github.com/Evidos/SignhostClientLibrary/pull/20#discussion_r180395431"},"pull_request":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20","id":153061613,"html_url":"https://github.com/Evidos/SignhostClientLibrary/pull/20","diff_url":"https://github.com/Evidos/SignhostClientLibrary/pull/20.diff","patch_url":"https://github.com/Evidos/SignhostClientLibrary/pull/20.patch","issue_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/20","number":20,"state":"open","locked":false,"title":"SIG-1752 Validate postback checksum","user":{"login":"Nuss9","id":24221025,"avatar_url":"https://avatars3.githubusercontent.com/u/24221025?v=4","gravatar_id":"","url":"https://api.github.com/users/Nuss9","html_url":"https://github.com/Nuss9","followers_url":"https://api.github.com/users/Nuss9/followers","following_url":"https://api.github.com/users/Nuss9/following{/other_user}","gists_url":"https://api.github.com/users/Nuss9/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuss9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuss9/subscriptions","organizations_url":"https://api.github.com/users/Nuss9/orgs","repos_url":"https://api.github.com/users/Nuss9/repos","events_url":"https://api.github.com/users/Nuss9/events{/privacy}","received_events_url":"https://api.github.com/users/Nuss9/received_events","type":"User","site_admin":false},"body":"The method IsPostbackChecksumValid accepts a postback and shared secret, both as strings. \r\nThe parameters Transaction Id and Status will be taken from the postback, and together with the given shared secret a formula will calculate the checksum. When this calculated checksum matches with the postback's checksum, the method will return true, all other outcomes will result in false.","created_at":"2017-11-16T14:54:00Z","updated_at":"2018-04-10T12:10:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33324d7ee93c7a693ffae1240f3be2d79aabae83","assignee":{"login":"Nuss9","id":24221025,"avatar_url":"https://avatars3.githubusercontent.com/u/24221025?v=4","gravatar_id":"","url":"https://api.github.com/users/Nuss9","html_url":"https://github.com/Nuss9","followers_url":"https://api.github.com/users/Nuss9/followers","following_url":"https://api.github.com/users/Nuss9/following{/other_user}","gists_url":"https://api.github.com/users/Nuss9/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuss9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuss9/subscriptions","organizations_url":"https://api.github.com/users/Nuss9/orgs","repos_url":"https://api.github.com/users/Nuss9/repos","events_url":"https://api.github.com/users/Nuss9/events{/privacy}","received_events_url":"https://api.github.com/users/Nuss9/received_events","type":"User","site_admin":false},"assignees":[{"login":"Nuss9","id":24221025,"avatar_url":"https://avatars3.githubusercontent.com/u/24221025?v=4","gravatar_id":"","url":"https://api.github.com/users/Nuss9","html_url":"https://github.com/Nuss9","followers_url":"https://api.github.com/users/Nuss9/followers","following_url":"https://api.github.com/users/Nuss9/following{/other_user}","gists_url":"https://api.github.com/users/Nuss9/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuss9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuss9/subscriptions","organizations_url":"https://api.github.com/users/Nuss9/orgs","repos_url":"https://api.github.com/users/Nuss9/repos","events_url":"https://api.github.com/users/Nuss9/events{/privacy}","received_events_url":"https://api.github.com/users/Nuss9/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":752500174,"url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/labels/Code%20Review","name":"Code Review","color":"7532a8","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20/commits","review_comments_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20/comments","review_comment_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/20/comments","statuses_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/statuses/e05b3acb7e3945e65273f4c27498d6cdfd80a154","head":{"label":"Nuss9:SIG-1752","ref":"SIG-1752","sha":"e05b3acb7e3945e65273f4c27498d6cdfd80a154","user":{"login":"Nuss9","id":24221025,"avatar_url":"https://avatars3.githubusercontent.com/u/24221025?v=4","gravatar_id":"","url":"https://api.github.com/users/Nuss9","html_url":"https://github.com/Nuss9","followers_url":"https://api.github.com/users/Nuss9/followers","following_url":"https://api.github.com/users/Nuss9/following{/other_user}","gists_url":"https://api.github.com/users/Nuss9/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuss9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuss9/subscriptions","organizations_url":"https://api.github.com/users/Nuss9/orgs","repos_url":"https://api.github.com/users/Nuss9/repos","events_url":"https://api.github.com/users/Nuss9/events{/privacy}","received_events_url":"https://api.github.com/users/Nuss9/received_events","type":"User","site_admin":false},"repo":{"id":110811122,"name":"SignhostClientLibrary","full_name":"Nuss9/SignhostClientLibrary","owner":{"login":"Nuss9","id":24221025,"avatar_url":"https://avatars3.githubusercontent.com/u/24221025?v=4","gravatar_id":"","url":"https://api.github.com/users/Nuss9","html_url":"https://github.com/Nuss9","followers_url":"https://api.github.com/users/Nuss9/followers","following_url":"https://api.github.com/users/Nuss9/following{/other_user}","gists_url":"https://api.github.com/users/Nuss9/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuss9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuss9/subscriptions","organizations_url":"https://api.github.com/users/Nuss9/orgs","repos_url":"https://api.github.com/users/Nuss9/repos","events_url":"https://api.github.com/users/Nuss9/events{/privacy}","received_events_url":"https://api.github.com/users/Nuss9/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nuss9/SignhostClientLibrary","description":"This is a client library in c# to demonstrate the usage of the signhost api using .net","fork":true,"url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary","forks_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/forks","keys_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/teams","hooks_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/hooks","issue_events_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/issues/events{/number}","events_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/events","assignees_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/assignees{/user}","branches_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/branches{/branch}","tags_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/tags","blobs_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/statuses/{sha}","languages_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/languages","stargazers_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/stargazers","contributors_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/contributors","subscribers_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/subscribers","subscription_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/subscription","commits_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/contents/{+path}","compare_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/merges","archive_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/downloads","issues_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/issues{/number}","pulls_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/pulls{/number}","milestones_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/milestones{/number}","notifications_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/labels{/name}","releases_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/releases{/id}","deployments_url":"https://api.github.com/repos/Nuss9/SignhostClientLibrary/deployments","created_at":"2017-11-15T09:15:17Z","updated_at":"2017-11-15T09:15:20Z","pushed_at":"2018-04-10T08:11:26Z","git_url":"git://github.com/Nuss9/SignhostClientLibrary.git","ssh_url":"git@github.com:Nuss9/SignhostClientLibrary.git","clone_url":"https://github.com/Nuss9/SignhostClientLibrary.git","svn_url":"https://github.com/Nuss9/SignhostClientLibrary","homepage":"https://www.signhost.com","size":580,"stargazers_count":0,"watchers_count":0,"language":"C#","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":"Evidos:master","ref":"master","sha":"9e274e22b9f3e3c71ef5e11e5373407f01a07b78","user":{"login":"Evidos","id":12200770,"avatar_url":"https://avatars1.githubusercontent.com/u/12200770?v=4","gravatar_id":"","url":"https://api.github.com/users/Evidos","html_url":"https://github.com/Evidos","followers_url":"https://api.github.com/users/Evidos/followers","following_url":"https://api.github.com/users/Evidos/following{/other_user}","gists_url":"https://api.github.com/users/Evidos/gists{/gist_id}","starred_url":"https://api.github.com/users/Evidos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Evidos/subscriptions","organizations_url":"https://api.github.com/users/Evidos/orgs","repos_url":"https://api.github.com/users/Evidos/repos","events_url":"https://api.github.com/users/Evidos/events{/privacy}","received_events_url":"https://api.github.com/users/Evidos/received_events","type":"Organization","site_admin":false},"repo":{"id":38497746,"name":"SignhostClientLibrary","full_name":"Evidos/SignhostClientLibrary","owner":{"login":"Evidos","id":12200770,"avatar_url":"https://avatars1.githubusercontent.com/u/12200770?v=4","gravatar_id":"","url":"https://api.github.com/users/Evidos","html_url":"https://github.com/Evidos","followers_url":"https://api.github.com/users/Evidos/followers","following_url":"https://api.github.com/users/Evidos/following{/other_user}","gists_url":"https://api.github.com/users/Evidos/gists{/gist_id}","starred_url":"https://api.github.com/users/Evidos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Evidos/subscriptions","organizations_url":"https://api.github.com/users/Evidos/orgs","repos_url":"https://api.github.com/users/Evidos/repos","events_url":"https://api.github.com/users/Evidos/events{/privacy}","received_events_url":"https://api.github.com/users/Evidos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Evidos/SignhostClientLibrary","description":"This is a client library in c# to demonstrate the usage of the signhost api using .net","fork":false,"url":"https://api.github.com/repos/Evidos/SignhostClientLibrary","forks_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/forks","keys_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/teams","hooks_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/hooks","issue_events_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/events{/number}","events_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/events","assignees_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/assignees{/user}","branches_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/branches{/branch}","tags_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/tags","blobs_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/statuses/{sha}","languages_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/languages","stargazers_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/stargazers","contributors_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/contributors","subscribers_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/subscribers","subscription_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/subscription","commits_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/contents/{+path}","compare_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/merges","archive_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/downloads","issues_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues{/number}","pulls_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls{/number}","milestones_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/milestones{/number}","notifications_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/labels{/name}","releases_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/releases{/id}","deployments_url":"https://api.github.com/repos/Evidos/SignhostClientLibrary/deployments","created_at":"2015-07-03T14:51:58Z","updated_at":"2018-03-21T06:19:42Z","pushed_at":"2018-04-10T08:11:27Z","git_url":"git://github.com/Evidos/SignhostClientLibrary.git","ssh_url":"git@github.com:Evidos/SignhostClientLibrary.git","clone_url":"https://github.com/Evidos/SignhostClientLibrary.git","svn_url":"https://github.com/Evidos/SignhostClientLibrary","homepage":"https://www.signhost.com","size":586,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":5,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20"},"html":{"href":"https://github.com/Evidos/SignhostClientLibrary/pull/20"},"issue":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/20"},"comments":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/Evidos/SignhostClientLibrary/statuses/e05b3acb7e3945e65273f4c27498d6cdfd80a154"}},"author_association":"NONE"}}
{"actor":{"display_login":"MrJoe"}}