diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-11-03 06:04:50 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-11-03 06:04:50 +0800 |
commit | 4cf1b606e46fa735263b5e1fade5910b572335e3 (patch) | |
tree | ca0ca5ae19d0699002877cd26e14f84a207d4f4d /test/unit/keyring-controller-test.js | |
parent | 8f3db0dbc0bafdc604bd7359bd41370f594c792c (diff) | |
download | tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.gz tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.zst tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.zip |
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() + }) + }) + }) + }) |