{"action":"created","comment":{"url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/comments/172010223","pull_request_review_id":100968575,"id":172010223,"diff_hunk":"@@ -0,0 +1,43 @@\n+const KeyringController = require('eth-keyring-controller')\n+\n+const seedPhraseVerifier = {\n+\n+  verifyAccounts(createdAccounts, seedWords) {\n+\n+    return new Promise((resolve, reject) => {\n+\n+      if (!createdAccounts || createdAccounts.length < 1) {\n+        return reject(new Error('No created accounts defined.'))\n+      }\n+\n+      let keyringController = new KeyringController({})\n+      let Keyring = keyringController.getKeyringClassForType('HD Key Tree')\n+      let opts = {\n+        mnemonic: seedWords,\n+        numberOfAccounts: createdAccounts.length,\n+      }\n+\n+      let keyring = new Keyring(opts)\n+      keyring.getAccounts()\n+        .then((restoredAccounts) => {\n+\n+          log.debug('Created accounts: ' + JSON.stringify(createdAccounts))\n+          log.debug('Restored accounts: ' + JSON.stringify(restoredAccounts))\n+\n+          if (restoredAccounts.length != createdAccounts.length) {\n+            // this should not happen...\n+            return reject(new Error(\"Wrong number of accounts\"))\n+          }\n+\n+          for (let i = 0; i < restoredAccounts.length; i++) {\n+            if (restoredAccounts[i] !== createdAccounts[i]) {\n+              return reject(new Error('Not identical accounts! Original: ' + createdAccounts[i] + ', Restored: ' + restoredAccounts[i]))\n+            }\n+          }\n+          return resolve()\n+        })\n+    })\n+  }\n+}\n+\n+module.exports = seedPhraseVerifier","path":"app/scripts/lib/seed-phrase-verifier.js","position":null,"original_position":43,"commit_id":"4bd7f1a37abcd09dc8816fc5b28ad41bc86b1aea","original_commit_id":"92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad","user":{"login":"lazaridiscom","id":35095758,"avatar_url":"https://avatars1.githubusercontent.com/u/35095758?v=4","gravatar_id":"","url":"https://api.github.com/users/lazaridiscom","html_url":"https://github.com/lazaridiscom","followers_url":"https://api.github.com/users/lazaridiscom/followers","following_url":"https://api.github.com/users/lazaridiscom/following{/other_user}","gists_url":"https://api.github.com/users/lazaridiscom/gists{/gist_id}","starred_url":"https://api.github.com/users/lazaridiscom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lazaridiscom/subscriptions","organizations_url":"https://api.github.com/users/lazaridiscom/orgs","repos_url":"https://api.github.com/users/lazaridiscom/repos","events_url":"https://api.github.com/users/lazaridiscom/events{/privacy}","received_events_url":"https://api.github.com/users/lazaridiscom/received_events","type":"User","site_admin":false},"body":"@scsaba , your code is very clean and mostly self-explaining (for a project insider fully self-explaining). Personally I would need some notes to be clear about: one seed-phrase can recreate multiple accounts? What is an account (key-value pair? ... ).\r\n\r\nNote that this code (beside doing detective-work to find the should-never-happen-bug), will serve a limited teach-in to this problem (e.g. for people visiting the project to spot this critical bug).","created_at":"2018-03-03T08:17:44Z","updated_at":"2018-03-03T08:17:44Z","html_url":"https://github.com/MetaMask/metamask-extension/pull/3409#discussion_r172010223","pull_request_url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/comments/172010223"},"html":{"href":"https://github.com/MetaMask/metamask-extension/pull/3409#discussion_r172010223"},"pull_request":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409"}},"in_reply_to_id":172009860},"pull_request":{"url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409","id":172632315,"html_url":"https://github.com/MetaMask/metamask-extension/pull/3409","diff_url":"https://github.com/MetaMask/metamask-extension/pull/3409.diff","patch_url":"https://github.com/MetaMask/metamask-extension/pull/3409.patch","issue_url":"https://api.github.com/repos/MetaMask/metamask-extension/issues/3409","number":3409,"state":"open","locked":false,"title":"Add seed phrase verification script into background process","user":{"login":"scsaba","id":3006955,"avatar_url":"https://avatars1.githubusercontent.com/u/3006955?v=4","gravatar_id":"","url":"https://api.github.com/users/scsaba","html_url":"https://github.com/scsaba","followers_url":"https://api.github.com/users/scsaba/followers","following_url":"https://api.github.com/users/scsaba/following{/other_user}","gists_url":"https://api.github.com/users/scsaba/gists{/gist_id}","starred_url":"https://api.github.com/users/scsaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scsaba/subscriptions","organizations_url":"https://api.github.com/users/scsaba/orgs","repos_url":"https://api.github.com/users/scsaba/repos","events_url":"https://api.github.com/users/scsaba/events{/privacy}","received_events_url":"https://api.github.com/users/scsaba/received_events","type":"User","site_admin":false},"body":"Fixes #3355 ","created_at":"2018-03-02T23:50:23Z","updated_at":"2018-03-03T08:17:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d13a3252204a869361ebf5c6e299e5276343a0d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409/commits","review_comments_url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409/comments","review_comment_url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MetaMask/metamask-extension/issues/3409/comments","statuses_url":"https://api.github.com/repos/MetaMask/metamask-extension/statuses/4bd7f1a37abcd09dc8816fc5b28ad41bc86b1aea","head":{"label":"scsaba:seed-phrase-verification","ref":"seed-phrase-verification","sha":"4bd7f1a37abcd09dc8816fc5b28ad41bc86b1aea","user":{"login":"scsaba","id":3006955,"avatar_url":"https://avatars1.githubusercontent.com/u/3006955?v=4","gravatar_id":"","url":"https://api.github.com/users/scsaba","html_url":"https://github.com/scsaba","followers_url":"https://api.github.com/users/scsaba/followers","following_url":"https://api.github.com/users/scsaba/following{/other_user}","gists_url":"https://api.github.com/users/scsaba/gists{/gist_id}","starred_url":"https://api.github.com/users/scsaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scsaba/subscriptions","organizations_url":"https://api.github.com/users/scsaba/orgs","repos_url":"https://api.github.com/users/scsaba/repos","events_url":"https://api.github.com/users/scsaba/events{/privacy}","received_events_url":"https://api.github.com/users/scsaba/received_events","type":"User","site_admin":false},"repo":{"id":122045750,"name":"metamask-extension","full_name":"scsaba/metamask-extension","owner":{"login":"scsaba","id":3006955,"avatar_url":"https://avatars1.githubusercontent.com/u/3006955?v=4","gravatar_id":"","url":"https://api.github.com/users/scsaba","html_url":"https://github.com/scsaba","followers_url":"https://api.github.com/users/scsaba/followers","following_url":"https://api.github.com/users/scsaba/following{/other_user}","gists_url":"https://api.github.com/users/scsaba/gists{/gist_id}","starred_url":"https://api.github.com/users/scsaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scsaba/subscriptions","organizations_url":"https://api.github.com/users/scsaba/orgs","repos_url":"https://api.github.com/users/scsaba/repos","events_url":"https://api.github.com/users/scsaba/events{/privacy}","received_events_url":"https://api.github.com/users/scsaba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scsaba/metamask-extension","description":":globe_with_meridians: :electric_plug: metamask chrome extension","fork":true,"url":"https://api.github.com/repos/scsaba/metamask-extension","forks_url":"https://api.github.com/repos/scsaba/metamask-extension/forks","keys_url":"https://api.github.com/repos/scsaba/metamask-extension/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scsaba/metamask-extension/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scsaba/metamask-extension/teams","hooks_url":"https://api.github.com/repos/scsaba/metamask-extension/hooks","issue_events_url":"https://api.github.com/repos/scsaba/metamask-extension/issues/events{/number}","events_url":"https://api.github.com/repos/scsaba/metamask-extension/events","assignees_url":"https://api.github.com/repos/scsaba/metamask-extension/assignees{/user}","branches_url":"https://api.github.com/repos/scsaba/metamask-extension/branches{/branch}","tags_url":"https://api.github.com/repos/scsaba/metamask-extension/tags","blobs_url":"https://api.github.com/repos/scsaba/metamask-extension/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scsaba/metamask-extension/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scsaba/metamask-extension/git/refs{/sha}","trees_url":"https://api.github.com/repos/scsaba/metamask-extension/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scsaba/metamask-extension/statuses/{sha}","languages_url":"https://api.github.com/repos/scsaba/metamask-extension/languages","stargazers_url":"https://api.github.com/repos/scsaba/metamask-extension/stargazers","contributors_url":"https://api.github.com/repos/scsaba/metamask-extension/contributors","subscribers_url":"https://api.github.com/repos/scsaba/metamask-extension/subscribers","subscription_url":"https://api.github.com/repos/scsaba/metamask-extension/subscription","commits_url":"https://api.github.com/repos/scsaba/metamask-extension/commits{/sha}","git_commits_url":"https://api.github.com/repos/scsaba/metamask-extension/git/commits{/sha}","comments_url":"https://api.github.com/repos/scsaba/metamask-extension/comments{/number}","issue_comment_url":"https://api.github.com/repos/scsaba/metamask-extension/issues/comments{/number}","contents_url":"https://api.github.com/repos/scsaba/metamask-extension/contents/{+path}","compare_url":"https://api.github.com/repos/scsaba/metamask-extension/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scsaba/metamask-extension/merges","archive_url":"https://api.github.com/repos/scsaba/metamask-extension/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scsaba/metamask-extension/downloads","issues_url":"https://api.github.com/repos/scsaba/metamask-extension/issues{/number}","pulls_url":"https://api.github.com/repos/scsaba/metamask-extension/pulls{/number}","milestones_url":"https://api.github.com/repos/scsaba/metamask-extension/milestones{/number}","notifications_url":"https://api.github.com/repos/scsaba/metamask-extension/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scsaba/metamask-extension/labels{/name}","releases_url":"https://api.github.com/repos/scsaba/metamask-extension/releases{/id}","deployments_url":"https://api.github.com/repos/scsaba/metamask-extension/deployments","created_at":"2018-02-19T10:14:53Z","updated_at":"2018-02-19T10:14:56Z","pushed_at":"2018-03-02T23:46:33Z","git_url":"git://github.com/scsaba/metamask-extension.git","ssh_url":"git@github.com:scsaba/metamask-extension.git","clone_url":"https://github.com/scsaba/metamask-extension.git","svn_url":"https://github.com/scsaba/metamask-extension","homepage":"https://metamask.io/","size":20217,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"MetaMask:master","ref":"master","sha":"0c163dcb32ddafde8a8ed3e9e21be552a5eeeed5","user":{"login":"MetaMask","id":11744586,"avatar_url":"https://avatars2.githubusercontent.com/u/11744586?v=4","gravatar_id":"","url":"https://api.github.com/users/MetaMask","html_url":"https://github.com/MetaMask","followers_url":"https://api.github.com/users/MetaMask/followers","following_url":"https://api.github.com/users/MetaMask/following{/other_user}","gists_url":"https://api.github.com/users/MetaMask/gists{/gist_id}","starred_url":"https://api.github.com/users/MetaMask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MetaMask/subscriptions","organizations_url":"https://api.github.com/users/MetaMask/orgs","repos_url":"https://api.github.com/users/MetaMask/repos","events_url":"https://api.github.com/users/MetaMask/events{/privacy}","received_events_url":"https://api.github.com/users/MetaMask/received_events","type":"Organization","site_admin":false},"repo":{"id":42009758,"name":"metamask-extension","full_name":"MetaMask/metamask-extension","owner":{"login":"MetaMask","id":11744586,"avatar_url":"https://avatars2.githubusercontent.com/u/11744586?v=4","gravatar_id":"","url":"https://api.github.com/users/MetaMask","html_url":"https://github.com/MetaMask","followers_url":"https://api.github.com/users/MetaMask/followers","following_url":"https://api.github.com/users/MetaMask/following{/other_user}","gists_url":"https://api.github.com/users/MetaMask/gists{/gist_id}","starred_url":"https://api.github.com/users/MetaMask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MetaMask/subscriptions","organizations_url":"https://api.github.com/users/MetaMask/orgs","repos_url":"https://api.github.com/users/MetaMask/repos","events_url":"https://api.github.com/users/MetaMask/events{/privacy}","received_events_url":"https://api.github.com/users/MetaMask/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MetaMask/metamask-extension","description":":globe_with_meridians: :electric_plug: metamask chrome extension","fork":false,"url":"https://api.github.com/repos/MetaMask/metamask-extension","forks_url":"https://api.github.com/repos/MetaMask/metamask-extension/forks","keys_url":"https://api.github.com/repos/MetaMask/metamask-extension/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MetaMask/metamask-extension/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MetaMask/metamask-extension/teams","hooks_url":"https://api.github.com/repos/MetaMask/metamask-extension/hooks","issue_events_url":"https://api.github.com/repos/MetaMask/metamask-extension/issues/events{/number}","events_url":"https://api.github.com/repos/MetaMask/metamask-extension/events","assignees_url":"https://api.github.com/repos/MetaMask/metamask-extension/assignees{/user}","branches_url":"https://api.github.com/repos/MetaMask/metamask-extension/branches{/branch}","tags_url":"https://api.github.com/repos/MetaMask/metamask-extension/tags","blobs_url":"https://api.github.com/repos/MetaMask/metamask-extension/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MetaMask/metamask-extension/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MetaMask/metamask-extension/git/refs{/sha}","trees_url":"https://api.github.com/repos/MetaMask/metamask-extension/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MetaMask/metamask-extension/statuses/{sha}","languages_url":"https://api.github.com/repos/MetaMask/metamask-extension/languages","stargazers_url":"https://api.github.com/repos/MetaMask/metamask-extension/stargazers","contributors_url":"https://api.github.com/repos/MetaMask/metamask-extension/contributors","subscribers_url":"https://api.github.com/repos/MetaMask/metamask-extension/subscribers","subscription_url":"https://api.github.com/repos/MetaMask/metamask-extension/subscription","commits_url":"https://api.github.com/repos/MetaMask/metamask-extension/commits{/sha}","git_commits_url":"https://api.github.com/repos/MetaMask/metamask-extension/git/commits{/sha}","comments_url":"https://api.github.com/repos/MetaMask/metamask-extension/comments{/number}","issue_comment_url":"https://api.github.com/repos/MetaMask/metamask-extension/issues/comments{/number}","contents_url":"https://api.github.com/repos/MetaMask/metamask-extension/contents/{+path}","compare_url":"https://api.github.com/repos/MetaMask/metamask-extension/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MetaMask/metamask-extension/merges","archive_url":"https://api.github.com/repos/MetaMask/metamask-extension/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MetaMask/metamask-extension/downloads","issues_url":"https://api.github.com/repos/MetaMask/metamask-extension/issues{/number}","pulls_url":"https://api.github.com/repos/MetaMask/metamask-extension/pulls{/number}","milestones_url":"https://api.github.com/repos/MetaMask/metamask-extension/milestones{/number}","notifications_url":"https://api.github.com/repos/MetaMask/metamask-extension/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MetaMask/metamask-extension/labels{/name}","releases_url":"https://api.github.com/repos/MetaMask/metamask-extension/releases{/id}","deployments_url":"https://api.github.com/repos/MetaMask/metamask-extension/deployments","created_at":"2015-09-06T16:34:48Z","updated_at":"2018-03-03T04:18:56Z","pushed_at":"2018-03-03T05:31:14Z","git_url":"git://github.com/MetaMask/metamask-extension.git","ssh_url":"git@github.com:MetaMask/metamask-extension.git","clone_url":"https://github.com/MetaMask/metamask-extension.git","svn_url":"https://github.com/MetaMask/metamask-extension","homepage":"https://metamask.io/","size":20254,"stargazers_count":1433,"watchers_count":1433,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":332,"mirror_url":null,"archived":false,"open_issues_count":622,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":332,"open_issues":622,"watchers":1433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409"},"html":{"href":"https://github.com/MetaMask/metamask-extension/pull/3409"},"issue":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/issues/3409"},"comments":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/issues/3409/comments"},"review_comments":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409/comments"},"review_comment":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/pulls/3409/commits"},"statuses":{"href":"https://api.github.com/repos/MetaMask/metamask-extension/statuses/4bd7f1a37abcd09dc8816fc5b28ad41bc86b1aea"}},"author_association":"NONE"}}
{"actor":{"display_login":"lazaridiscom"}}