Commit 1c90cbc8 authored by Cédric Moreau's avatar Cédric Moreau

Add command show-keychain to display keychain's content

parent 270af39b
......@@ -202,6 +202,20 @@ KeyBlockSchema.methods = {
}
done(null, ams[0]);
});
},
display: function (done) {
console.log('------------------');
console.log('Block#%s', this.number);
console.log('Changes:');
this.keysChanges.forEach(function(kc){
console.log('>>> %s %s', kc.type, kc.fingerprint);
var certifs = keyhelper.toPacketlist(kc.certpackets);
certifs.forEach(function(certif){
console.log('>>> certified by 0x%s', certif.issuerKeyId.toHex().toUpperCase());
});
});
done();
}
};
......
......@@ -1168,4 +1168,20 @@ function KeyService (conn, conf, PublicKeyService) {
done(err, block);
});
};
this.showKeychain = function (done) {
async.waterfall([
function (next){
KeyBlock
.find({})
.sort({ number: 1 })
.exec(next);
},
function (blocks, next){
async.forEachSeries(blocks, function(block, callback){
block.display(callback);
}, next);
},
], done);
}
}
......@@ -247,6 +247,17 @@ program
});
}));
program
.command('show-keychain')
.description('Recompute distance between each member and the whole WoT and mark outdistanced ones as kicked')
.action(service(DO_NOT_LISTEN_HTTP, ucoin.createWOTServer, function (server, conf) {
server.KeychainService.showKeychain(function (err) {
if (err) logger.error(err);
server.disconnect();
process.exit();
});
}));
program
.command('compute-certifications')
.description('Recompute available certifications for next blocks')
......
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