react-native-ssl-manager 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.plugin.js ADDED
@@ -0,0 +1,290 @@
1
+ const {
2
+ withDangerousMod,
3
+ withAndroidManifest,
4
+ } = require('@expo/config-plugins');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ /**
9
+ * Expo Config Plugin for react-native-ssl-manager
10
+ * Automatically configures SSL pinning for Expo projects
11
+ */
12
+ function withSslManager(config, options = {}) {
13
+ const {
14
+ enableAndroid = true,
15
+ enableIOS = true,
16
+ sslConfigPath = 'ssl_config.json',
17
+ } = options;
18
+
19
+ // Add Android configuration
20
+ if (enableAndroid) {
21
+ config = withAndroidSslPinning(config);
22
+ config = withAndroidMainApplication(config);
23
+ config = withAndroidAssets(config, { sslConfigPath });
24
+ }
25
+
26
+ // Add iOS configuration
27
+ if (enableIOS) {
28
+ config = withIOSSslPinning(config);
29
+ config = withIosAssets(config, { sslConfigPath });
30
+ }
31
+
32
+ return config;
33
+ }
34
+
35
+ /**
36
+ * Configure Android SSL pinning
37
+ */
38
+ function withAndroidSslPinning(config) {
39
+ return withAndroidManifest(config, (config) => {
40
+ const manifest = config.modResults;
41
+
42
+ // Add required permissions
43
+ if (!manifest.manifest['uses-permission']) {
44
+ manifest.manifest['uses-permission'] = [];
45
+ }
46
+
47
+ const permissions = Array.isArray(manifest.manifest['uses-permission'])
48
+ ? manifest.manifest['uses-permission']
49
+ : [manifest.manifest['uses-permission']];
50
+
51
+ // Add INTERNET permission if not exists
52
+ if (
53
+ !permissions.find(
54
+ (p) => p.$['android:name'] === 'android.permission.INTERNET'
55
+ )
56
+ ) {
57
+ permissions.push({
58
+ $: {
59
+ 'android:name': 'android.permission.INTERNET',
60
+ },
61
+ });
62
+ }
63
+
64
+ manifest.manifest['uses-permission'] = permissions;
65
+ return config;
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Configure Android MainApplication - No longer needed as autolinking handles package registration
71
+ * Keeping function for backward compatibility but removing auto-registration to avoid duplicates
72
+ */
73
+ function withAndroidMainApplication(config) {
74
+ // No longer auto-register package - let autolinking handle it
75
+ // This prevents duplicate module registration errors
76
+ return config;
77
+ }
78
+
79
+ /**
80
+ * Auto-copy SSL config to Android assets
81
+ */
82
+ function withAndroidAssets(config, options) {
83
+ return withDangerousMod(config, [
84
+ 'android',
85
+ async (config) => {
86
+ const { sslConfigPath = 'ssl_config.json' } = options;
87
+
88
+ try {
89
+ const projectRoot = config.modRequest.projectRoot;
90
+ const sourceConfigPath = path.resolve(projectRoot, sslConfigPath);
91
+
92
+ if (fs.existsSync(sourceConfigPath)) {
93
+ const assetsDir = path.join(
94
+ config.modRequest.platformProjectRoot,
95
+ 'app/src/main/assets'
96
+ );
97
+
98
+ // Create assets directory if it doesn't exist
99
+ if (!fs.existsSync(assetsDir)) {
100
+ fs.mkdirSync(assetsDir, { recursive: true });
101
+ }
102
+
103
+ // Copy SSL config to assets
104
+ const targetPath = path.join(assetsDir, 'ssl_config.json');
105
+ fs.copyFileSync(sourceConfigPath, targetPath);
106
+ } else {
107
+ console.warn(`⚠️ SSL config file not found at: ${sourceConfigPath}`);
108
+ console.warn(
109
+ '💡 Place ssl_config.json in your project root for auto-setup'
110
+ );
111
+ }
112
+ } catch (error) {
113
+ console.warn('⚠️ Failed to auto-copy SSL config to assets:', error);
114
+ }
115
+
116
+ return config;
117
+ },
118
+ ]);
119
+ }
120
+
121
+ /**
122
+ * Configure iOS SSL pinning - No Info.plist modification needed
123
+ * SSL pinning is handled by SharedLogic.swift at runtime
124
+ */
125
+ function withIOSSslPinning(config) {
126
+ // No Info.plist modifications needed
127
+ // SSL pinning is initialized at runtime by SharedLogic.swift
128
+
129
+ return config;
130
+ }
131
+
132
+ /**
133
+ * Auto-copy SSL config to iOS bundle resources and add to Xcode project
134
+ */
135
+ function withIosAssets(config, options) {
136
+ // First copy the file
137
+ config = withDangerousMod(config, [
138
+ 'ios',
139
+ async (config) => {
140
+ const { sslConfigPath = 'ssl_config.json' } = options;
141
+
142
+ try {
143
+ const projectRoot = config.modRequest.projectRoot;
144
+ const sourceConfigPath = path.resolve(projectRoot, sslConfigPath);
145
+
146
+ if (fs.existsSync(sourceConfigPath)) {
147
+ // Create ios directory if it doesn't exist
148
+ const iosDir = path.join(projectRoot, 'ios');
149
+ if (!fs.existsSync(iosDir)) {
150
+ fs.mkdirSync(iosDir, { recursive: true });
151
+ }
152
+
153
+ // Copy ssl_config.json to ios directory
154
+ const targetConfigPath = path.join(iosDir, 'ssl_config.json');
155
+ fs.copyFileSync(sourceConfigPath, targetConfigPath);
156
+
157
+ // Also copy to app bundle directory for Xcode project
158
+ const appBundleDir = path.join(iosDir, config.modRequest.projectName);
159
+ const appBundleConfigPath = path.join(
160
+ appBundleDir,
161
+ 'ssl_config.json'
162
+ );
163
+ if (fs.existsSync(appBundleDir)) {
164
+ fs.copyFileSync(sourceConfigPath, appBundleConfigPath);
165
+ }
166
+ } else {
167
+ console.warn(`⚠️ SSL config file not found at: ${sourceConfigPath}`);
168
+ console.warn(
169
+ '💡 Place ssl_config.json in your project root for auto-setup'
170
+ );
171
+ }
172
+ } catch (error) {
173
+ console.warn('⚠️ Failed to copy SSL config:', error);
174
+ }
175
+
176
+ return config;
177
+ },
178
+ ]);
179
+
180
+ // Add to Xcode project programmatically - run in same withDangerousMod as file copy
181
+ config = withDangerousMod(config, [
182
+ 'ios',
183
+ async (config) => {
184
+ // First ensure file is copied to app bundle directory
185
+ const projectName = config.modRequest.projectName || 'exampleexpo';
186
+ const projectRoot = config.modRequest.projectRoot;
187
+ const sourceConfigPath = path.resolve(projectRoot, 'ssl_config.json');
188
+ const appBundleDir = path.join(
189
+ config.modRequest.platformProjectRoot,
190
+ projectName
191
+ );
192
+ const appBundleConfigPath = path.join(appBundleDir, 'ssl_config.json');
193
+
194
+ // Ensure SSL config is copied to app bundle directory
195
+ if (fs.existsSync(sourceConfigPath) && fs.existsSync(appBundleDir)) {
196
+ fs.copyFileSync(sourceConfigPath, appBundleConfigPath);
197
+ }
198
+
199
+ try {
200
+ const projectPath = path.join(
201
+ config.modRequest.platformProjectRoot,
202
+ `${projectName}.xcodeproj/project.pbxproj`
203
+ );
204
+ const sslConfigPath = appBundleConfigPath;
205
+
206
+ if (!fs.existsSync(projectPath) || !fs.existsSync(sslConfigPath)) {
207
+ console.warn(
208
+ '⚠️ Xcode project or SSL config not found, skipping automatic addition'
209
+ );
210
+ return config;
211
+ }
212
+
213
+ let projectContent = fs.readFileSync(projectPath, 'utf8');
214
+
215
+ // Check if already added
216
+ if (projectContent.includes('ssl_config.json')) {
217
+ return config;
218
+ }
219
+
220
+ // Generate unique IDs for the file
221
+ const fileRefId =
222
+ 'SSL' + Math.random().toString(36).substr(2, 24).toUpperCase();
223
+ const buildFileId =
224
+ 'SSL' + Math.random().toString(36).substr(2, 24).toUpperCase();
225
+
226
+ // Add file reference
227
+ const fileRefEntry = `\t\t${fileRefId} /* ssl_config.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = ssl_config.json; sourceTree = "<group>"; };`;
228
+ projectContent = projectContent.replace(
229
+ '/* End PBXFileReference section */',
230
+ fileRefEntry + '\n\t\t/* End PBXFileReference section */'
231
+ );
232
+
233
+ // Add build file
234
+ const buildFileEntry = `\t\t${buildFileId} /* ssl_config.json in Resources */ = {isa = PBXBuildFile; fileRef = ${fileRefId} /* ssl_config.json */; };`;
235
+ projectContent = projectContent.replace(
236
+ '/* End PBXBuildFile section */',
237
+ buildFileEntry + '\n\t\t/* End PBXBuildFile section */'
238
+ );
239
+
240
+ // Add to resources build phase
241
+ const resourcesPhaseMatch = projectContent.match(
242
+ /(\w+) \/\* Resources \*\/ = \{[^}]*files = \(([^)]*)\)/
243
+ );
244
+ if (resourcesPhaseMatch) {
245
+ const filesSection = resourcesPhaseMatch[2];
246
+ const newFilesSection =
247
+ filesSection +
248
+ `\t\t\t\t${buildFileId} /* ssl_config.json in Resources */,\n`;
249
+ projectContent = projectContent.replace(
250
+ `files = (${filesSection})`,
251
+ `files = (\n${newFilesSection}\t\t\t)`
252
+ );
253
+ }
254
+
255
+ // Add to main group
256
+ const mainGroupMatch = projectContent.match(
257
+ new RegExp(
258
+ `(\\w+) /\\* ${projectName} \\*/ = \\{[^}]*children = \\(([^)]*)\\)`
259
+ )
260
+ );
261
+ if (mainGroupMatch) {
262
+ const childrenSection = mainGroupMatch[2];
263
+ const newChildrenSection =
264
+ childrenSection + `\t\t\t\t${fileRefId} /* ssl_config.json */,\n`;
265
+ projectContent = projectContent.replace(
266
+ `children = (${childrenSection})`,
267
+ `children = (\n${newChildrenSection}\t\t\t)`
268
+ );
269
+ }
270
+
271
+ // Write back to file
272
+ fs.writeFileSync(projectPath, projectContent);
273
+ } catch (error) {
274
+ console.warn(
275
+ '⚠️ Failed to add SSL config to Xcode project:',
276
+ error.message
277
+ );
278
+ console.warn(
279
+ '💡 File copied to ios/ directory, manual Xcode setup may be needed'
280
+ );
281
+ }
282
+
283
+ return config;
284
+ },
285
+ ]);
286
+
287
+ return config;
288
+ }
289
+
290
+ module.exports = withSslManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ssl-manager",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "React Native SSL Pinning provides seamless SSL certificate pinning integration for enhanced network security in React Native apps. This module enables developers to easily implement and manage certificate pinning, protecting applications against man-in-the-middle (MITM) attacks. With dynamic configuration options and the ability to toggle SSL pinning, it's particularly useful for development and testing scenarios.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",
@@ -29,11 +29,12 @@
29
29
  "android",
30
30
  "ios",
31
31
  "plugin",
32
+ "app.plugin.js",
32
33
  "*.podspec",
33
34
  "react-native-ssl-manager.podspec",
34
35
  "expo-module.config.json",
35
36
  "react-native.config.js",
36
- "scripts/build.sh",
37
+ "scripts",
37
38
  "!**/__tests__",
38
39
  "!**/__fixtures__",
39
40
  "!**/__mocks__",
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'react-native-ssl-manager'
3
- s.version = '1.0.1'
3
+ s.version = '1.0.3'
4
4
  s.summary = 'SSL Pinning Module for React Native and Expo'
5
5
  s.author = 'Huy Tran'
6
6
  s.homepage = 'https://github.com/huytdps13400/react-native-ssl-manager'
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // React Native SSL Manager Post-Install Setup for Bun
4
+ // Automatically applies Gradle script for SSL config auto-copy
5
+
6
+ import { readFileSync, writeFileSync, existsSync } from 'fs';
7
+ import { join, dirname } from 'path';
8
+
9
+ console.log('🔧 React Native SSL Manager - Bun Post-install setup');
10
+
11
+ // Find project root (where bun.lockb is)
12
+ let projectRoot = process.cwd();
13
+ while (projectRoot !== '/' && !existsSync(join(projectRoot, 'bun.lockb'))) {
14
+ projectRoot = dirname(projectRoot);
15
+ }
16
+
17
+ if (projectRoot === '/') {
18
+ console.log('❌ Could not find project root with bun.lockb');
19
+ process.exit(1);
20
+ }
21
+
22
+ console.log(`📂 Project root: ${projectRoot}`);
23
+ console.log(`📦 Package manager: Bun`);
24
+
25
+ // Check if this is a React Native project
26
+ const packageJsonPath = join(projectRoot, 'package.json');
27
+ if (!existsSync(packageJsonPath)) {
28
+ console.log('❌ package.json not found');
29
+ process.exit(1);
30
+ }
31
+
32
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
33
+ const hasReactNative =
34
+ packageJson.dependencies &&
35
+ (packageJson.dependencies['react-native'] ||
36
+ packageJson.devDependencies?.['react-native']);
37
+
38
+ if (!hasReactNative) {
39
+ console.log('ℹ️ Not a React Native project, skipping setup');
40
+ process.exit(0);
41
+ }
42
+
43
+ // Setup Android Gradle script
44
+ const androidBuildGradlePath = join(
45
+ projectRoot,
46
+ 'android',
47
+ 'app',
48
+ 'build.gradle'
49
+ );
50
+ const sslGradleScriptPath = join(
51
+ __dirname,
52
+ '..',
53
+ 'android',
54
+ 'ssl-pinning-setup.gradle'
55
+ );
56
+
57
+ if (existsSync(androidBuildGradlePath)) {
58
+ console.log('📱 Android project detected');
59
+
60
+ // Read current build.gradle
61
+ let buildGradleContent = readFileSync(androidBuildGradlePath, 'utf8');
62
+
63
+ // Check if our script is already applied
64
+ const scriptApplyLine =
65
+ "apply from: '../../node_modules/react-native-ssl-manager/android/ssl-pinning-setup.gradle'";
66
+
67
+ if (!buildGradleContent.includes('ssl-pinning-setup.gradle')) {
68
+ console.log('🔄 Adding SSL config auto-copy script to build.gradle');
69
+
70
+ // Add script at the end
71
+ buildGradleContent += `\n\n// React Native SSL Manager - Auto-copy SSL config\n${scriptApplyLine}\n`;
72
+
73
+ // Write back to file
74
+ writeFileSync(androidBuildGradlePath, buildGradleContent);
75
+ console.log('✅ SSL config auto-copy script added successfully');
76
+ console.log('💡 SSL config will now be automatically copied on build');
77
+ } else {
78
+ console.log('✅ SSL config auto-copy script already present');
79
+ }
80
+
81
+ console.log(
82
+ '📋 Run "cd android && ./gradlew checkSslConfig" to verify setup'
83
+ );
84
+ } else {
85
+ console.log('ℹ️ Android build.gradle not found, skipping Android setup');
86
+ }
87
+
88
+ // Check for ssl_config.json in project root
89
+ const sslConfigPath = join(projectRoot, 'ssl_config.json');
90
+ if (existsSync(sslConfigPath)) {
91
+ console.log('✅ ssl_config.json found at project root');
92
+ } else {
93
+ console.log('⚠️ ssl_config.json not found at project root');
94
+ console.log(
95
+ '💡 Create ssl_config.json at project root for SSL pinning to work'
96
+ );
97
+ }
98
+
99
+ console.log('🎉 React Native SSL Manager Bun setup complete!');
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+
3
+ // React Native SSL Manager Post-Install Setup
4
+ // Automatically applies Gradle script for SSL config auto-copy
5
+ // Supports both npm/yarn and bun package managers
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ console.log('🔧 React Native SSL Manager - Post-install setup');
11
+
12
+ // Find project root (where node_modules is)
13
+ let projectRoot = process.cwd();
14
+ while (
15
+ projectRoot !== '/' &&
16
+ !fs.existsSync(path.join(projectRoot, 'node_modules')) &&
17
+ !fs.existsSync(path.join(projectRoot, 'bun.lockb'))
18
+ ) {
19
+ projectRoot = path.dirname(projectRoot);
20
+ }
21
+
22
+ if (projectRoot === '/') {
23
+ console.log('❌ Could not find project root');
24
+ process.exit(1);
25
+ }
26
+
27
+ // Detect package manager
28
+ const isBun = fs.existsSync(path.join(projectRoot, 'bun.lockb'));
29
+ const packageManager = isBun ? 'Bun' : 'npm/yarn';
30
+
31
+ console.log(`📂 Project root: ${projectRoot}`);
32
+ console.log(`📦 Package manager: ${packageManager}`);
33
+
34
+ // Check if this is a React Native project
35
+ const packageJsonPath = path.join(projectRoot, 'package.json');
36
+ if (!fs.existsSync(packageJsonPath)) {
37
+ console.log('❌ package.json not found');
38
+ process.exit(1);
39
+ }
40
+
41
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
42
+ const hasReactNative =
43
+ packageJson.dependencies &&
44
+ (packageJson.dependencies['react-native'] ||
45
+ packageJson.devDependencies?.['react-native']);
46
+
47
+ if (!hasReactNative) {
48
+ console.log('ℹ️ Not a React Native project, skipping setup');
49
+ process.exit(0);
50
+ }
51
+
52
+ // Setup Android Gradle script
53
+ const androidBuildGradlePath = path.join(
54
+ projectRoot,
55
+ 'android',
56
+ 'app',
57
+ 'build.gradle'
58
+ );
59
+ const sslGradleScriptPath = path.join(
60
+ __dirname,
61
+ '..',
62
+ 'android',
63
+ 'ssl-pinning-setup.gradle'
64
+ );
65
+
66
+ if (fs.existsSync(androidBuildGradlePath)) {
67
+ console.log('📱 Android project detected');
68
+
69
+ // Read current build.gradle
70
+ let buildGradleContent = fs.readFileSync(androidBuildGradlePath, 'utf8');
71
+
72
+ // Check if our script is already applied
73
+ const scriptApplyLine =
74
+ "apply from: '../../node_modules/react-native-ssl-manager/android/ssl-pinning-setup.gradle'";
75
+
76
+ if (!buildGradleContent.includes('ssl-pinning-setup.gradle')) {
77
+ console.log('🔄 Adding SSL config auto-copy script to build.gradle');
78
+
79
+ // Add script at the end
80
+ buildGradleContent += `\n\n// React Native SSL Manager - Auto-copy SSL config\n${scriptApplyLine}\n`;
81
+
82
+ // Write back to file
83
+ fs.writeFileSync(androidBuildGradlePath, buildGradleContent);
84
+ console.log('✅ SSL config auto-copy script added successfully');
85
+ console.log('💡 SSL config will now be automatically copied on build');
86
+ } else {
87
+ console.log('✅ SSL config auto-copy script already present');
88
+ }
89
+
90
+ console.log(
91
+ '📋 Run "cd android && ./gradlew checkSslConfig" to verify setup'
92
+ );
93
+ } else {
94
+ console.log('ℹ️ Android build.gradle not found, skipping Android setup');
95
+ }
96
+
97
+ // Check for ssl_config.json in project root
98
+ const sslConfigPath = path.join(projectRoot, 'ssl_config.json');
99
+ if (fs.existsSync(sslConfigPath)) {
100
+ console.log('✅ ssl_config.json found at project root');
101
+ } else {
102
+ console.log('⚠️ ssl_config.json not found at project root');
103
+ console.log(
104
+ '💡 Create ssl_config.json at project root for SSL pinning to work'
105
+ );
106
+ }
107
+
108
+ console.log('🎉 React Native SSL Manager setup complete!');
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // Test script to verify Bun compatibility with react-native-ssl-manager
4
+
5
+ import { readFileSync, existsSync } from 'fs';
6
+ import { join } from 'path';
7
+
8
+ console.log('🧪 Testing Bun compatibility...');
9
+
10
+ // Test 1: Check if bunfig.toml exists
11
+ const bunfigPath = join(process.cwd(), 'bunfig.toml');
12
+ if (existsSync(bunfigPath)) {
13
+ console.log('✅ bunfig.toml found');
14
+ } else {
15
+ console.log('❌ bunfig.toml not found');
16
+ }
17
+
18
+ // Test 2: Check package.json for Bun support
19
+ const packageJsonPath = join(process.cwd(), 'package.json');
20
+ if (existsSync(packageJsonPath)) {
21
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
22
+
23
+ if (packageJson.engines?.bun) {
24
+ console.log(`✅ Bun engine requirement: ${packageJson.engines.bun}`);
25
+ } else {
26
+ console.log('❌ No Bun engine requirement in package.json');
27
+ }
28
+
29
+ if (packageJson.scripts['bun:install']) {
30
+ console.log('✅ Bun install script found');
31
+ } else {
32
+ console.log('❌ Bun install script not found');
33
+ }
34
+ } else {
35
+ console.log('❌ package.json not found');
36
+ }
37
+
38
+ // Test 3: Check if Bun postinstall script exists
39
+ const bunPostinstallPath = join(process.cwd(), 'scripts', 'bun-postinstall.js');
40
+ if (existsSync(bunPostinstallPath)) {
41
+ console.log('✅ Bun postinstall script found');
42
+ } else {
43
+ console.log('❌ Bun postinstall script not found');
44
+ }
45
+
46
+ // Test 4: Check source files for Bun compatibility
47
+ const sourceFiles = [
48
+ 'src/index.tsx',
49
+ 'src/NativeUseSslPinning.ts',
50
+ 'src/UseSslPinning.types.ts',
51
+ ];
52
+
53
+ for (const file of sourceFiles) {
54
+ const filePath = join(process.cwd(), file);
55
+ if (existsSync(filePath)) {
56
+ console.log(`✅ ${file} exists`);
57
+ } else {
58
+ console.log(`❌ ${file} not found`);
59
+ }
60
+ }
61
+
62
+ console.log('\n🎉 Bun compatibility test completed!');
63
+ console.log('💡 Run "bun install" to test installation');
64
+ console.log('💡 Run "bun run build" to test build process');
@@ -1,8 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- export interface Spec extends TurboModule {
3
- readonly setUseSSLPinning: (usePinning: boolean) => Promise<void>;
4
- readonly getUseSSLPinning: () => Promise<boolean>;
5
- }
6
- declare const _default: Spec;
7
- export default _default;
8
- //# sourceMappingURL=NativeUseSslPinning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeUseSslPinning.d.ts","sourceRoot":"","sources":["../src/NativeUseSslPinning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD;;AAED,wBAAuE"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_native_1 = require("react-native");
4
- exports.default = react_native_1.TurboModuleRegistry.getEnforcing('UseSslPinning');
@@ -1,17 +0,0 @@
1
- /**
2
- * SSL Pinning Configuration Interface
3
- * Defines the structure for SSL pinning configuration
4
- */
5
- export interface SslPinningConfig {
6
- sha256Keys: {
7
- [domain: string]: string[];
8
- };
9
- }
10
- /**
11
- * SSL Pinning Error Interface
12
- */
13
- export interface SslPinningError extends Error {
14
- code?: string;
15
- message: string;
16
- }
17
- //# sourceMappingURL=UseSslPinning.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UseSslPinning.types.d.ts","sourceRoot":"","sources":["../src/UseSslPinning.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setUseSSLPinning = exports.initializeSslPinning = exports.getUseSSLPinning = void 0;
7
- var _reactNative = require("react-native");
8
- const LINKING_ERROR = `The package 'react-native-ssl-manager' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
9
- ios: "- You have run 'pod install'\n",
10
- default: ''
11
- }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
12
- const UseSslPinning = _reactNative.NativeModules.UseSslPinning ? _reactNative.NativeModules.UseSslPinning : new Proxy({}, {
13
- get() {
14
- throw new Error(LINKING_ERROR);
15
- }
16
- });
17
- const setUseSSLPinning = usePinning => {
18
- UseSslPinning.setUseSSLPinning(usePinning);
19
- };
20
-
21
- /**
22
- * Retrieves the current state of SSL pinning usage.
23
- *
24
- * @returns A promise that resolves to a boolean indicating whether SSL pinning is being used.
25
- */
26
- exports.setUseSSLPinning = setUseSSLPinning;
27
- const getUseSSLPinning = async () => {
28
- return await UseSslPinning.getUseSSLPinning();
29
- };
30
-
31
- /**
32
- * Initializes SSL pinning with the provided configuration.
33
- *
34
- * @param {string} configJsonString - The JSON string containing the SSL pinning configuration.
35
- * @returns {Promise<any>} A promise that resolves when the SSL pinning is initialized.
36
- */
37
- exports.getUseSSLPinning = getUseSSLPinning;
38
- const initializeSslPinning = async configJsonString => {
39
- return await UseSslPinning.initializeSslPinning(configJsonString);
40
- };
41
- exports.initializeSslPinning = initializeSslPinning;
42
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","UseSslPinning","NativeModules","Proxy","get","Error","setUseSSLPinning","usePinning","exports","getUseSSLPinning","initializeSslPinning","configJsonString"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,mFAAmF,GACnFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa,GAC7CC,0BAAa,CAACD,aAAa,GAC3B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,MAAMU,gBAAgB,GAAIC,UAAmB,IAAW;EAC7DN,aAAa,CAACK,gBAAgB,CAACC,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAF,gBAAA,GAAAA,gBAAA;AAKO,MAAMG,gBAAgB,GAAG,MAAAA,CAAA,KAA8B;EAC5D,OAAO,MAAMR,aAAa,CAACQ,gBAAgB,CAAC,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAMO,MAAMC,oBAAoB,GAAG,MAClCC,gBAAwB,IACP;EACjB,OAAO,MAAMV,aAAa,CAACS,oBAAoB,CAACC,gBAAgB,CAAC;AACnE,CAAC;AAACH,OAAA,CAAAE,oBAAA,GAAAA,oBAAA","ignoreList":[]}
package/lib/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export type { SslPinningConfig, SslPinningError } from './UseSslPinning.types';
2
- /**
3
- * Sets whether SSL pinning should be used.
4
- *
5
- * @param {boolean} usePinning - Whether to enable SSL pinning
6
- * @returns {Promise<void>} A promise that resolves when the setting is saved
7
- */
8
- export declare const setUseSSLPinning: (usePinning: boolean) => Promise<void>;
9
- /**
10
- * Retrieves the current state of SSL pinning usage.
11
- *
12
- * @returns A promise that resolves to a boolean indicating whether SSL pinning is being used.
13
- */
14
- export declare const getUseSSLPinning: () => Promise<boolean>;
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAGA,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA0C/E;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,eAAgB,OAAO,KAAG,QAAQ,IAAI,CAElE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAa,QAAQ,OAAO,CAExD,CAAC"}
package/lib/index.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- // Remove unused Platform import since we no longer check OS
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getUseSSLPinning = exports.setUseSSLPinning = void 0;
5
- // New Architecture and Legacy Architecture support
6
- let UseSslPinning;
7
- try {
8
- // Try Legacy NativeModules first (more reliable)
9
- const { NativeModules } = require('react-native');
10
- // Look for our universal module (works in both CLI and Expo)
11
- UseSslPinning = NativeModules.UseSslPinning;
12
- if (UseSslPinning) {
13
- }
14
- else {
15
- // Fallback to TurboModule if available
16
- try {
17
- UseSslPinning = require('./NativeUseSslPinning').default;
18
- }
19
- catch (turboModuleError) {
20
- console.log('❌ TurboModule failed:', turboModuleError.message);
21
- UseSslPinning = null;
22
- }
23
- }
24
- }
25
- catch (error) {
26
- console.log('❌ Overall module loading failed:', error.message);
27
- UseSslPinning = null;
28
- }
29
- // Fallback implementation if native module is not available
30
- if (!UseSslPinning) {
31
- UseSslPinning = {
32
- setUseSSLPinning: (_usePinning) => {
33
- return Promise.resolve();
34
- },
35
- getUseSSLPinning: () => {
36
- return Promise.resolve(true);
37
- },
38
- };
39
- }
40
- /**
41
- * Sets whether SSL pinning should be used.
42
- *
43
- * @param {boolean} usePinning - Whether to enable SSL pinning
44
- * @returns {Promise<void>} A promise that resolves when the setting is saved
45
- */
46
- const setUseSSLPinning = (usePinning) => {
47
- return UseSslPinning.setUseSSLPinning(usePinning);
48
- };
49
- exports.setUseSSLPinning = setUseSSLPinning;
50
- /**
51
- * Retrieves the current state of SSL pinning usage.
52
- *
53
- * @returns A promise that resolves to a boolean indicating whether SSL pinning is being used.
54
- */
55
- const getUseSSLPinning = async () => {
56
- return await UseSslPinning.getUseSSLPinning();
57
- };
58
- exports.getUseSSLPinning = getUseSSLPinning;
@@ -1,33 +0,0 @@
1
- import { NativeModules, Platform } from 'react-native';
2
- const LINKING_ERROR = `The package 'react-native-ssl-manager' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
- ios: "- You have run 'pod install'\n",
4
- default: ''
5
- }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
- const UseSslPinning = NativeModules.UseSslPinning ? NativeModules.UseSslPinning : new Proxy({}, {
7
- get() {
8
- throw new Error(LINKING_ERROR);
9
- }
10
- });
11
- export const setUseSSLPinning = usePinning => {
12
- UseSslPinning.setUseSSLPinning(usePinning);
13
- };
14
-
15
- /**
16
- * Retrieves the current state of SSL pinning usage.
17
- *
18
- * @returns A promise that resolves to a boolean indicating whether SSL pinning is being used.
19
- */
20
- export const getUseSSLPinning = async () => {
21
- return await UseSslPinning.getUseSSLPinning();
22
- };
23
-
24
- /**
25
- * Initializes SSL pinning with the provided configuration.
26
- *
27
- * @param {string} configJsonString - The JSON string containing the SSL pinning configuration.
28
- * @returns {Promise<any>} A promise that resolves when the SSL pinning is initialized.
29
- */
30
- export const initializeSslPinning = async configJsonString => {
31
- return await UseSslPinning.initializeSslPinning(configJsonString);
32
- };
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","UseSslPinning","Proxy","get","Error","setUseSSLPinning","usePinning","getUseSSLPinning","initializeSslPinning","configJsonString"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,mFAAmF,GACnFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAGN,aAAa,CAACM,aAAa,GAC7CN,aAAa,CAACM,aAAa,GAC3B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,MAAMQ,gBAAgB,GAAIC,UAAmB,IAAW;EAC7DL,aAAa,CAACI,gBAAgB,CAACC,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAA8B;EAC5D,OAAO,MAAMN,aAAa,CAACM,gBAAgB,CAAC,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAG,MAClCC,gBAAwB,IACP;EACjB,OAAO,MAAMR,aAAa,CAACO,oBAAoB,CAACC,gBAAgB,CAAC;AACnE,CAAC","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- export declare const setUseSSLPinning: (usePinning: boolean) => void;
2
- /**
3
- * Retrieves the current state of SSL pinning usage.
4
- *
5
- * @returns A promise that resolves to a boolean indicating whether SSL pinning is being used.
6
- */
7
- export declare const getUseSSLPinning: () => Promise<boolean>;
8
- /**
9
- * Initializes SSL pinning with the provided configuration.
10
- *
11
- * @param {string} configJsonString - The JSON string containing the SSL pinning configuration.
12
- * @returns {Promise<any>} A promise that resolves when the SSL pinning is initialized.
13
- */
14
- export declare const initializeSslPinning: (configJsonString: string) => Promise<any>;
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,gBAAgB,eAAgB,OAAO,KAAG,IAEtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAa,QAAQ,OAAO,CAExD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,qBACb,MAAM,KACvB,QAAQ,GAAG,CAEb,CAAC"}