Fixed import profile and wallets

This commit is contained in:
Matias Pando 2014-11-07 17:35:32 -03:00
commit 73088bca2b
10 changed files with 37 additions and 104 deletions

View file

@ -225,9 +225,6 @@ Identity.prototype.toObj = function() {
Identity.prototype.exportEncryptedWithWalletInfo = function(opts) {
var crypto = opts.cryptoUtil || cryptoUtil;
//var key = crypto.kdf(this.password);
// return crypto.encrypt(key, this.exportWithWalletInfo(opts));
console.log('exportEncryptedWithWalletInfo');
return crypto.encrypt(this.password, this.exportWithWalletInfo(opts));
};
@ -290,10 +287,6 @@ Identity.prototype.close = function(cb) {
*/
Identity.prototype.importEncryptedWallet = function(cypherText, password, opts, cb) {
var crypto = opts.cryptoUtil || cryptoUtil;
// TODO set iter and salt using config.js
//var key = crypto.kdf(password);
//var obj = crypto.decrypt(key, cypherText);
console.log('importEncryptedWallet');
var obj = crypto.decrypt(password, cypherText);
if (!obj) return cb(new Error('Could not decrypt'));
try {
@ -347,9 +340,7 @@ Identity.prototype.closeWallet = function(wallet, cb) {
Identity.importFromEncryptedFullJson = function(str, password, opts, cb) {
var crypto = opts.cryptoUtil || cryptoUtil;
//var key = crypto.kdf(password);
//var str = crypto.decrypt(key, str);
console.log('importFromEncryptedFullJson');
var str = crypto.decrypt(password, str);
if (!str) {
return cb('BADSTR');
@ -366,9 +357,6 @@ Identity.importFromFullJson = function(str, password, opts, cb) {
return cb('BADSTR: Unable to retrieve json from string', str);
}
// if (!_.isNumber(json.iterations))
// return cb('BADSTR: Missing iterations');
var email = json.email;
opts.email = email;