react-native-disable-ssl
Version:
Toggle SSL validation in React NAtive Apps
33 lines (30 loc) • 980 B
JavaScript
;
import { NativeModules, Platform } from 'react-native';
const LINKING_ERROR = `The package 'react-native-disable-ssl' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
ios: "- You have run 'pod install'\n",
default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
const DisableSsl = NativeModules.DisableSsl ? NativeModules.DisableSsl : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
// Function to enable SSL pinning
export function enableSSL() {
try {
DisableSsl.enableSSL();
console.log('SSL Pinning enabled');
} catch (error) {
console.error('Failed to enable SSL Pinning:', error);
}
}
// Function to disable SSL pinning
export function disableSSL() {
try {
DisableSsl.disableSSL();
console.log('SSL Pinning disabled');
} catch (error) {
console.error('Failed to disable SSL Pinning:', error);
}
}
//# sourceMappingURL=index.js.map