"use strict";
var exec = require('cordova/exec');

function SSLCertificateChecker() {
}

SSLCertificateChecker.prototype.check = function (successCallback, errorCallback, serverURL, allowedSHA1FingerprintOrArray, allowedSHA1FingerprintAlt) {
  if (typeof errorCallback != "function") {
    console.log("SSLCertificateChecker.find failure: errorCallback parameter must be a function");
    return
  }

  if (typeof successCallback != "function") {
    console.log("SSLCertificateChecker.find failure: successCallback parameter must be a function");
    return
  }

  // if an array is not passed, transform the input into one
  var fpArr = [];
  if (allowedSHA1FingerprintOrArray !== undefined) {
      if (typeof allowedSHA1FingerprintOrArray == "string") {
          fpArr.push(allowedSHA1FingerprintOrArray);
      } else {
          fpArr = allowedSHA1FingerprintOrArray.slice(0);
      }
  }
  if (allowedSHA1FingerprintAlt !== undefined) {
      fpArr.push(allowedSHA1FingerprintAlt);
  }
  exec(successCallback, errorCallback, "SSLCertificateChecker", "check", [serverURL, false, fpArr]);
};

SSLCertificateChecker.prototype.checkInCertChain = function (successCallback, errorCallback, serverURL, allowedSHA1FingerprintOrArray, allowedSHA1FingerprintAlt) {
  if (typeof errorCallback != "function") {
    console.log("SSLCertificateChecker.find failure: errorCallback parameter must be a function");
    return
  }
  errorCallback("This function has been removed in versions higher than 4.0.0 because it's considered too insecure.");
  /*
  if (typeof successCallback != "function") {
    console.log("SSLCertificateChecker.find failure: successCallback parameter must be a function");
    return
  }
  // if an array is not passed, transform the input into one
  var fpArr = [];
  if (allowedSHA1FingerprintOrArray !== undefined) {
    if (typeof allowedSHA1FingerprintOrArray == "string") {
      fpArr.push(allowedSHA1FingerprintOrArray);
    } else {
      fpArr = allowedSHA1FingerprintOrArray.slice(0);
    }
  }
  if (allowedSHA1FingerprintAlt !== undefined) {
    fpArr.push(allowedSHA1FingerprintAlt);
  }
  cordova.exec(successCallback, errorCallback, "SSLCertificateChecker", "check", [serverURL, true, fpArr]);
  */
};

var sslCertificateChecker = new SSLCertificateChecker();
module.exports = sslCertificateChecker;

@@ -1096,1147 +1096,8 @@
 %7D;%0A%0A
-SSLCertificateChecker.prototype.checkInCertChain = function (successCallback, errorCallback, serverURL, allowedSHA1FingerprintOrArray, allowedSHA1FingerprintAlt) %7B%0A  if (typeof errorCallback != %22function%22) %7B%0A    console.log(%22SSLCertificateChecker.find failure: errorCallback parameter must be a function%22);%0A    return%0A  %7D%0A  errorCallback(%22This function has been removed in versions higher than 4.0.0 because it's considered too insecure.%22);%0A  /*%0A  if (typeof successCallback != %22function%22) %7B%0A    console.log(%22SSLCertificateChecker.find failure: successCallback parameter must be a function%22);%0A    return%0A  %7D%0A  // if an array is not passed, transform the input into one%0A  var fpArr = %5B%5D;%0A  if (allowedSHA1FingerprintOrArray !== undefined) %7B%0A    if (typeof allowedSHA1FingerprintOrArray == %22string%22) %7B%0A      fpArr.push(allowedSHA1FingerprintOrArray);%0A    %7D else %7B%0A      fpArr = allowedSHA1FingerprintOrArray.slice(0);%0A    %7D%0A  %7D%0A  if (allowedSHA1FingerprintAlt !== undefined) %7B%0A    fpArr.push(allowedSHA1FingerprintAlt);%0A  %7D%0A  cordova.exec(successCallback, errorCallback, %22SSLCertificateChecker%22, %22check%22, %5BserverURL, true, fpArr%5D);%0A  */%0A%7D;%0A%0A
 var 

remove deprecated method