Only consider most recent user self certification

This commit is contained in:
Daniel Huigens 2018-04-18 14:15:34 +02:00
parent 122d526f49
commit 39c7374d70

View File

@ -528,8 +528,7 @@ Key.prototype.getValidUsers = async function(date=new Date(), allowExpired=false
return;
}
const dataToVerify = { userid: user.userId , key: primaryKey };
for (let j = 0; j < user.selfCertifications.length; j++) {
const cert = user.selfCertifications[j];
const cert = getLatestSignature(user.selfCertifications);
// skip if certificate is not the most recent
if ((cert.isPrimaryUserID && cert.isPrimaryUserID < lastPrimaryUserID) ||
(!lastPrimaryUserID && cert.created < lastCreated)) {
@ -551,7 +550,6 @@ Key.prototype.getValidUsers = async function(date=new Date(), allowExpired=false
lastCreated = cert.created;
validUsers.push({ index: i, user: user, selfCertification: cert });
}
}
return validUsers;
};