{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/search/pulls/comments/78223116","id":78223116,"diff_hunk":"@@ -112,35 +118,60 @@ func createClientWithClient(ctx context.Context, searchCli sserver1.SearchServer\n \t\treturn nil, err\n \t}\n \n-\tindexer := libsearch.CreateSecureIndexBuilder(sha256.New, masterSecret, salts, uint64(size))\n+\tdirectoryInfos := make(map[string]DirectoryInfo)\n \n-\tvar pathnameKey [32]byte\n-\tcopy(pathnameKey[:], masterSecret[0:32])\n+\t// Initializes the info for each directory.\n+\tfor i, directory := range directories {\n+\t\tindexer := libsearch.CreateSecureIndexBuilder(sha256.New, masterSecrets[i], salts, uint64(size))\n \n-\tabsDir, err := filepath.Abs(directory)\n-\tif err != nil {\n-\t\treturn nil, err\n+\t\tvar pathnameKey [32]byte\n+\t\tcopy(pathnameKey[:], masterSecrets[i][0:32])\n+\n+\t\tabsDir, err := filepath.Abs(directory)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\n+\t\ttlfID, err := getTlfID(absDir)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\n+\t\tdirInfo := DirectoryInfo{\n+\t\t\ttlfID:       tlfID,\n+\t\t\tindexer:     indexer,\n+\t\t\tpathnameKey: pathnameKey,\n+\t\t}\n+\n+\t\tdirectoryInfos[absDir] = dirInfo\n \t}\n \n \tcli := &Client{\n-\t\tsearchCli:   searchCli,\n-\t\tdirectory:   absDir,\n-\t\tindexer:     indexer,\n-\t\tpathnameKey: pathnameKey,\n+\t\tsearchCli:      searchCli,\n+\t\tdirectoryInfos: directoryInfos,\n \t}\n \n \treturn cli, nil\n }\n \n-// AddFile indexes a file with the given `pathname` and writes the index to the\n-// server.\n-func (c *Client) AddFile(pathname string) error {\n-\trelPath, err := relPathStrict(c.directory, pathname)\n+// AddFile indexes a file in `directory` with the given `pathname` and writes\n+// the index to the server.\n+func (c *Client) AddFile(directory, pathname string) error {\n+\tabsDir, err := filepath.Abs(directory)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif _, ok := c.directoryInfos[absDir]; !ok {","path":"client/client.go","position":116,"original_position":116,"commit_id":"5ee1ba7c064ad95a9466d7fe0f47c085c74963e8","original_commit_id":"5ee1ba7c064ad95a9466d7fe0f47c085c74963e8","user":{"login":"jxguan","id":6679009,"avatar_url":"https://avatars.githubusercontent.com/u/6679009?v=3","gravatar_id":"","url":"https://api.github.com/users/jxguan","html_url":"https://github.com/jxguan","followers_url":"https://api.github.com/users/jxguan/followers","following_url":"https://api.github.com/users/jxguan/following{/other_user}","gists_url":"https://api.github.com/users/jxguan/gists{/gist_id}","starred_url":"https://api.github.com/users/jxguan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jxguan/subscriptions","organizations_url":"https://api.github.com/users/jxguan/orgs","repos_url":"https://api.github.com/users/jxguan/repos","events_url":"https://api.github.com/users/jxguan/events{/privacy}","received_events_url":"https://api.github.com/users/jxguan/received_events","type":"User","site_admin":false},"body":"K I'll add a TODO","created_at":"2016-09-09T18:03:10Z","updated_at":"2016-09-09T18:03:10Z","html_url":"https://github.com/keybase/search/pull/16#discussion_r78223116","pull_request_url":"https://api.github.com/repos/keybase/search/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/keybase/search/pulls/comments/78223116"},"html":{"href":"https://github.com/keybase/search/pull/16#discussion_r78223116"},"pull_request":{"href":"https://api.github.com/repos/keybase/search/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/search/pulls/16","id":84531593,"html_url":"https://github.com/keybase/search/pull/16","diff_url":"https://github.com/keybase/search/pull/16.diff","patch_url":"https://github.com/keybase/search/pull/16.patch","issue_url":"https://api.github.com/repos/keybase/search/issues/16","number":16,"state":"open","locked":false,"title":"Add TLF Support to the Client Side","user":{"login":"jxguan","id":6679009,"avatar_url":"https://avatars.githubusercontent.com/u/6679009?v=3","gravatar_id":"","url":"https://api.github.com/users/jxguan","html_url":"https://github.com/jxguan","followers_url":"https://api.github.com/users/jxguan/followers","following_url":"https://api.github.com/users/jxguan/following{/other_user}","gists_url":"https://api.github.com/users/jxguan/gists{/gist_id}","starred_url":"https://api.github.com/users/jxguan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jxguan/subscriptions","organizations_url":"https://api.github.com/users/jxguan/orgs","repos_url":"https://api.github.com/users/jxguan/repos","events_url":"https://api.github.com/users/jxguan/events{/privacy}","received_events_url":"https://api.github.com/users/jxguan/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-08T18:44:22Z","updated_at":"2016-09-09T18:03:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80d9bf46d91049cdf08c25181c1efd9dc9169c53","assignee":{"login":"strib","id":8516691,"avatar_url":"https://avatars.githubusercontent.com/u/8516691?v=3","gravatar_id":"","url":"https://api.github.com/users/strib","html_url":"https://github.com/strib","followers_url":"https://api.github.com/users/strib/followers","following_url":"https://api.github.com/users/strib/following{/other_user}","gists_url":"https://api.github.com/users/strib/gists{/gist_id}","starred_url":"https://api.github.com/users/strib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strib/subscriptions","organizations_url":"https://api.github.com/users/strib/orgs","repos_url":"https://api.github.com/users/strib/repos","events_url":"https://api.github.com/users/strib/events{/privacy}","received_events_url":"https://api.github.com/users/strib/received_events","type":"User","site_admin":false},"assignees":[{"login":"strib","id":8516691,"avatar_url":"https://avatars.githubusercontent.com/u/8516691?v=3","gravatar_id":"","url":"https://api.github.com/users/strib","html_url":"https://github.com/strib","followers_url":"https://api.github.com/users/strib/followers","following_url":"https://api.github.com/users/strib/following{/other_user}","gists_url":"https://api.github.com/users/strib/gists{/gist_id}","starred_url":"https://api.github.com/users/strib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strib/subscriptions","organizations_url":"https://api.github.com/users/strib/orgs","repos_url":"https://api.github.com/users/strib/repos","events_url":"https://api.github.com/users/strib/events{/privacy}","received_events_url":"https://api.github.com/users/strib/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/search/pulls/16/commits","review_comments_url":"https://api.github.com/repos/keybase/search/pulls/16/comments","review_comment_url":"https://api.github.com/repos/keybase/search/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/search/issues/16/comments","statuses_url":"https://api.github.com/repos/keybase/search/statuses/5ee1ba7c064ad95a9466d7fe0f47c085c74963e8","head":{"label":"keybase:dev2","ref":"dev2","sha":"5ee1ba7c064ad95a9466d7fe0f47c085c74963e8","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","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":63091492,"name":"search","full_name":"keybase/search","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","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/search","description":"Encrypted search of Keybase data (WIP)","fork":false,"url":"https://api.github.com/repos/keybase/search","forks_url":"https://api.github.com/repos/keybase/search/forks","keys_url":"https://api.github.com/repos/keybase/search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/search/teams","hooks_url":"https://api.github.com/repos/keybase/search/hooks","issue_events_url":"https://api.github.com/repos/keybase/search/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/search/events","assignees_url":"https://api.github.com/repos/keybase/search/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/search/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/search/tags","blobs_url":"https://api.github.com/repos/keybase/search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/search/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/search/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/search/languages","stargazers_url":"https://api.github.com/repos/keybase/search/stargazers","contributors_url":"https://api.github.com/repos/keybase/search/contributors","subscribers_url":"https://api.github.com/repos/keybase/search/subscribers","subscription_url":"https://api.github.com/repos/keybase/search/subscription","commits_url":"https://api.github.com/repos/keybase/search/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/search/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/search/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/search/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/search/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/search/merges","archive_url":"https://api.github.com/repos/keybase/search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/search/downloads","issues_url":"https://api.github.com/repos/keybase/search/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/search/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/search/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/search/labels{/name}","releases_url":"https://api.github.com/repos/keybase/search/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/search/deployments","created_at":"2016-07-11T18:18:17Z","updated_at":"2016-07-25T23:10:45Z","pushed_at":"2016-09-08T18:44:23Z","git_url":"git://github.com/keybase/search.git","ssh_url":"git@github.com:keybase/search.git","clone_url":"https://github.com/keybase/search.git","svn_url":"https://github.com/keybase/search","homepage":null,"size":1692,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"19c2410fd4470dfab1ce78eda4b27a31348bee7d","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","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":63091492,"name":"search","full_name":"keybase/search","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","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/search","description":"Encrypted search of Keybase data (WIP)","fork":false,"url":"https://api.github.com/repos/keybase/search","forks_url":"https://api.github.com/repos/keybase/search/forks","keys_url":"https://api.github.com/repos/keybase/search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/search/teams","hooks_url":"https://api.github.com/repos/keybase/search/hooks","issue_events_url":"https://api.github.com/repos/keybase/search/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/search/events","assignees_url":"https://api.github.com/repos/keybase/search/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/search/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/search/tags","blobs_url":"https://api.github.com/repos/keybase/search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/search/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/search/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/search/languages","stargazers_url":"https://api.github.com/repos/keybase/search/stargazers","contributors_url":"https://api.github.com/repos/keybase/search/contributors","subscribers_url":"https://api.github.com/repos/keybase/search/subscribers","subscription_url":"https://api.github.com/repos/keybase/search/subscription","commits_url":"https://api.github.com/repos/keybase/search/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/search/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/search/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/search/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/search/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/search/merges","archive_url":"https://api.github.com/repos/keybase/search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/search/downloads","issues_url":"https://api.github.com/repos/keybase/search/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/search/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/search/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/search/labels{/name}","releases_url":"https://api.github.com/repos/keybase/search/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/search/deployments","created_at":"2016-07-11T18:18:17Z","updated_at":"2016-07-25T23:10:45Z","pushed_at":"2016-09-08T18:44:23Z","git_url":"git://github.com/keybase/search.git","ssh_url":"git@github.com:keybase/search.git","clone_url":"https://github.com/keybase/search.git","svn_url":"https://github.com/keybase/search","homepage":null,"size":1692,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/search/pulls/16"},"html":{"href":"https://github.com/keybase/search/pull/16"},"issue":{"href":"https://api.github.com/repos/keybase/search/issues/16"},"comments":{"href":"https://api.github.com/repos/keybase/search/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/search/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/search/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/search/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/search/statuses/5ee1ba7c064ad95a9466d7fe0f47c085c74963e8"}}}}
{"actor":{"display_login":"jxguan"}}