|
|
|
@ -2,6 +2,7 @@ const IdentityStore = require('./idStore') |
|
|
|
|
const HdKeyring = require('../keyrings/hd') |
|
|
|
|
const sigUtil = require('./sig-util') |
|
|
|
|
const normalize = sigUtil.normalize |
|
|
|
|
const denodeify = require('denodeify') |
|
|
|
|
|
|
|
|
|
module.exports = class IdentityStoreMigrator { |
|
|
|
|
|
|
|
|
@ -25,14 +26,13 @@ module.exports = class IdentityStoreMigrator { |
|
|
|
|
return Promise.resolve(null) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
this.idStore.submitPassword(password, (err) => { |
|
|
|
|
if (err) return reject(err) |
|
|
|
|
const idStore = this.idStore |
|
|
|
|
const submitPassword = denodeify(idStore.submitPassword.bind(idStore)) |
|
|
|
|
|
|
|
|
|
return submitPassword(password) |
|
|
|
|
.then(() => { |
|
|
|
|
const serialized = this.serializeVault() |
|
|
|
|
this.checkForErrors(serialized) |
|
|
|
|
.then(resolve) |
|
|
|
|
.catch(reject) |
|
|
|
|
}) |
|
|
|
|
return this.checkForLostAccounts(serialized) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -46,7 +46,7 @@ module.exports = class IdentityStoreMigrator { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkForErrors (serialized) { |
|
|
|
|
checkForLostAccounts (serialized) { |
|
|
|
|
const hd = new HdKeyring() |
|
|
|
|
return hd.deserialize(serialized.data) |
|
|
|
|
.then((hexAccounts) => { |
|
|
|
|