From dbbb419b3ef88a204a2af663cb9c999b86d868d0 Mon Sep 17 00:00:00 2001 From: jpuri Date: Mon, 14 Feb 2022 18:10:06 +0530 Subject: [PATCH 1/8] Clear Keyring from Memory Before Persisting to Storage in createNewVaultAndKeychain --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 227e98cd..32b4dfd0 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,7 @@ class KeyringController extends EventEmitter { * @returns {Promise} A Promise that resolves to the state. */ createNewVaultAndKeychain(password) { - return this.persistAllKeyrings(password) + return this.clearKeyrings().then(persistAllKeyrings(password)) .then(this.createFirstKeyTree.bind(this)) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) From 46c1dbb726d790c316cfb8dea0f28349fadac333 Mon Sep 17 00:00:00 2001 From: jpuri Date: Mon, 14 Feb 2022 22:21:16 +0530 Subject: [PATCH 2/8] fix --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 32b4dfd0..1dd8cfda 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,8 @@ class KeyringController extends EventEmitter { * @returns {Promise} A Promise that resolves to the state. */ createNewVaultAndKeychain(password) { - return this.clearKeyrings().then(persistAllKeyrings(password)) + return this.clearKeyrings() + .then(persistAllKeyrings(password)) .then(this.createFirstKeyTree.bind(this)) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) From d58ed8bf7561e556287ca4e9f719d2f542170dd3 Mon Sep 17 00:00:00 2001 From: jpuri Date: Mon, 14 Feb 2022 22:26:09 +0530 Subject: [PATCH 3/8] fix --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1dd8cfda..064776d6 100644 --- a/index.js +++ b/index.js @@ -74,7 +74,7 @@ class KeyringController extends EventEmitter { */ createNewVaultAndKeychain(password) { return this.clearKeyrings() - .then(persistAllKeyrings(password)) + .then(this.persistAllKeyrings.bind(this, password)) .then(this.createFirstKeyTree.bind(this)) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) From e43f6fe78028ee2dc6ada8abc74db9a0b5d7144c Mon Sep 17 00:00:00 2001 From: jpuri Date: Tue, 1 Mar 2022 15:01:23 +0530 Subject: [PATCH 4/8] fix --- index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 064776d6..61f3a0ad 100644 --- a/index.js +++ b/index.js @@ -73,9 +73,7 @@ class KeyringController extends EventEmitter { * @returns {Promise} A Promise that resolves to the state. */ createNewVaultAndKeychain(password) { - return this.clearKeyrings() - .then(this.persistAllKeyrings.bind(this, password)) - .then(this.createFirstKeyTree.bind(this)) + return this.createFirstKeyTree.bind(this, password) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) .then(this.fullUpdate.bind(this)); @@ -501,7 +499,8 @@ class KeyringController extends EventEmitter { * * @returns {Promise} - A promise that resolves if the operation was successful. */ - createFirstKeyTree() { + createFirstKeyTree(password) { + this.password = password; this.clearKeyrings(); return this.addNewKeyring('HD Key Tree', { numberOfAccounts: 1 }) .then((keyring) => { From 08ee1824b7d213cc88c54aba18c26017a4cec6e2 Mon Sep 17 00:00:00 2001 From: jpuri Date: Thu, 3 Mar 2022 19:08:15 +0530 Subject: [PATCH 5/8] fix --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 61f3a0ad..b856ffa2 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,8 @@ class KeyringController extends EventEmitter { * @returns {Promise} A Promise that resolves to the state. */ createNewVaultAndKeychain(password) { - return this.createFirstKeyTree.bind(this, password) + return this.createFirstKeyTree + .bind(this, password) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) .then(this.fullUpdate.bind(this)); From 517efcaded2fc7d06a5706352718afcd66e7c60f Mon Sep 17 00:00:00 2001 From: jpuri Date: Thu, 3 Mar 2022 19:11:10 +0530 Subject: [PATCH 6/8] fix --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b856ffa2..270a5c20 100644 --- a/index.js +++ b/index.js @@ -74,7 +74,7 @@ class KeyringController extends EventEmitter { */ createNewVaultAndKeychain(password) { return this.createFirstKeyTree - .bind(this, password) + .bind(this)(password) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) .then(this.fullUpdate.bind(this)); From 42f4d897e585df61cf63880c3c0bdbc7303c4c4a Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Thu, 3 Mar 2022 23:13:20 +0530 Subject: [PATCH 7/8] Update index.js Co-authored-by: Mark Stacey --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 270a5c20..1e6c125e 100644 --- a/index.js +++ b/index.js @@ -73,8 +73,7 @@ class KeyringController extends EventEmitter { * @returns {Promise} A Promise that resolves to the state. */ createNewVaultAndKeychain(password) { - return this.createFirstKeyTree - .bind(this)(password) + return this.createFirstKeyTree(password) .then(this.persistAllKeyrings.bind(this, password)) .then(this.setUnlocked.bind(this)) .then(this.fullUpdate.bind(this)); From 2300b755ec6a049ffd58745a88e121e6fcc2aaab Mon Sep 17 00:00:00 2001 From: jpuri Date: Thu, 3 Mar 2022 23:29:10 +0530 Subject: [PATCH 8/8] updating doc --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 1e6c125e..86dabf4f 100644 --- a/index.js +++ b/index.js @@ -497,6 +497,7 @@ class KeyringController extends EventEmitter { * - Faucets that account on testnet * - Puts the current seed words into the state tree * + * @param {string} password - The keyring controller password. * @returns {Promise} - A promise that resolves if the operation was successful. */ createFirstKeyTree(password) {