src/key.js
async function isDataRevoked(primaryKey, signatureType, dataToVerify, revocations, signature, key, date=new Date()) {
  key = key || primaryKey;
  const normDate = util.normalizeDate(date);
  const revocationKeyIds = [];
  await Promise.all(revocations.map(async function(revocationSignature) {
    if (
      // Note: a third-party revocation signature could legitimately revoke a
      // self-signature if the signature has an authorized revocation key.
      // However, we don't support passing authorized revocation keys, nor
      // verifying such revocation signatures. Instead, we indicate an error
      // when parsing a key with an authorized revocation key, and ignore
      // third-party revocation signatures here. (It could also be revoking a
      // third-party key certification, which should only affect
      // `verifyAllCertifications`.)
      (!signature || revocationSignature.issuerKeyId.equals(signature.issuerKeyId)) &&
      !(config.revocations_expire && revocationSignature.isExpired(normDate)) &&
      (revocationSignature.verified || await revocationSignature.verify(key, signatureType, dataToVerify))
    ) {
      // TODO get an identifier of the revoked object instead
      revocationKeyIds.push(revocationSignature.issuerKeyId);
      return true;
    }
    return false;
  }));
  // TODO further verify that this is the signature that should be revoked
  if (signature) {
    signature.revoked = revocationKeyIds.some(keyId => keyId.equals(signature.issuerKeyId)) ? true :
      signature.revoked || false;
    return signature.revoked;
  }
  return revocationKeyIds.length > 0;
}
async function isDataRevoked(primaryKey, signatureType, dataToVerify, revocations, signature, key, date=new Date()) {
  key = key || primaryKey;
  const normDate = util.normalizeDate(date);
  const revocationKeyIds = [];
  await Promise.all(revocations.map(async function(revocationSignature) {
    if (
      // Note: a third-party revocation signature could legitimately revoke a
      // self-signature if the signature has an authorized revocation key.
      // However, we don't support passing authorized revocation keys, nor
      // verifying such revocation signatures. Instead, we indicate an error
      // when parsing a key with an authorized revocation key, and ignore
      // third-party revocation signatures here. (It could also be revoking a
      // third-party key certification, which should only affect
      // `verifyAllCertifications`.)
      (!signature || revocationSignature.issuerKeyId.equals(signature.issuerKeyId)) &&
      !(config.revocations_expire && revocationSignature.isExpired(normDate)) &&
      (revocationSignature.verified || await revocationSignature.verify(key, signatureType, dataToVerify))
    ) {
      // TODO get an identifier of the revoked object instead
      revocationKeyIds.push(revocationSignature.issuerKeyId);
      return true;
    }
    return false;
  }));
  // TODO further verify that this is the signature that should be revoked
  if (signature) {
    signature.revoked = revocationKeyIds.some(keyId => keyId.equals(signature.issuerKeyId)) ? true :
      signature.revoked || false;
    return signature.revoked;
  }
  return revocationKeyIds.length > 0;
}
async function isDataRevoked ( primaryKey , signatureType , dataToVerify , revocations , signature , key , date = new Date ( ) ) { key = key || primaryKey ; const normDate = util . normalizeDate ( date ) ; const revocationKeyIds = [ ] ; await Promise . all ( revocations . map ( async function ( revocationSignature ) { if ( // Note: a third-party revocation signature could legitimately revoke a // self-signature if the signature has an authorized revocation key. // However, we don't support passing authorized revocation keys, nor // verifying such revocation signatures. Instead, we indicate an error // when parsing a key with an authorized revocation key, and ignore // third-party revocation signatures here. (It could also be revoking a // third-party key certification, which should only affect // `verifyAllCertifications`.) ( ! signature || revocationSignature . issuerKeyId . equals ( signature . issuerKeyId ) ) && ! ( config . revocations_expire && revocationSignature . isExpired ( normDate ) ) && ( revocationSignature . verified || await revocationSignature . verify ( key , signatureType , dataToVerify ) ) ) { // TODO get an identifier of the revoked object instead revocationKeyIds . push ( revocationSignature . issuerKeyId ) ; return true ; } return false ; } ) ) ; // TODO further verify that this is the signature that should be revoked if ( signature ) { signature . revoked = revocationKeyIds . some ( keyId => keyId . equals ( signature . issuerKeyId ) ) ? true : signature . revoked || false ; return signature . revoked ; } return revocationKeyIds . length > 0 ; }
Checks if a given certificate or binding signature is revoked
@param  {module:packet.SecretKey|
module:packet.PublicKey}       primaryKey   The primary key packet
@param  {Object}                         dataToVerify The data to check
@param  {Array<module:packet.Signature>} revocations  The revocation signatures to check
@param  {module:packet.Signature}        signature    The certificate or signature to check
@param  {module:packet.PublicSubkey|
module:packet.SecretSubkey|
module:packet.PublicKey|
module:packet.SecretKey} key, optional The key packet to check the signature
@param  {Date}                     date          Use the given date instead of the current time
@returns {Promise<Boolean>}                      True if the signature revokes the data
@async
Checks if a given certificate or binding signature is revoked