validate(hash) {
    const parsedHash = typeof hash === "string" ? JSON.parse(hash) : hash;

    const convertedHash = convertLambdaMessage(parsedHash);

    if (!validateMessageStructure(convertedHash)) {
      throw new Error("Message missing required keys.");
    }

    if (!validateUrl(convertedHash["SigningCertURL"], this.hostPattern)) {
      throw new Error("The certificate is located on an invalid domain.");
    }

    return validateSignature(convertedHash, this.encoding);
  }
/**
   * Validates a message's signature and passes it to the provided callback.
   *
   * @param {Object} hash
   */
Validates a message's signature and passes it to the provided callback.
@param {Object} hash
Validates a message ' s signature and passes it to the provided callback . @param { Object } hash
validate(hash) {
    const parsedHash = typeof hash === "string" ? JSON.parse(hash) : hash;
    const convertedHash = convertLambdaMessage(parsedHash);
    if (!validateMessageStructure(convertedHash)) {
      throw new Error("Message missing required keys.");
    }
    if (!validateUrl(convertedHash["SigningCertURL"], this.hostPattern)) {
      throw new Error("The certificate is located on an invalid domain.");
    }
    return validateSignature(convertedHash, this.encoding);
  }
validate ( hash ) { const parsedHash = typeof hash === "string" ? JSON . parse ( hash ) : hash ; const convertedHash = convertLambdaMessage ( parsedHash ) ; if ( ! validateMessageStructure ( convertedHash ) ) { throw new Error ( "Message missing required keys." ) ; } if ( ! validateUrl ( convertedHash [ "SigningCertURL" ] , this . hostPattern ) ) { throw new Error ( "The certificate is located on an invalid domain." ) ; } return validateSignature ( convertedHash , this . encoding ) ; }
Validates a message's signature and passes it to the provided callback.
Validates a message ' s signature and passes it to the provided callback .