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

Fix: certifications for NEWCOMERS were not recorded

parent 1c90cbc8
......@@ -32,6 +32,13 @@ module.exports = {
return new KeyHelper(packets);
},
fromEncodedSeparatedPackets: function (encodedKeyPackets, encodedOtherCertifications){
var key = this.fromDecodedPackets(base64.decode(encodedKeyPackets));
if (encodedOtherCertifications)
key.setOtherCertifications(this.toPacketlist(encodedOtherCertifications));
return key;
},
toPacketlist: function (encodedPackets){
var packets = new PacketList();
packets.read(base64.decode(encodedPackets));
......
......@@ -75,8 +75,8 @@ KeyBlockSchema.methods = {
getNewPubkeys: function() {
var pubkeys = [];
this.keysChanges.forEach(function(kc){
if (kc.type == 'F' || kc.type == 'N') {
pubkeys.push(kc.keypackets);
if (kc.type == 'N') {
pubkeys.push(keyhelper.fromEncodedSeparatedPackets(kc.keypackets, kc.certpackets));
}
});
return pubkeys;
......
......@@ -520,8 +520,7 @@ function KeyService (conn, conf, PublicKeyService) {
function (next){
// Save new pubkeys (from NEWCOMERS)
var pubkeys = block.getNewPubkeys();
async.forEach(pubkeys, function(encodedPackets, callback){
var key = keyhelper.fromEncodedPackets(encodedPackets);
async.forEach(pubkeys, function(key, callback){
var fpr = key.getFingerprint();
var uid = key.getUserID();
var kid = fpr.substring(24);
......@@ -529,7 +528,7 @@ function KeyService (conn, conf, PublicKeyService) {
fingerprint: fpr,
keyID: kid,
uid: uid,
packets: encodedPackets
packets: key.getEncodedPacketList()
});
async.parallel({
trusted: function(callback){
......
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