diff options
Fix handling of migrating old vault style
Now old vaults are recognized as an "Initialized" MetaMask instance.
Upon logging in, when fetching the initial password-derived key, if there is no new-style vault, but there is an old style vault, it is migrated to the new format before proceeding through the usual unlocking steps.
Diffstat (limited to 'test/unit/keyring-controller-test.js')
-rw-r--r-- | test/unit/keyring-controller-test.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/unit/keyring-controller-test.js b/test/unit/keyring-controller-test.js index e216b0960..16a4ae148 100644 --- a/test/unit/keyring-controller-test.js +++ b/test/unit/keyring-controller-test.js @@ -31,7 +31,7 @@ describe('KeyringController', function() { // Browser crypto is tested in the integration test suite. keyringController.encryptor = mockEncryptor - keyringController.createNewVault(password, null, function (err, state) { + keyringController.createNewVaultAndKeychain(password, null, function (err, state) { done() }) }) @@ -41,11 +41,11 @@ describe('KeyringController', function() { this.sinon.restore() }) - describe('#createNewVault', function () { + describe('#createNewVaultAndKeychain', function () { it('should set a vault on the configManager', function(done) { keyringController.configManager.setVault(null) assert(!keyringController.configManager.getVault(), 'no previous vault') - keyringController.createNewVault(password, null, function (err, state) { + keyringController.createNewVaultAndKeychain(password, null, (err, state) => { assert.ifError(err) const vault = keyringController.configManager.getVault() assert(vault, 'vault created') @@ -54,7 +54,7 @@ describe('KeyringController', function() { }) }) - describe('#restoreKeyring', function(done) { + describe('#restoreKeyring', function() { it(`should pass a keyring's serialized data back to the correct type.`, function() { keyringController.keyringTypes = [ MockSimpleKeychain ] @@ -75,6 +75,16 @@ describe('KeyringController', function() { }) + describe('#migrateAndGetKey', function() { + it('should return the key for that password', function(done) { + keyringController.migrateAndGetKey(password) + .then((key) => { + assert(key, 'a key is returned') + done() + }) + }) + }) + }) |