https://github.com/bamlab/react-native-ssl-pinning
Implements SSLPinning with expo-module and expo-plugin
https://github.com/bamlab/react-native-ssl-pinning
Last synced: 12 months ago
JSON representation
Implements SSLPinning with expo-module and expo-plugin
- Host: GitHub
- URL: https://github.com/bamlab/react-native-ssl-pinning
- Owner: bamlab
- Created: 2023-09-01T14:25:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-04T14:23:28.000Z (over 2 years ago)
- Last Synced: 2025-06-09T06:09:38.683Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 271 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ⛔️ [DEPRECATED] react-native-ssl-pinning
**This package has been superseeded by [react-native-app-security](https://github.com/bamlab/react-native-app-security). Please head there for a more up-to-date SSL pinning implementation.**
## Overview
This module implements SSL Pinning using an expo-module and an expo-plugin
## Setting up the plugin
1. Add the plugin to your dev dependencies
```bash
yarn add -D @bam.tech/react-native-ssl-pinning
```
1. In your `app.config.ts` file, add the following attributes.
```ts
//Example of host name and certificates with google.com
const hostName = "google.com";
//Do not include the 'sha256/' part in certificates
const certificateSHAFinal = "We74o5ME3USRtL6+B2UhXnwY9FR91QPJMYDtUNk6tEc=";
const certificateSHAIntermediate = "zCTnfLwLKbS9S2sbp+uFz4KZOocFvXxkV06Ce9O5M2w=";
const certificateSHARoot = "hxqRlPTu1bMS/0DITB1SSu0vd4u/8l8TjPgfaAp63Gc=";
const config: ExpoConfig = {
plugins: [
[
"@bam.tech/react-native-ssl-pinning",
{
hostName: hostName,
certificates: [
certificateSHAFinal,
certificateSHAIntermediate,
certificateSHARoot,
],
},
],
],
};
module.exports = config;
```
## Using the plugin
1. To use the plugin, run the following commands:
```bash
npx expo prebuild --clean
```
1. It generates the configuration file for our plugin, then run
```bash
npx pod-install
```
1. You might need to clean your caches. If required, run :
```bash
rm -rf ~/Library/Developer/Xcode/DerivedData
```
## Testing the plugin
1. To test if SSL Pinning is working, you can:
- break (change) one or several certificates and see if the connexion with the server is still up when you rebuild the app
- set up a proxy such as Proxyman and check if the connexion fails