function validate(publicKeyArmored, detachedSignature, input) {
  logger.info('Validate');
  return new Promise(async (fulfill, reject) => {
    let signature;
    try {
      const verified = await openpgp.verify({
        message: openpgp.cleartext.fromText(input), // CleartextMessage or Message object
        signature: await openpgp.signature.readArmored(detachedSignature), // parse signature
        publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys, // for verification
      });
      const { valid } = verified.signatures[0];
      if (valid === true) {
        logger.debug(`signed by key id ${verified.signatures[0].keyid.toHex()}`);
        fulfill(valid);
      } else if (valid === false) {
        logger.error('invalid signature');
        fulfill(valid);
      } else {
        logger.error('invalid fingerprint');
        reject(new Error('invalid fingerprint'));
      }
    } catch (e) {
      logger.error(e);
      reject(e.message);
    }
  });
}
/**
 * Validates the signature matches the passed data
 * @func
 * @param publicKeyArmored {string} the public key
 * @param detachedSignature {string} the signature
 * @param data {object} data to valdiate
 */
Validates the signature matches the passed data
@func
@param publicKeyArmored {string} the public key
@param detachedSignature {string} the signature
@param data {object} data to valdiate
Validates the signature matches the passed data @func @param publicKeyArmored { string } the public key @param detachedSignature { string } the signature @param data { object } data to valdiate
function validate(publicKeyArmored, detachedSignature, input) {
  logger.info('Validate');
  return new Promise(async (fulfill, reject) => {
    let signature;
    try {
      const verified = await openpgp.verify({
        message: openpgp.cleartext.fromText(input), 
        signature: await openpgp.signature.readArmored(detachedSignature), 
        publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys, 
      });
      const { valid } = verified.signatures[0];
      if (valid === true) {
        logger.debug(`signed by key id ${verified.signatures[0].keyid.toHex()}`);
        fulfill(valid);
      } else if (valid === false) {
        logger.error('invalid signature');
        fulfill(valid);
      } else {
        logger.error('invalid fingerprint');
        reject(new Error('invalid fingerprint'));
      }
    } catch (e) {
      logger.error(e);
      reject(e.message);
    }
  });
}
function validate ( publicKeyArmored , detachedSignature , input ) { logger . info ( 'Validate' ) ; return new Promise ( async ( fulfill , reject ) => { let signature ; try { const verified = await openpgp . verify ( { message : openpgp . cleartext . fromText ( input ) , signature : await openpgp . signature . readArmored ( detachedSignature ) , publicKeys : ( await openpgp . key . readArmored ( publicKeyArmored ) ) . keys , } ) ; const { valid } = verified . signatures [ 0 ] ; if ( valid === true ) { logger . debug ( ` ${ verified . signatures [ 0 ] . keyid . toHex ( ) } ` ) ; fulfill ( valid ) ; } else if ( valid === false ) { logger . error ( 'invalid signature' ) ; fulfill ( valid ) ; } else { logger . error ( 'invalid fingerprint' ) ; reject ( new Error ( 'invalid fingerprint' ) ) ; } } catch ( e ) { logger . error ( e ) ; reject ( e . message ) ; } } ) ; }
Validates the signature matches the passed data
 @func
 @param publicKeyArmored {string} the public key
 @param detachedSignature {string} the signature
 @param data {object} data to valdiate
Validates the signature matches the passed data @func @param publicKeyArmored { string } the public key @param detachedSignature { string } the signature @param data { object } data to valdiate
// CleartextMessage or Message object
 // parse signature
 // for verification
