feat(http): add setSSLCertMode function

This commit is contained in:
Daniel 2018-08-21 20:39:21 +02:00
parent 73ae92d77c
commit 8db1dbef71

View File

@ -154,7 +154,9 @@ export class HTTP extends IonicNativePlugin {
* @param url {string}
*/
@Cordova({ sync: true })
getCookieString(url: string): string { return; }
getCookieString(url: string): string {
return;
}
/**
* Get global request timeout value in seconds.
@ -173,26 +175,15 @@ export class HTTP extends IonicNativePlugin {
setRequestTimeout(timeout: number): void {}
/**
* Enable or disable SSL Pinning. This defaults to false.
*
* To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this [stackoverflow answer](https://stackoverflow.com/questions/16583428/how-to-convert-an-ssl-certificate-in-linux/16583429#16583429). You want to convert it to a DER encoded certificate with a .cer extension.
*
* As an alternative, you can store your .cer files in the www/certificates folder.
* @param enable {boolean} Set to true to enable
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
* Set SSL Cert handling mode, being one of the following values
* default: default SSL cert handling using system's CA certs
* nocheck: disable SSL cert checking, trusting all certs (meant to be used only for testing purposes)
* pinned: trust only provided certs
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setsslcertmode
* @param {'default' | 'nocheck' | 'pinned'} mode SSL Cert handling mode
*/
@Cordova()
enableSSLPinning(enable: boolean): Promise<void> {
return;
}
/**
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
* @param accept {boolean} Set to true to accept
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
acceptAllCerts(accept: boolean): Promise<void> {
setSSLCertMode(mode: 'default' | 'nocheck' | 'pinned'): Promise<void> {
return;
}
@ -202,7 +193,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
disableRedirect(disable: boolean): Promise<void> { return; }
disableRedirect(disable: boolean): Promise<void> {
return;
}
/**
* Make a POST request