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