frw / react-native-ssl-public-key-pinning

Simple and secure SSL public key pinning for React Native. No native configuration needed, set up in <5 minutes.
MIT License
168 stars 13 forks source link

SSL Pinning with Axios (expo) #75

Closed LeoAnt02 closed 1 year ago

LeoAnt02 commented 1 year ago

Hello

First of all, thank you for developing and maintaining the react-native-ssl-public-key-pinning library.

We are currently using Axios for making HTTP requests in our application, and we would like to apply SSL pinning to these requests using your library.

We have noticed that the library's examples use the fetch API.

My Question: Can we apply the SSL pinning initialized by react-native-ssl-public-key-pinning to the HTTP requests made with Axios, and if so, could you provide us with an example of how this can be achieved?

Axios and fetch are different APIs that may not share the same underlying network transport, and there may be no guarantee that Axios will use the same networking stack that fetch (and presumably react-native-ssl-public-key-pinning) uses.

If Axios is not compatible with react-native-ssl-public-key-pinning, do you have any recommendations on how we can achieve SSL pinning with Axios?

frw commented 1 year ago

Hi @LeoAnt02,

Yes, this library will support axios. As mentioned in the Overview and Additional Notes, all network requests done through the standard React Native networking APIs (e.g. fetch and XMLHTTPRequest) will be covered by this library. axios uses XMLHttpRequest under the hood, and so will be affected by the pinning set by this library.

Let me know if you are having issues with integrating this library with axios.

Cheers.