Array.prototype.find replaced for Node.js 0.12 and IE 11

This commit is contained in:
Aydar Zartdinov 2017-02-10 12:12:52 +03:00
parent 3fa4c0c760
commit d9cb8e681d

View File

@ -834,8 +834,9 @@ User.prototype.sign = function(primaryKey, privateKeys) {
*/
User.prototype.verifyAllSignatures = function(primaryKey, keys) {
var dataToVerify = { userid: this.userId || this.userAttribute, key: primaryKey };
return this.selfCertifications.concat(this.otherCertifications).map(signaturePacket => {
var keyPacket = keys.find(key => key.getSigningKeyPacket(signaturePacket.issuerKeyId)) || null;
var certificates = this.selfCertifications.concat(this.otherCertifications || []);
return certificates.map(signaturePacket => {
var keyPacket = keys.filter(key => key.getSigningKeyPacket(signaturePacket.issuerKeyId))[0] || null;
return {
keyid: signaturePacket.issuerKeyId,
valid: keyPacket && signaturePacket.verify(keyPacket.primaryKey, dataToVerify)