{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/client/pulls/comments/201340829","pull_request_review_id":135608492,"id":201340829,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTM0MDgyOQ==","diff_hunk":"@@ -0,0 +1,176 @@\n+package saltpackKeyHelpers\n+\n+import (\n+\t\"context\"\n+\t\"fmt\"\n+\t\"strings\"\n+\n+\t\"github.com/keybase/client/go/libkb\"\n+\t\"github.com/keybase/client/go/protocol/keybase1\"\n+\t\"github.com/keybase/client/go/teams\"\n+\t\"github.com/keybase/go-framed-msgpack-rpc/rpc\"\n+\t\"github.com/keybase/saltpack\"\n+)\n+\n+// This file contains two implementations of saltpack.SymmetricKeyResolver, which can be used to resolve\n+// respectively the old Kbfs Pseudonyms and the newer Key Pseudonyms by querying the server. A mock implementation\n+// (which does not communicate with the sever and avoids circular dependencies) is available in the saltpackHelperMocks package.\n+\n+// Resolves old kbfs pseudonyms.\n+type TlfKeyResolver struct {\n+\tlibkb.Contextified\n+\tctx context.Context\n+}\n+\n+var _ saltpack.SymmetricKeyResolver = (*TlfKeyResolver)(nil)\n+\n+func NewLegacyKBFSResolver(ctx context.Context, g *libkb.GlobalContext) saltpack.SymmetricKeyResolver {\n+\treturn &TlfKeyResolver{libkb.NewContextified(g), ctx}\n+}\n+\n+func (r *TlfKeyResolver) ResolveKeys(identifiers [][]byte) ([]*saltpack.SymmetricKey, error) {\n+\ttlfPseudonyms := []libkb.TlfPseudonym{}\n+\tfor _, identifier := range identifiers {\n+\t\tpseudonym := libkb.TlfPseudonym{}\n+\t\tif len(pseudonym) != len(identifier) {\n+\t\t\treturn nil, fmt.Errorf(\"identifier is the wrong length for a TLF pseudonym (%d != %d)\", len(pseudonym), len(identifier))\n+\t\t}\n+\t\tcopy(pseudonym[:], identifier)\n+\t\ttlfPseudonyms = append(tlfPseudonyms, pseudonym)\n+\t}\n+\n+\tresults, err := libkb.GetTlfPseudonyms(r.ctx, r.G(), tlfPseudonyms)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tsymmetricKeys := []*saltpack.SymmetricKey{}\n+\tfor _, result := range results {\n+\t\tif result.Err != nil {\n+\t\t\tr.G().Log.CDebugf(r.ctx, \"skipping unresolved pseudonym: %s\", result.Err)\n+\t\t\tsymmetricKeys = append(symmetricKeys, nil)\n+\t\t\tcontinue\n+\t\t}\n+\t\tr.G().Log.CDebugf(r.ctx, \"resolved pseudonym for %s, fetching key\", result.Info.Name)","path":"go/saltpackKeyHelpers/saltpack_pseudonym_resolvers.go","position":null,"original_position":54,"commit_id":"c4babfb53ff77239ebb3836738c48dac13c11f2a","original_commit_id":"9a433c463619213cf612d78942a90c76a4fc5ffc","user":{"login":"AMarcedone","id":9069413,"node_id":"MDQ6VXNlcjkwNjk0MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9069413?v=4","gravatar_id":"","url":"https://api.github.com/users/AMarcedone","html_url":"https://github.com/AMarcedone","followers_url":"https://api.github.com/users/AMarcedone/followers","following_url":"https://api.github.com/users/AMarcedone/following{/other_user}","gists_url":"https://api.github.com/users/AMarcedone/gists{/gist_id}","starred_url":"https://api.github.com/users/AMarcedone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMarcedone/subscriptions","organizations_url":"https://api.github.com/users/AMarcedone/orgs","repos_url":"https://api.github.com/users/AMarcedone/repos","events_url":"https://api.github.com/users/AMarcedone/events{/privacy}","received_events_url":"https://api.github.com/users/AMarcedone/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-07-10T13:26:37Z","updated_at":"2018-07-10T13:31:50Z","html_url":"https://github.com/keybase/client/pull/12724#discussion_r201340829","pull_request_url":"https://api.github.com/repos/keybase/client/pulls/12724","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/comments/201340829"},"html":{"href":"https://github.com/keybase/client/pull/12724#discussion_r201340829"},"pull_request":{"href":"https://api.github.com/repos/keybase/client/pulls/12724"}},"in_reply_to_id":200813954},"pull_request":{"url":"https://api.github.com/repos/keybase/client/pulls/12724","id":199828311,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5ODI4MzEx","html_url":"https://github.com/keybase/client/pull/12724","diff_url":"https://github.com/keybase/client/pull/12724.diff","patch_url":"https://github.com/keybase/client/pull/12724.patch","issue_url":"https://api.github.com/repos/keybase/client/issues/12724","number":12724,"state":"open","locked":false,"title":"[WIP] Draft for new keybase encrypt/decrypt with per user keys. rg the diff for TODOs before merging","user":{"login":"AMarcedone","id":9069413,"node_id":"MDQ6VXNlcjkwNjk0MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9069413?v=4","gravatar_id":"","url":"https://api.github.com/users/AMarcedone","html_url":"https://github.com/AMarcedone","followers_url":"https://api.github.com/users/AMarcedone/followers","following_url":"https://api.github.com/users/AMarcedone/following{/other_user}","gists_url":"https://api.github.com/users/AMarcedone/gists{/gist_id}","starred_url":"https://api.github.com/users/AMarcedone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMarcedone/subscriptions","organizations_url":"https://api.github.com/users/AMarcedone/orgs","repos_url":"https://api.github.com/users/AMarcedone/repos","events_url":"https://api.github.com/users/AMarcedone/events{/privacy}","received_events_url":"https://api.github.com/users/AMarcedone/received_events","type":"User","site_admin":false},"body":"@maxtaco can you please take a first look?\r\n\r\nI still have to address some todos here and there (and add a lot of tests), but wanted to get a quick opinion before you go on vacation.","created_at":"2018-07-06T19:20:58Z","updated_at":"2018-07-10T13:31:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c2135579128868e80b522b4b194ffffb1bdbc53","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/client/pulls/12724/commits","review_comments_url":"https://api.github.com/repos/keybase/client/pulls/12724/comments","review_comment_url":"https://api.github.com/repos/keybase/client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/client/issues/12724/comments","statuses_url":"https://api.github.com/repos/keybase/client/statuses/c4babfb53ff77239ebb3836738c48dac13c11f2a","head":{"label":"keybase:AMarcedone/encryptWithPUK-CORE-8113","ref":"AMarcedone/encryptWithPUK-CORE-8113","sha":"c4babfb53ff77239ebb3836738c48dac13c11f2a","user":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"node_id":"MDEwOlJlcG9zaXRvcnkyOTA5OTE4MQ==","name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2018-07-10T12:11:23Z","pushed_at":"2018-07-10T13:23:10Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":245334,"stargazers_count":3826,"watchers_count":3826,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":365,"mirror_url":null,"archived":false,"open_issues_count":2200,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":365,"open_issues":2200,"watchers":3826,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"2b56f026a64438d9a7ee2ca5cbb426f55baba852","user":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"node_id":"MDEwOlJlcG9zaXRvcnkyOTA5OTE4MQ==","name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2018-07-10T12:11:23Z","pushed_at":"2018-07-10T13:23:10Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":245334,"stargazers_count":3826,"watchers_count":3826,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":365,"mirror_url":null,"archived":false,"open_issues_count":2200,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":365,"open_issues":2200,"watchers":3826,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/12724"},"html":{"href":"https://github.com/keybase/client/pull/12724"},"issue":{"href":"https://api.github.com/repos/keybase/client/issues/12724"},"comments":{"href":"https://api.github.com/repos/keybase/client/issues/12724/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/client/pulls/12724/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/client/pulls/12724/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/client/statuses/c4babfb53ff77239ebb3836738c48dac13c11f2a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"AMarcedone"}}