freerasp-react-native 4.5.0 → 4.5.2

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +14 -12
  3. package/android/src/main/java/com/freeraspreactnative/PluginThreatHandler.kt +22 -30
  4. package/android/src/main/java/com/freeraspreactnative/dispatchers/ExecutionStateDispatcher.kt +4 -2
  5. package/android/src/main/java/com/freeraspreactnative/dispatchers/ThreatDispatcher.kt +4 -2
  6. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  7. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +51 -40
  8. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  9. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  10. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  11. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
  12. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
  13. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  14. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  15. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  16. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +193 -193
  17. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  18. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/_CodeSignature/CodeResources +377 -0
  19. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  20. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  21. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
  22. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
  23. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  24. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  25. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  26. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +124 -124
  27. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +124 -124
  28. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  29. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +17 -39
  30. package/package.json +1 -1
  31. package/example/Gemfile +0 -10
  32. package/example/Gemfile.lock +0 -121
  33. package/example/android/app/build.gradle +0 -120
  34. package/example/android/app/debug.keystore +0 -0
  35. package/example/android/app/proguard-rules.pro +0 -10
  36. package/example/android/app/src/debug/AndroidManifest.xml +0 -9
  37. package/example/android/app/src/main/AndroidManifest.xml +0 -35
  38. package/example/android/app/src/main/java/com/freerasp/rn/example/MainActivity.kt +0 -22
  39. package/example/android/app/src/main/java/com/freerasp/rn/example/MainApplication.kt +0 -44
  40. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
  41. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  42. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  43. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  44. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  45. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  46. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  47. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  48. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  49. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  50. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  51. package/example/android/app/src/main/res/values/strings.xml +0 -3
  52. package/example/android/app/src/main/res/values/styles.xml +0 -9
  53. package/example/android/build.gradle +0 -21
  54. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  55. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  56. package/example/android/gradle.properties +0 -39
  57. package/example/android/gradlew +0 -251
  58. package/example/android/gradlew.bat +0 -94
  59. package/example/android/settings.gradle +0 -6
  60. package/example/app.json +0 -4
  61. package/example/assets/arrow-down.png +0 -0
  62. package/example/assets/arrow-up.png +0 -0
  63. package/example/assets/checkmark-circle-outline.png +0 -0
  64. package/example/assets/checkmark-circle-outline.svg +0 -1
  65. package/example/assets/close-circle-outline.png +0 -0
  66. package/example/assets/close-circle-outline.svg +0 -1
  67. package/example/assets/talsec-logo.png +0 -0
  68. package/example/index.d.ts +0 -1
  69. package/example/index.js +0 -9
  70. package/example/ios/FreeraspRNExample/AppDelegate.swift +0 -30
  71. package/example/ios/FreeraspRNExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  72. package/example/ios/FreeraspRNExample/Images.xcassets/Contents.json +0 -6
  73. package/example/ios/FreeraspRNExample/Info.plist +0 -51
  74. package/example/ios/FreeraspRNExample/LaunchScreen.storyboard +0 -47
  75. package/example/ios/FreeraspRNExample/PrivacyInfo.xcprivacy +0 -37
  76. package/example/ios/FreeraspRNExample.xcodeproj/project.pbxproj +0 -488
  77. package/example/ios/FreeraspRNExample.xcodeproj/xcshareddata/xcschemes/FreeraspRNExample.xcscheme +0 -88
  78. package/example/ios/FreeraspRNExample.xcworkspace/contents.xcworkspacedata +0 -10
  79. package/example/ios/Podfile +0 -35
  80. package/example/metro.config.js +0 -39
  81. package/example/package.json +0 -42
  82. package/example/react-native.config.js +0 -10
  83. package/example/src/App.tsx +0 -329
  84. package/example/src/DemoApp.tsx +0 -392
  85. package/example/src/MalwareItem.tsx +0 -161
  86. package/example/src/MalwareModal.tsx +0 -116
  87. package/example/src/checks.ts +0 -28
  88. package/example/src/styles.ts +0 -10
  89. package/example/yarn.lock +0 -6263
