{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/comments/154683564","pull_request_review_id":80882210,"id":154683564,"diff_hunk":"@@ -0,0 +1,60 @@\n+package transit\n+\n+import (\n+\t\"encoding/base64\"\n+\n+\t\"github.com/hashicorp/vault/helper/jsonutil\"\n+\t\"github.com/hashicorp/vault/helper/keysutil\"\n+\t\"github.com/hashicorp/vault/logical\"\n+\t\"github.com/hashicorp/vault/logical/framework\"\n+)\n+\n+func (b *backend) pathRestore() *framework.Path {\n+\treturn &framework.Path{\n+\t\tPattern: \"restore/?$\",\n+\t\tFields: map[string]*framework.FieldSchema{\n+\t\t\t\"backup\": &framework.FieldSchema{\n+\t\t\t\tType:        framework.TypeString,\n+\t\t\t\tDescription: \"Backed up key data to be restored. This should be the output from the 'backup/' endpoint\",\n+\t\t\t},\n+\t\t},\n+\n+\t\tCallbacks: map[logical.Operation]framework.OperationFunc{\n+\t\t\tlogical.UpdateOperation: b.pathRestoreUpdate,\n+\t\t},\n+\n+\t\tHelpSynopsis:    pathRestoreHelpSyn,\n+\t\tHelpDescription: pathRestoreHelpDesc,\n+\t}\n+}\n+\n+func (b *backend) pathRestoreUpdate(req *logical.Request, d *framework.FieldData) (*logical.Response, error) {\n+\tbackupB64 := d.Get(\"backup\").(string)\n+\tif backupB64 == \"\" {\n+\t\treturn logical.ErrorResponse(\"'backup' must be supplied\"), nil\n+\t}\n+\n+\tbackupBytes, err := base64.StdEncoding.DecodeString(backupB64)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tvar keyData keysutil.KeyData\n+\tkeyData.Policy = &keysutil.Policy{\n+\t\tKeys: keysutil.KeyEntryMap{},\n+\t}\n+\terr = jsonutil.DecodeJSON(backupBytes, &keyData)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+","path":"builtin/logical/transit/path_restore.go","position":54,"original_position":50,"commit_id":"baa721612aed40957aa4ba891ae728217062fb17","original_commit_id":"b4efb1d9e5f3ff2af098bac7856407c6ef0fffe2","user":{"login":"vishalnayak","id":3053672,"avatar_url":"https://avatars0.githubusercontent.com/u/3053672?v=4","gravatar_id":"","url":"https://api.github.com/users/vishalnayak","html_url":"https://github.com/vishalnayak","followers_url":"https://api.github.com/users/vishalnayak/followers","following_url":"https://api.github.com/users/vishalnayak/following{/other_user}","gists_url":"https://api.github.com/users/vishalnayak/gists{/gist_id}","starred_url":"https://api.github.com/users/vishalnayak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishalnayak/subscriptions","organizations_url":"https://api.github.com/users/vishalnayak/orgs","repos_url":"https://api.github.com/users/vishalnayak/repos","events_url":"https://api.github.com/users/vishalnayak/events{/privacy}","received_events_url":"https://api.github.com/users/vishalnayak/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-12-04T15:39:27Z","updated_at":"2017-12-04T15:39:27Z","html_url":"https://github.com/hashicorp/vault/pull/3637#discussion_r154683564","pull_request_url":"https://api.github.com/repos/hashicorp/vault/pulls/3637","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments/154683564"},"html":{"href":"https://github.com/hashicorp/vault/pull/3637#discussion_r154683564"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/3637"}},"in_reply_to_id":154398744},"pull_request":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/3637","id":155912410,"html_url":"https://github.com/hashicorp/vault/pull/3637","diff_url":"https://github.com/hashicorp/vault/pull/3637.diff","patch_url":"https://github.com/hashicorp/vault/pull/3637.patch","issue_url":"https://api.github.com/repos/hashicorp/vault/issues/3637","number":3637,"state":"open","locked":false,"title":"[WIP] Transit: backup/restore","user":{"login":"vishalnayak","id":3053672,"avatar_url":"https://avatars0.githubusercontent.com/u/3053672?v=4","gravatar_id":"","url":"https://api.github.com/users/vishalnayak","html_url":"https://github.com/vishalnayak","followers_url":"https://api.github.com/users/vishalnayak/followers","following_url":"https://api.github.com/users/vishalnayak/following{/other_user}","gists_url":"https://api.github.com/users/vishalnayak/gists{/gist_id}","starred_url":"https://api.github.com/users/vishalnayak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishalnayak/subscriptions","organizations_url":"https://api.github.com/users/vishalnayak/orgs","repos_url":"https://api.github.com/users/vishalnayak/repos","events_url":"https://api.github.com/users/vishalnayak/events{/privacy}","received_events_url":"https://api.github.com/users/vishalnayak/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-01T17:12:30Z","updated_at":"2017-12-04T15:39:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8eec3b7969ab0319de69cb2b24337b796ba3f04","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/vault/pulls/3637/commits","review_comments_url":"https://api.github.com/repos/hashicorp/vault/pulls/3637/comments","review_comment_url":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/vault/issues/3637/comments","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/baa721612aed40957aa4ba891ae728217062fb17","head":{"label":"hashicorp:backup-restore","ref":"backup-restore","sha":"baa721612aed40957aa4ba891ae728217062fb17","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":31288958,"name":"vault","full_name":"hashicorp/vault","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/vault","description":"A tool for secrets management, encryption as a service, and privileged access management","fork":false,"url":"https://api.github.com/repos/hashicorp/vault","forks_url":"https://api.github.com/repos/hashicorp/vault/forks","keys_url":"https://api.github.com/repos/hashicorp/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/vault/teams","hooks_url":"https://api.github.com/repos/hashicorp/vault/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/vault/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/vault/events","assignees_url":"https://api.github.com/repos/hashicorp/vault/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/vault/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/vault/tags","blobs_url":"https://api.github.com/repos/hashicorp/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/vault/languages","stargazers_url":"https://api.github.com/repos/hashicorp/vault/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/vault/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/vault/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/vault/subscription","commits_url":"https://api.github.com/repos/hashicorp/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/vault/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/vault/merges","archive_url":"https://api.github.com/repos/hashicorp/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/vault/downloads","issues_url":"https://api.github.com/repos/hashicorp/vault/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/vault/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/vault/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/vault/deployments","created_at":"2015-02-25T00:15:59Z","updated_at":"2017-12-04T12:39:03Z","pushed_at":"2017-12-04T15:38:30Z","git_url":"git://github.com/hashicorp/vault.git","ssh_url":"git@github.com:hashicorp/vault.git","clone_url":"https://github.com/hashicorp/vault.git","svn_url":"https://github.com/hashicorp/vault","homepage":"https://www.vaultproject.io/","size":37734,"stargazers_count":8034,"watchers_count":8034,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1108,"mirror_url":null,"archived":false,"open_issues_count":339,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":1108,"open_issues":339,"watchers":8034,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"eed45793b9af3fc3cd2c7874aec9b39f705ee7f9","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":31288958,"name":"vault","full_name":"hashicorp/vault","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/vault","description":"A tool for secrets management, encryption as a service, and privileged access management","fork":false,"url":"https://api.github.com/repos/hashicorp/vault","forks_url":"https://api.github.com/repos/hashicorp/vault/forks","keys_url":"https://api.github.com/repos/hashicorp/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/vault/teams","hooks_url":"https://api.github.com/repos/hashicorp/vault/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/vault/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/vault/events","assignees_url":"https://api.github.com/repos/hashicorp/vault/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/vault/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/vault/tags","blobs_url":"https://api.github.com/repos/hashicorp/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/vault/languages","stargazers_url":"https://api.github.com/repos/hashicorp/vault/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/vault/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/vault/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/vault/subscription","commits_url":"https://api.github.com/repos/hashicorp/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/vault/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/vault/merges","archive_url":"https://api.github.com/repos/hashicorp/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/vault/downloads","issues_url":"https://api.github.com/repos/hashicorp/vault/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/vault/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/vault/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/vault/deployments","created_at":"2015-02-25T00:15:59Z","updated_at":"2017-12-04T12:39:03Z","pushed_at":"2017-12-04T15:38:30Z","git_url":"git://github.com/hashicorp/vault.git","ssh_url":"git@github.com:hashicorp/vault.git","clone_url":"https://github.com/hashicorp/vault.git","svn_url":"https://github.com/hashicorp/vault","homepage":"https://www.vaultproject.io/","size":37734,"stargazers_count":8034,"watchers_count":8034,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1108,"mirror_url":null,"archived":false,"open_issues_count":339,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":1108,"open_issues":339,"watchers":8034,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/3637"},"html":{"href":"https://github.com/hashicorp/vault/pull/3637"},"issue":{"href":"https://api.github.com/repos/hashicorp/vault/issues/3637"},"comments":{"href":"https://api.github.com/repos/hashicorp/vault/issues/3637/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/3637/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/3637/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/vault/statuses/baa721612aed40957aa4ba891ae728217062fb17"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"vishalnayak"}}