Certificate pinning implementation challenge


#1

I am needed to implement certificate pinning for my Ionic v3 project.

I have around 10 service calls through out the application. I make the call following way

public postCreditScore(token:string, scoreType:string){

console.log('key is:', scoreType)

const data = {
  "action": [scoreType]
};

const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type':  'application/json',
    'x-client-token': 'xxx',
    'x-access-token' : token
  })
};

return this.http.post(`${this.url}/register`, data, httpOptions)
  .map((response: any) => {
    console.log('Response is:',response);
    return response;
  });

}

this.http is notjing but an instance of HttpClient in angular 4

Now I see that to implement certificate pinning i need to use a plugin which routes the network calls through native calls (java / swift) , in this case I will have to change the entire code base to suit to plugin call, no ? is there a simpler way to achieve this ?