{"action":"created","comment":{"url":"https://api.github.com/repos/docker/notary/pulls/comments/47291727","id":47291727,"diff_hunk":"@@ -167,44 +186,40 @@ func (r *NotaryRepository) Initialize(rootKeyID string) error {\n \t\treturn fmt.Errorf(\"invalid format for root key: %s\", privKey.Algorithm())\n \t}\n \n-\t// All the timestamp keys are generated by the remote server.\n-\tremote, err := getRemoteStore(r.baseURL, r.gun, r.roundTrip)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\trawTSKey, err := remote.GetKey(\"timestamp\")\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\ttimestampKey, err := data.UnmarshalPublicKey(rawTSKey)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tlogrus.Debugf(\"got remote %s timestamp key with keyID: %s\", timestampKey.Algorithm(), timestampKey.ID())\n-\n-\t// This is currently hardcoding the targets and snapshots keys to ECDSA\n-\t// Targets and snapshot keys are always generated locally.\n-\ttargetsKey, err := r.CryptoService.Create(\"targets\", data.ECDSAKey)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\tsnapshotKey, err := r.CryptoService.Create(\"snapshot\", data.ECDSAKey)\n+\tkdb := keys.NewDB()\n+\terr = addKeyForRole(kdb, data.CanonicalRootRole, rootKey)\n \tif err != nil {\n \t\treturn err\n \t}\n \n-\tkdb := keys.NewDB()\n-\n-\tkdb.AddKey(rootKey)\n-\tkdb.AddKey(targetsKey)\n-\tkdb.AddKey(snapshotKey)\n-\tkdb.AddKey(timestampKey)\n-\n-\terr = initRoles(kdb, rootKey, targetsKey, snapshotKey, timestampKey)\n-\tif err != nil {\n-\t\treturn err\n+\t// we want to create all the local keys first so we don't have to","path":"client/client.go","position":81,"original_position":81,"commit_id":"a89bdaa9bf2e5683d65b2a73c59ad37437d2bc61","original_commit_id":"a89bdaa9bf2e5683d65b2a73c59ad37437d2bc61","user":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars.githubusercontent.com/u/55332?v=3","gravatar_id":"","url":"https://api.github.com/users/diogomonica","html_url":"https://github.com/diogomonica","followers_url":"https://api.github.com/users/diogomonica/followers","following_url":"https://api.github.com/users/diogomonica/following{/other_user}","gists_url":"https://api.github.com/users/diogomonica/gists{/gist_id}","starred_url":"https://api.github.com/users/diogomonica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogomonica/subscriptions","organizations_url":"https://api.github.com/users/diogomonica/orgs","repos_url":"https://api.github.com/users/diogomonica/repos","events_url":"https://api.github.com/users/diogomonica/events{/privacy}","received_events_url":"https://api.github.com/users/diogomonica/received_events","type":"User","site_admin":false},"body":"Talked in person, we should refactor","created_at":"2015-12-10T21:52:37Z","updated_at":"2015-12-10T21:52:37Z","html_url":"https://github.com/docker/notary/pull/335#discussion_r47291727","pull_request_url":"https://api.github.com/repos/docker/notary/pulls/335","_links":{"self":{"href":"https://api.github.com/repos/docker/notary/pulls/comments/47291727"},"html":{"href":"https://github.com/docker/notary/pull/335#discussion_r47291727"},"pull_request":{"href":"https://api.github.com/repos/docker/notary/pulls/335"}}},"pull_request":{"url":"https://api.github.com/repos/docker/notary/pulls/335","id":52623609,"html_url":"https://github.com/docker/notary/pull/335","diff_url":"https://github.com/docker/notary/pull/335.diff","patch_url":"https://github.com/docker/notary/pull/335.patch","issue_url":"https://api.github.com/repos/docker/notary/issues/335","number":335,"state":"open","locked":false,"title":"Client supports server snapshot","user":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"body":"This is based on #334, and is waiting on the server handlers for snapshot keys being done for tests for Publish.","created_at":"2015-12-04T02:45:08Z","updated_at":"2015-12-10T21:52:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78d854ca3378756349ff659814eaaf493189cd9a","assignee":null,"milestone":{"url":"https://api.github.com/repos/docker/notary/milestones/4","html_url":"https://github.com/docker/notary/milestones/delegations_v1","labels_url":"https://api.github.com/repos/docker/notary/milestones/4/labels","id":1451085,"number":4,"title":"delegations_v1","description":"1.  Server needs to provide a snapshot key and sign snapshots\r\n1.  Client needs to be able to request a snapshot key from the server and not sign snapshots\r\n1.  CLI needs a way to delegate snapshot signing to the server, as well as reclaim that responsibility","creator":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":5,"state":"open","created_at":"2015-12-09T01:27:13Z","updated_at":"2015-12-09T08:26:24Z","due_on":"2015-12-15T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/docker/notary/pulls/335/commits","review_comments_url":"https://api.github.com/repos/docker/notary/pulls/335/comments","review_comment_url":"https://api.github.com/repos/docker/notary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/notary/issues/335/comments","statuses_url":"https://api.github.com/repos/docker/notary/statuses/a89bdaa9bf2e5683d65b2a73c59ad37437d2bc61","head":{"label":"cyli:client-snapshot","ref":"client-snapshot","sha":"a89bdaa9bf2e5683d65b2a73c59ad37437d2bc61","user":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"repo":{"id":43714589,"name":"notary","full_name":"cyli/notary","owner":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cyli/notary","description":"","fork":true,"url":"https://api.github.com/repos/cyli/notary","forks_url":"https://api.github.com/repos/cyli/notary/forks","keys_url":"https://api.github.com/repos/cyli/notary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyli/notary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyli/notary/teams","hooks_url":"https://api.github.com/repos/cyli/notary/hooks","issue_events_url":"https://api.github.com/repos/cyli/notary/issues/events{/number}","events_url":"https://api.github.com/repos/cyli/notary/events","assignees_url":"https://api.github.com/repos/cyli/notary/assignees{/user}","branches_url":"https://api.github.com/repos/cyli/notary/branches{/branch}","tags_url":"https://api.github.com/repos/cyli/notary/tags","blobs_url":"https://api.github.com/repos/cyli/notary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyli/notary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyli/notary/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyli/notary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyli/notary/statuses/{sha}","languages_url":"https://api.github.com/repos/cyli/notary/languages","stargazers_url":"https://api.github.com/repos/cyli/notary/stargazers","contributors_url":"https://api.github.com/repos/cyli/notary/contributors","subscribers_url":"https://api.github.com/repos/cyli/notary/subscribers","subscription_url":"https://api.github.com/repos/cyli/notary/subscription","commits_url":"https://api.github.com/repos/cyli/notary/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyli/notary/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyli/notary/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyli/notary/issues/comments{/number}","contents_url":"https://api.github.com/repos/cyli/notary/contents/{+path}","compare_url":"https://api.github.com/repos/cyli/notary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyli/notary/merges","archive_url":"https://api.github.com/repos/cyli/notary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyli/notary/downloads","issues_url":"https://api.github.com/repos/cyli/notary/issues{/number}","pulls_url":"https://api.github.com/repos/cyli/notary/pulls{/number}","milestones_url":"https://api.github.com/repos/cyli/notary/milestones{/number}","notifications_url":"https://api.github.com/repos/cyli/notary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyli/notary/labels{/name}","releases_url":"https://api.github.com/repos/cyli/notary/releases{/id}","created_at":"2015-10-05T21:22:52Z","updated_at":"2015-10-05T21:22:54Z","pushed_at":"2015-12-10T18:16:58Z","git_url":"git://github.com/cyli/notary.git","ssh_url":"git@github.com:cyli/notary.git","clone_url":"https://github.com/cyli/notary.git","svn_url":"https://github.com/cyli/notary","homepage":null,"size":21802,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"26d30953c87b04b0029d1361f69f49b3b0448baa","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":37743436,"name":"notary","full_name":"docker/notary","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/notary","description":"","fork":false,"url":"https://api.github.com/repos/docker/notary","forks_url":"https://api.github.com/repos/docker/notary/forks","keys_url":"https://api.github.com/repos/docker/notary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/notary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/notary/teams","hooks_url":"https://api.github.com/repos/docker/notary/hooks","issue_events_url":"https://api.github.com/repos/docker/notary/issues/events{/number}","events_url":"https://api.github.com/repos/docker/notary/events","assignees_url":"https://api.github.com/repos/docker/notary/assignees{/user}","branches_url":"https://api.github.com/repos/docker/notary/branches{/branch}","tags_url":"https://api.github.com/repos/docker/notary/tags","blobs_url":"https://api.github.com/repos/docker/notary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/notary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/notary/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/notary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/notary/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/notary/languages","stargazers_url":"https://api.github.com/repos/docker/notary/stargazers","contributors_url":"https://api.github.com/repos/docker/notary/contributors","subscribers_url":"https://api.github.com/repos/docker/notary/subscribers","subscription_url":"https://api.github.com/repos/docker/notary/subscription","commits_url":"https://api.github.com/repos/docker/notary/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/notary/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/notary/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/notary/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/notary/contents/{+path}","compare_url":"https://api.github.com/repos/docker/notary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/notary/merges","archive_url":"https://api.github.com/repos/docker/notary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/notary/downloads","issues_url":"https://api.github.com/repos/docker/notary/issues{/number}","pulls_url":"https://api.github.com/repos/docker/notary/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/notary/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/notary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/notary/labels{/name}","releases_url":"https://api.github.com/repos/docker/notary/releases{/id}","created_at":"2015-06-19T20:07:53Z","updated_at":"2015-12-10T06:21:19Z","pushed_at":"2015-12-10T18:16:59Z","git_url":"git://github.com/docker/notary.git","ssh_url":"git@github.com:docker/notary.git","clone_url":"https://github.com/docker/notary.git","svn_url":"https://github.com/docker/notary","homepage":null,"size":21957,"stargazers_count":446,"watchers_count":446,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":45,"forks":61,"open_issues":45,"watchers":446,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/notary/pulls/335"},"html":{"href":"https://github.com/docker/notary/pull/335"},"issue":{"href":"https://api.github.com/repos/docker/notary/issues/335"},"comments":{"href":"https://api.github.com/repos/docker/notary/issues/335/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/notary/pulls/335/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/notary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/notary/pulls/335/commits"},"statuses":{"href":"https://api.github.com/repos/docker/notary/statuses/a89bdaa9bf2e5683d65b2a73c59ad37437d2bc61"}}}}