peerId hashing WIP2

This commit is contained in:
Matias Alejo Garcia 2014-04-23 13:44:20 -03:00
commit c1881d5fbb
5 changed files with 162 additions and 89 deletions

View file

@ -139,21 +139,21 @@ WalletFactory.prototype.remove = function(walletId) {
};
WalletFactory.prototype.joinCreateSession = function(peerId, cb) {
WalletFactory.prototype.joinCreateSession = function(copayerId, cb) {
var self = this;
//Create our PrivateK
var privateKey = new PrivateKey({ networkName: this.networkName });
this.log('\t### PrivateKey Initialized');
self.network.setPeerId(privateKey.getId());
self.network.setCopayerId(privateKey.getId());
self.network.start(function() {
self.network.connectTo(peerId);
self.network.connectTo(copayerId);
self.network.on('data', function(sender, data) {
if (data.type ==='walletId') {
data.opts.privateKey = privateKey;
var w = self.open(data.walletId, data.opts);
w.firstPeerId = peerId;
w.firstCopayerId = copayerId;
return cb(w);
}
});