@@ -1,39 +0,0 @@
1
- const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2
- const path = require('path');
3
- const blacklist = require('metro-config/src/defaults/exclusionList');
4
- const escape = require('escape-string-regexp');
5
- const pak = require('../package.json');
6
-
7
- const root = path.resolve(__dirname, '..');
8
-
9
- const modules = Object.keys({
10
- ...pak.peerDependencies,
11
- });
12
-
13
- /**
14
- * Metro configuration
15
- * https://reactnative.dev/docs/metro
16
- *
17
- * @type {import('metro-config').MetroConfig}
18
- */
19
- const config = {
20
- watchFolders: [root],
21
-
22
- // We need to make sure that only one version is loaded for peerDependencies
23
- // So we blacklist them at the root, and alias them to the versions in example's node_modules
24
- resolver: {
25
- blacklistRE: blacklist(
26
- modules.map(
27
- (m) =>
28
- new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
29
- )
30
- ),
31
-
32
- extraNodeModules: modules.reduce((acc, name) => {
33
- acc[name] = path.join(__dirname, 'node_modules', name);
34
- return acc;
35
- }, {}),
36
- },
37
- };
38
-
39
- module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -1,42 +0,0 @@
1
- {
2
- "name": "FreeraspRNExample",
3
- "version": "2.0.0",
4
- "private": true,
5
- "scripts": {
6
- "android": "react-native run-android",
7
- "ios": "react-native run-ios",
8
- "start": "react-native start",
9
- "pods": "pod-install --quiet",
10
- "build:android": "cd android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
11
- "build:ios": "cd ios && xcodebuild -workspace FreeraspReactNativeExample.xcworkspace -scheme FreeraspReactNativeExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
12
- },
13
- "dependencies": {
14
- "@react-native-material/core": "^1.3.7",
15
- "react": "19.0.0",
16
- "react-native": "0.78.0",
17
- "react-native-alert-notification": "^0.4.2",
18
- "react-native-safe-area-context": "^5.4.0",
19
- "react-native-svg": "^15.11.1"
20
- },
21
- "devDependencies": {
22
- "@babel/core": "^7.25.2",
23
- "@babel/preset-env": "^7.25.3",
24
- "@babel/runtime": "^7.25.0",
25
- "@react-native-community/cli": "15.0.1",
26
- "@react-native-community/cli-platform-android": "15.0.1",
27
- "@react-native-community/cli-platform-ios": "15.0.1",
28
- "@react-native/babel-preset": "0.78.0",
29
- "@react-native/eslint-config": "0.78.0",
30
- "@react-native/metro-config": "0.78.0",
31
- "@react-native/typescript-config": "0.78.0",
32
- "@types/react": "^19.0.0",
33
- "babel-plugin-module-resolver": "^5.0.2",
34
- "eslint-config-prettier": "^10.0.1",
35
- "eslint-plugin-prettier": "^5.2.3",
36
- "metro-react-native-babel-preset": "^0.77.0",
37
- "react-native-svg-transformer": "^1.5.0"
38
- },
39
- "engines": {
40
- "node": ">=18"
41
- }
42
- }
@@ -1,10 +0,0 @@
1
- const path = require('path');
2
- const pak = require('../package.json');
3
-
4
- module.exports = {
5
- dependencies: {
6
- [pak.name]: {
7
- root: path.join(__dirname, '..'),
8
- },
9
- },
10
- };
@@ -1,329 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { Platform, PermissionsAndroid } from 'react-native';
4
- import {
5
- addToWhitelist,
6
- useFreeRasp,
7
- type SuspiciousAppInfo,
8
- } from 'freerasp-react-native';
9
- import { DemoApp } from './DemoApp';
10
- import { commonChecks, iosChecks, androidChecks } from './checks';
11
- import { useEffect } from 'react';
12
-
13
- const App = () => {
14
- const [appChecks, setAppChecks] = React.useState([
15
- ...commonChecks,
16
- ...(Platform.OS === 'ios' ? iosChecks : androidChecks),
17
- ]);
18
- const [suspiciousApps, setSuspiciousApps] = React.useState<
19
- SuspiciousAppInfo[]
20
- >([]);
21
- const [allChecksStatus, setAllChecksStatus] = React.useState<
22
- 'in progress' | 'completed'
23
- >('in progress');
24
-
25
- useEffect(() => {
26
- (async () => {
27
- Platform.OS === 'android' && (await addItemsToMalwareWhitelist());
28
- await requestLocationPermission();
29
- })();
30
- }, []);
31
-
32
- const config = {
33
- androidConfig: {
34
- packageName: 'com.freeraspreactnativeexample',
35
- certificateHashes: ['AKoRuyLMM91E7lX/Zqp3u4jMmd0A7hH/Iqozu0TMVd0='],
36
- // supportedAlternativeStores: ['storeOne', 'storeTwo'],
37
- malwareConfig: {
38
- blacklistedHashes: ['FgvSehLMM91E7lX/Zqp3u4jMmd0A7hH/Iqozu0TMVd0u'],
39
- blacklistedPackageNames: ['com.freeraspreactnativeexample'],
40
- suspiciousPermissions: [
41
- [
42
- 'android.permission.INTERNET',
43
- 'android.permission.ACCESS_COARSE_LOCATION',
44
- ],
45
- ['android.permission.BLUETOOTH'],
46
- ['android.permission.BATTERY_STATS'],
47
- ],
48
- whitelistedInstallationSources: ['com.apkpure.aegon'],
49
- },
50
- },
51
- iosConfig: {
52
- appBundleId: 'org.reactjs.native.example.FreeraspReactNativeExample',
53
- appTeamId: 'your_team_ID',
54
- },
55
- watcherMail: 'your_email_address@example.com',
56
- isProd: true,
57
- killOnBypass: true,
58
- };
59
-
60
- const actions = {
61
- // Android & iOS
62
- privilegedAccess: () => {
63
- setAppChecks((currentState) =>
64
- currentState.map((threat) =>
65
- threat.name === 'Privileged Access'
66
- ? { ...threat, status: 'nok' }
67
- : threat
68
- )
69
- );
70
- },
71
- // Android & iOS
72
- debug: () => {
73
- setAppChecks((currentState) =>
74
- currentState.map((threat) =>
75
- threat.name === 'Debug' ? { ...threat, status: 'nok' } : threat
76
- )
77
- );
78
- },
79
- // Android & iOS
80
- simulator: () => {
81
- setAppChecks((currentState) =>
82
- currentState.map((threat) =>
83
- threat.name === 'Simulator' ? { ...threat, status: 'nok' } : threat
84
- )
85
- );
86
- },
87
- // Android & iOS
88
- appIntegrity: () => {
89
- setAppChecks((currentState) =>
90
- currentState.map((threat) =>
91
- threat.name === 'App Integrity'
92
- ? { ...threat, status: 'nok' }
93
- : threat
94
- )
95
- );
96
- },
97
- // Android & iOS
98
- unofficialStore: () => {
99
- setAppChecks((currentState) =>
100
- currentState.map((threat) =>
101
- threat.name === 'Unofficial Store'
102
- ? { ...threat, status: 'nok' }
103
- : threat
104
- )
105
- );
106
- },
107
- // Android & iOS
108
- hooks: () => {
109
- setAppChecks((currentState) =>
110
- currentState.map((threat) =>
111
- threat.name === 'Hooks' ? { ...threat, status: 'nok' } : threat
112
- )
113
- );
114
- },
115
- // Android & iOS
116
- deviceBinding: () => {
117
- setAppChecks((currentState) =>
118
- currentState.map((threat) =>
119
- threat.name === 'Device Binding'
120
- ? { ...threat, status: 'nok' }
121
- : threat
122
- )
123
- );
124
- },
125
- // Android & iOS
126
- secureHardwareNotAvailable: () => {
127
- setAppChecks((currentState) =>
128
- currentState.map((threat) =>
129
- threat.name === 'Secure Hardware Not Available'
130
- ? { ...threat, status: 'nok' }
131
- : threat
132
- )
133
- );
134
- },
135
- // Android & iOS
136
- systemVPN: () => {
137
- setAppChecks((currentState) =>
138
- currentState.map((threat) =>
139
- threat.name === 'System VPN' ? { ...threat, status: 'nok' } : threat
140
- )
141
- );
142
- },
143
- // Android & iOS
144
- passcode: () => {
145
- setAppChecks((currentState) =>
146
- currentState.map((threat) =>
147
- threat.name === 'Passcode' ? { ...threat, status: 'nok' } : threat
148
- )
149
- );
150
- },
151
- // iOS only
152
- deviceID: () => {
153
- setAppChecks((currentState) =>
154
- currentState.map((threat) =>
155
- threat.name === 'Device ID' ? { ...threat, status: 'nok' } : threat
156
- )
157
- );
158
- },
159
- // Android only
160
- obfuscationIssues: () => {
161
- setAppChecks((currentState) =>
162
- currentState.map((threat) =>
163
- threat.name === 'Obfuscation Issues'
164
- ? { ...threat, status: 'nok' }
165
- : threat
166
- )
167
- );
168
- },
169
- // Android only
170
- devMode: () => {
171
- setAppChecks((currentState) =>
172
- currentState.map((threat) =>
173
- threat.name === 'Developer Mode'
174
- ? { ...threat, status: 'nok' }
175
- : threat
176
- )
177
- );
178
- },
179
- // Android only
180
- malware: (detectedApps: SuspiciousAppInfo[]) => {
181
- setSuspiciousApps(detectedApps);
182
- setAppChecks((currentState) =>
183
- currentState.map((threat) =>
184
- threat.name === 'Malware' ? { ...threat, status: 'nok' } : threat
185
- )
186
- );
187
- },
188
- // Android only
189
- adbEnabled: () => {
190
- setAppChecks((currentState) =>
191
- currentState.map((threat) =>
192
- threat.name === 'ADB Enabled' ? { ...threat, status: 'nok' } : threat
193
- )
194
- );
195
- },
196
- // Android & iOS
197
- screenshot: () => {
198
- setAppChecks((currentState) =>
199
- currentState.map((threat) =>
200
- threat.name === 'Screenshot' ? { ...threat, status: 'nok' } : threat
201
- )
202
- );
203
- },
204
- // Android & iOS
205
- screenRecording: () => {
206
- setAppChecks((currentState) =>
207
- currentState.map((threat) =>
208
- threat.name === 'Screen Recording'
209
- ? { ...threat, status: 'nok' }
210
- : threat
211
- )
212
- );
213
- },
214
- // Android only
215
- multiInstance: () => {
216
- setAppChecks((currentState) =>
217
- currentState.map((threat) =>
218
- threat.name === 'Multi Instance'
219
- ? { ...threat, status: 'nok' }
220
- : threat
221
- )
222
- );
223
- },
224
- // Android & iOS
225
- timeSpoofing: () => {
226
- setAppChecks((currentState) =>
227
- currentState.map((threat) =>
228
- threat.name === 'Time Spoofing'
229
- ? { ...threat, status: 'nok' }
230
- : threat
231
- )
232
- );
233
- },
234
- // Android only
235
- locationSpoofing: () => {
236
- setAppChecks((currentState) =>
237
- currentState.map((threat) =>
238
- threat.name === 'Location Spoofing'
239
- ? { ...threat, status: 'nok' }
240
- : threat
241
- )
242
- );
243
- },
244
- // Android only
245
- unsecureWifi: () => {
246
- setAppChecks((currentState) =>
247
- currentState.map((threat) =>
248
- threat.name === 'Unsecure Wifi'
249
- ? { ...threat, status: 'nok' }
250
- : threat
251
- )
252
- );
253
- },
254
- // Android only
255
- automation: () => {
256
- setAppChecks((currentState) =>
257
- currentState.map((threat) =>
258
- threat.name === 'Automation'
259
- ? { ...threat, status: 'nok' }
260
- : threat
261
- )
262
- );
263
- },
264
- };
265
-
266
- const raspExecutionStateActions = {
267
- // Android & iOS
268
- allChecksFinished: () => {
269
- setAllChecksStatus('completed');
270
- },
271
- };
272
-
273
- const requestLocationPermission = async () => {
274
- if (Platform.OS !== 'android') {
275
- return;
276
- }
277
- try {
278
- const results = await PermissionsAndroid.requestMultiple([
279
- PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
280
- PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
281
- ]);
282
-
283
- const fineGranted =
284
- results[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] ===
285
- PermissionsAndroid.RESULTS.GRANTED;
286
- const coarseGranted =
287
- results[PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION] ===
288
- PermissionsAndroid.RESULTS.GRANTED;
289
-
290
- console.info('Location permissions:', {
291
- fineGranted,
292
- coarseGranted,
293
- });
294
- } catch (err) {
295
- console.warn('Location permission request error:', err);
296
- }
297
- };
298
-
299
- const addItemsToMalwareWhitelist = async () => {
300
- const appsToWhitelist = [
301
- 'com.talsecreactnativesecuritypluginexample',
302
- 'com.example.myApp',
303
- ];
304
- await Promise.all(
305
- appsToWhitelist.map(async (app) => {
306
- try {
307
- const whitelistResponse = await addToWhitelist(app);
308
- console.info(
309
- `${app} stored to Malware Whitelist: ${whitelistResponse}`
310
- );
311
- } catch (error) {
312
- console.info('Malware whitelist failed: ', error);
313
- }
314
- })
315
- );
316
- };
317
-
318
- useFreeRasp(config, actions, raspExecutionStateActions);
319
-
320
- return (
321
- <DemoApp
322
- checks={appChecks}
323
- suspiciousApps={suspiciousApps}
324
- allChecksFinishedStatus={allChecksStatus}
325
- />
326
- );
327
- };
328
-
329
- export default App;