react-native-disable-ssl
Version:
Toggle SSL validation in React NAtive Apps
38 lines (35 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.disableSSL = disableSSL;
exports.enableSSL = enableSSL;
var _reactNative = require("react-native");
const LINKING_ERROR = `The package 'react-native-disable-ssl' doesn't seem to be linked. Make sure: \n\n` + _reactNative.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 = _reactNative.NativeModules.DisableSsl ? _reactNative.NativeModules.DisableSsl : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
// Function to enable SSL pinning
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
function disableSSL() {
try {
DisableSsl.disableSSL();
console.log('SSL Pinning disabled');
} catch (error) {
console.error('Failed to disable SSL Pinning:', error);
}
}
//# sourceMappingURL=index.js.map