Commit a3e5fc2c authored by Cédric Moreau's avatar Cédric Moreau

Fix: sync crash

parent 99bb08b4
...@@ -351,8 +351,8 @@ module.exports = function Synchroniser (server, host, port, authenticated, conf) ...@@ -351,8 +351,8 @@ module.exports = function Synchroniser (server, host, port, authenticated, conf)
}); });
entry.signature = sign; entry.signature = sign;
entry.pubkey = { fingerprint: entry.fingerprint }; entry.pubkey = { fingerprint: entry.fingerprint };
logger.info('Peer 0x' + peer.fingerprint); logger.info('Peer 0x' + entry.fingerprint);
PeeringService.submit(peer, function (err) { PeeringService.submit(entry, function (err) {
cb(); cb();
}); });
} }
......
...@@ -21,10 +21,14 @@ function PeeringService(conn, conf, PublicKeyService, ParametersService) { ...@@ -21,10 +21,14 @@ function PeeringService(conn, conf, PublicKeyService, ParametersService) {
var Key = conn.model('Key'); var Key = conn.model('Key');
var Forward = conn.model('Forward'); var Forward = conn.model('Forward');
this.privateKey = openpgp.key.readArmored(conf.pgpkey).keys[0]; this.privateKey = null;
this.privateKey.decrypt(conf.pgppasswd); this.cert = { fingerprint: '' };
this.ascciiPubkey = this.privateKey ? this.privateKey.toPublic().armor() : ""; if (conf.pgpkey) {
this.cert = this.ascciiPubkey ? jpgp().certificate(this.ascciiPubkey) : { fingerprint: '' }; this.privateKey = openpgp.key.readArmored(conf.pgpkey).keys[0];
this.privateKey.decrypt(conf.pgppasswd);
this.ascciiPubkey = this.privateKey ? this.privateKey.toPublic().armor() : "";
this.cert = this.ascciiPubkey ? jpgp().certificate(this.ascciiPubkey) : { fingerprint: '' };
}
var peer = null; var peer = null;
var peers = {}; var peers = {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment