fix(key): only migrate if key doesn't exist

This commit is contained in:
Evan Morikawa 2016-12-05 17:28:37 -08:00
parent ace9b94053
commit d624f6657a

View file

@ -33,15 +33,15 @@ class KeyManager {
}
getPassword(keyName, {migrateFromService} = {}) {
if (migrateFromService && !this._alreadyMigrated.has(migrateFromService)) {
const keys = this._getKeyHash();
if (!keys[keyName] && migrateFromService &&
!this._alreadyMigrated.has(migrateFromService)) {
const oldVal = keytar.getPassword(migrateFromService, keyName);
if (oldVal) {
this.replacePassword(keyName, oldVal)
keytar.deletePassword(migrateFromService, keyName);
this._alreadyMigrated.add(migrateFromService)
}
}
const keys = this._getKeyHash();
return keys[keyName]
}