fix import wallets and profile form 0.7.2

This commit is contained in:
Matias Alejo Garcia 2014-11-11 15:14:54 -03:00
commit b15679c08c
4 changed files with 45 additions and 28 deletions

View file

@ -198,13 +198,23 @@ Compatibility.importEncryptedWallet = function(identity, cypherText, password, o
var crypto = (opts && opts.cryptoUtil) || cryptoUtils;
var obj = crypto.decrypt(password, cypherText);
if (!obj) {
// 0.7.3 broken KDF
log.debug('Trying legacy encryption 0.7.2...');
var passphrase = crypto.kdf(password, 'mjuBtGybi/4=', 100);
obj = crypto.decrypt(passphrase, cypherText);
}
if (!obj) {
log.info("Could not decrypt, trying legacy..");
obj = Compatibility.importLegacy(cypherText, password);
if (!obj) {
return cb('Could not decrypt', null);
}
};
if (!obj) {
return cb('Could not decrypt', null);
}
try {
obj = JSON.parse(obj);
} catch (e) {