Fixed join wallet from remote peer

This commit is contained in:
Gustavo Cortez 2014-05-01 18:34:30 -03:00
commit c98323e9d3
4 changed files with 12 additions and 12 deletions

View file

@ -2,7 +2,7 @@
function Passphrase(config) {
config = config || {};
this.salt = config.storageSalt;
this.salt = config.storageSalt || 'mjuBtGybi/4=';
this.iterations = config.iterations || 1000;
};

View file

@ -153,7 +153,7 @@ WalletFactory.prototype.remove = function(walletId) {
};
WalletFactory.prototype.joinCreateSession = function(secret, nickname, cb) {
WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, cb) {
var self = this;
var s;
@ -162,7 +162,7 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, cb) {
} catch (e) {
return cb('badSecret');
}
//Create our PrivateK
var privateKey = new PrivateKey({ networkName: this.networkName });
this.log('\t### PrivateKey Initialized');
@ -180,6 +180,7 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, cb) {
if (data.type ==='walletId') {
data.opts.privateKey = privateKey;
data.opts.nickname = nickname;
data.opts.passphrase = passphrase;
var w = self.open(data.walletId, data.opts);
w.firstCopayerId = s.pubKey;
return cb(null, w);

View file

@ -47,9 +47,11 @@ Storage.prototype._read = function(k) {
var ret;
try {
ret = localStorage.getItem(k);
ret = this._decrypt(ret);
ret = ret.toString(CryptoJS.enc.Utf8);
ret = JSON.parse(ret);
if (ret){
ret = this._decrypt(ret);
ret = ret.toString(CryptoJS.enc.Utf8);
ret = JSON.parse(ret);
}
} catch (e) {
console.log('Error while decrypting: '+e);
throw e;