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)
});
entry.signature = sign;
entry.pubkey = { fingerprint: entry.fingerprint };
logger.info('Peer 0x' + peer.fingerprint);
PeeringService.submit(peer, function (err) {
logger.info('Peer 0x' + entry.fingerprint);
PeeringService.submit(entry, function (err) {
cb();
});
}
......
......@@ -21,10 +21,14 @@ function PeeringService(conn, conf, PublicKeyService, ParametersService) {
var Key = conn.model('Key');
var Forward = conn.model('Forward');
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: '' };
this.privateKey = null;
this.cert = { fingerprint: '' };
if (conf.pgpkey) {
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 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