Skip to content

Commit

Permalink
feat(http): add setSSLCertMode function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsogl committed Aug 21, 2018
1 parent 73ae92d commit 8db1dbe
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions src/@ionic-native/plugins/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
*/
@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
* 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()
acceptAllCerts(accept: boolean): Promise<void> {
setSSLCertMode(mode: 'default' | 'nocheck' | 'pinned'): Promise<void> {
return;
}

Expand All @@ -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
Expand Down

0 comments on commit 8db1dbe

Please sign in to comment.