Added error when trying to unlock uninitialized vault

This commit is contained in:
Dan Finlay 2016-12-21 17:19:53 -08:00
parent 48f2ae2154
commit 05ce7086f7
1 changed files with 4 additions and 0 deletions

View File

@ -721,6 +721,10 @@ module.exports = class KeyringController extends EventEmitter {
// initializing the persisted keyrings to RAM.
unlockKeyrings (password) {
const encryptedVault = this.configManager.getVault()
if (!encryptedVault) {
throw new Error('Cannot unlock without a previous vault.')
}
return this.encryptor.decrypt(password, encryptedVault)
.then((vault) => {
this.password = password