freerasp-react-native 4.2.4 → 4.3.0

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 (194) hide show
  1. package/6.13.0/dSYMs/iphoneos/TalsecRuntime.framework.dSYM/Contents/Info.plist +20 -0
  2. package/6.13.0/dSYMs/iphoneos/TalsecRuntime.framework.dSYM/Contents/Resources/DWARF/TalsecRuntime +0 -0
  3. package/6.13.0/dSYMs/iphoneos/TalsecRuntime.framework.dSYM/Contents/Resources/Relocations/aarch64/TalsecRuntime.yml +4153 -0
  4. package/6.13.0/dSYMs/iphonesimulator/TalsecRuntime.framework.dSYM/Contents/Info.plist +20 -0
  5. package/6.13.0/dSYMs/iphonesimulator/TalsecRuntime.framework.dSYM/Contents/Resources/DWARF/TalsecRuntime +0 -0
  6. package/6.13.0/dSYMs/iphonesimulator/TalsecRuntime.framework.dSYM/Contents/Resources/Relocations/aarch64/TalsecRuntime.yml +4036 -0
  7. package/6.13.0/dSYMs/iphonesimulator/TalsecRuntime.framework.dSYM/Contents/Resources/Relocations/x86_64/TalsecRuntime.yml +3951 -0
  8. package/CHANGELOG.md +58 -4
  9. package/android/build.gradle +1 -1
  10. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +45 -22
  11. package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +39 -19
  12. package/android/src/main/java/com/freeraspreactnative/events/BaseRaspEvent.kt +7 -0
  13. package/android/src/main/java/com/freeraspreactnative/events/RaspExecutionStateEvent.kt +20 -0
  14. package/android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt +67 -0
  15. package/android/src/main/java/com/freeraspreactnative/models/RNSuspiciousAppInfo.kt +1 -0
  16. package/android/src/main/java/com/freeraspreactnative/utils/Extensions.kt +1 -0
  17. package/android/src/main/java/com/freeraspreactnative/utils/RandomGenerator.kt +18 -0
  18. package/android/src/main/java/com/freeraspreactnative/utils/Utils.kt +2 -5
  19. package/example/android/app/release/app-release.apk +0 -0
  20. package/example/android/app/release/baselineProfiles/0/app-release.dm +0 -0
  21. package/example/android/app/release/baselineProfiles/1/app-release.dm +0 -0
  22. package/example/android/app/release/output-metadata.json +37 -0
  23. package/example/android/app/src/main/AndroidManifest.xml +7 -0
  24. package/example/src/App.tsx +77 -3
  25. package/example/src/DemoApp.tsx +46 -1
  26. package/example/src/MalwareItem.tsx +4 -0
  27. package/example/src/checks.ts +3 -0
  28. package/example/src/styles.ts +2 -0
  29. package/freerasp-react-native.podspec +1 -1
  30. package/ios/FreeraspReactNative.m +4 -0
  31. package/ios/FreeraspReactNative.swift +37 -75
  32. package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
  33. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  34. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  35. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +144 -114
  36. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  37. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  38. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  39. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +380 -281
  40. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curlver.h +5 -6
  41. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/easy.h +4 -4
  42. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/header.h +1 -1
  43. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/mprintf.h +11 -4
  44. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +62 -22
  45. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +2 -2
  46. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/system.h +76 -164
  47. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
  48. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +5 -4
  49. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/websockets.h +17 -3
  50. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  51. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +181 -146
  52. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -0
  53. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +3 -0
  54. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  55. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  56. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  57. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +380 -281
  58. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curlver.h +5 -6
  59. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/easy.h +4 -4
  60. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/header.h +1 -1
  61. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/mprintf.h +11 -4
  62. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +62 -22
  63. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +2 -2
  64. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/system.h +76 -164
  65. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
  66. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +5 -4
  67. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/websockets.h +17 -3
  68. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  69. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +181 -146
  70. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -0
  71. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -0
  72. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +181 -146
  73. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -0
  74. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -0
  75. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  76. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +52 -41
  77. package/ios/models/RaspExecutionStates.swift +15 -0
  78. package/ios/models/SecurityThreat.swift +40 -0
  79. package/ios/utils/EventIdentifiers.swift +13 -0
  80. package/ios/utils/RandomGenerator.swift +12 -0
  81. package/ios/utils/Utils.swift +34 -0
  82. package/lib/commonjs/api/listeners/raspExecutionState.js +40 -0
  83. package/lib/commonjs/api/listeners/raspExecutionState.js.map +1 -0
  84. package/lib/commonjs/api/listeners/threat.js +102 -0
  85. package/lib/commonjs/api/listeners/threat.js.map +1 -0
  86. package/lib/commonjs/api/methods/native.js +43 -0
  87. package/lib/commonjs/api/methods/native.js.map +1 -0
  88. package/lib/commonjs/api/methods/reactNative.js +35 -0
  89. package/lib/commonjs/api/methods/reactNative.js.map +1 -0
  90. package/lib/commonjs/api/nativeModules.js +12 -0
  91. package/lib/commonjs/api/nativeModules.js.map +1 -0
  92. package/lib/commonjs/channels/raspExecutionState.js +36 -0
  93. package/lib/commonjs/channels/raspExecutionState.js.map +1 -0
  94. package/lib/commonjs/channels/threat.js +37 -0
  95. package/lib/commonjs/channels/threat.js.map +1 -0
  96. package/lib/commonjs/index.js +39 -188
  97. package/lib/commonjs/index.js.map +1 -1
  98. package/lib/commonjs/internal.js +6 -0
  99. package/lib/commonjs/internal.js.map +1 -0
  100. package/lib/commonjs/models/raspExecutionState.js +17 -0
  101. package/lib/commonjs/models/raspExecutionState.js.map +1 -0
  102. package/lib/commonjs/{threat.js → models/threat.js} +4 -1
  103. package/lib/commonjs/models/threat.js.map +1 -0
  104. package/lib/commonjs/types/types.js.map +1 -0
  105. package/lib/commonjs/utils/malware.js +28 -0
  106. package/lib/commonjs/utils/malware.js.map +1 -0
  107. package/lib/commonjs/utils/utils.js +21 -0
  108. package/lib/commonjs/utils/utils.js.map +1 -0
  109. package/lib/module/api/listeners/raspExecutionState.js +32 -0
  110. package/lib/module/api/listeners/raspExecutionState.js.map +1 -0
  111. package/lib/module/api/listeners/threat.js +94 -0
  112. package/lib/module/api/listeners/threat.js.map +1 -0
  113. package/lib/module/api/methods/native.js +30 -0
  114. package/lib/module/api/methods/native.js.map +1 -0
  115. package/lib/module/api/methods/reactNative.js +28 -0
  116. package/lib/module/api/methods/reactNative.js.map +1 -0
  117. package/lib/module/api/nativeModules.js +5 -0
  118. package/lib/module/api/nativeModules.js.map +1 -0
  119. package/lib/module/channels/raspExecutionState.js +27 -0
  120. package/lib/module/channels/raspExecutionState.js.map +1 -0
  121. package/lib/module/channels/threat.js +28 -0
  122. package/lib/module/channels/threat.js.map +1 -0
  123. package/lib/module/index.js +5 -172
  124. package/lib/module/index.js.map +1 -1
  125. package/lib/module/internal.js +3 -0
  126. package/lib/module/internal.js.map +1 -0
  127. package/lib/module/models/raspExecutionState.js +10 -0
  128. package/lib/module/models/raspExecutionState.js.map +1 -0
  129. package/lib/module/{threat.js → models/threat.js} +4 -1
  130. package/lib/module/models/threat.js.map +1 -0
  131. package/lib/module/types/types.js.map +1 -0
  132. package/lib/module/utils/malware.js +20 -0
  133. package/lib/module/utils/malware.js.map +1 -0
  134. package/lib/module/utils/utils.js +12 -0
  135. package/lib/module/utils/utils.js.map +1 -0
  136. package/lib/typescript/src/api/listeners/raspExecutionState.d.ts +4 -0
  137. package/lib/typescript/src/api/listeners/raspExecutionState.d.ts.map +1 -0
  138. package/lib/typescript/src/api/listeners/threat.d.ts +4 -0
  139. package/lib/typescript/src/api/listeners/threat.d.ts.map +1 -0
  140. package/lib/typescript/src/api/methods/native.d.ts +9 -0
  141. package/lib/typescript/src/api/methods/native.d.ts.map +1 -0
  142. package/lib/typescript/src/api/methods/reactNative.d.ts +3 -0
  143. package/lib/typescript/src/api/methods/reactNative.d.ts.map +1 -0
  144. package/lib/typescript/src/api/nativeModules.d.ts +2 -0
  145. package/lib/typescript/src/api/nativeModules.d.ts.map +1 -0
  146. package/lib/typescript/src/channels/raspExecutionState.d.ts +7 -0
  147. package/lib/typescript/src/channels/raspExecutionState.d.ts.map +1 -0
  148. package/lib/typescript/src/channels/threat.d.ts +8 -0
  149. package/lib/typescript/src/channels/threat.d.ts.map +1 -0
  150. package/lib/typescript/src/index.d.ts +5 -13
  151. package/lib/typescript/src/index.d.ts.map +1 -1
  152. package/lib/typescript/src/internal.d.ts +2 -0
  153. package/lib/typescript/src/internal.d.ts.map +1 -0
  154. package/lib/typescript/src/models/raspExecutionState.d.ts +7 -0
  155. package/lib/typescript/src/models/raspExecutionState.d.ts.map +1 -0
  156. package/lib/typescript/src/{threat.d.ts → models/threat.d.ts} +3 -0
  157. package/lib/typescript/src/models/threat.d.ts.map +1 -0
  158. package/lib/typescript/src/{types.d.ts → types/types.d.ts} +12 -1
  159. package/lib/typescript/src/types/types.d.ts.map +1 -0
  160. package/lib/typescript/src/utils/malware.d.ts +4 -0
  161. package/lib/typescript/src/utils/malware.d.ts.map +1 -0
  162. package/lib/typescript/src/{utils.d.ts → utils/utils.d.ts} +1 -0
  163. package/lib/typescript/src/utils/utils.d.ts.map +1 -0
  164. package/package.json +1 -1
  165. package/plugin/build/index.d.ts +0 -1
  166. package/src/api/listeners/raspExecutionState.ts +42 -0
  167. package/src/api/listeners/threat.ts +101 -0
  168. package/src/api/methods/native.ts +39 -0
  169. package/src/api/methods/reactNative.ts +42 -0
  170. package/src/api/nativeModules.ts +3 -0
  171. package/src/channels/raspExecutionState.ts +35 -0
  172. package/src/channels/threat.ts +35 -0
  173. package/src/index.tsx +5 -209
  174. package/src/internal.ts +2 -0
  175. package/src/models/raspExecutionState.ts +13 -0
  176. package/src/{threat.ts → models/threat.ts} +6 -0
  177. package/src/{types.ts → types/types.ts} +12 -1
  178. package/src/utils/malware.ts +24 -0
  179. package/src/utils/utils.ts +14 -0
  180. package/android/src/main/java/com/freeraspreactnative/Threat.kt +0 -57
  181. package/lib/commonjs/threat.js.map +0 -1
  182. package/lib/commonjs/types.js.map +0 -1
  183. package/lib/commonjs/utils.js +0 -16
  184. package/lib/commonjs/utils.js.map +0 -1
  185. package/lib/module/threat.js.map +0 -1
  186. package/lib/module/types.js.map +0 -1
  187. package/lib/module/utils.js +0 -8
  188. package/lib/module/utils.js.map +0 -1
  189. package/lib/typescript/src/threat.d.ts.map +0 -1
  190. package/lib/typescript/src/types.d.ts.map +0 -1
  191. package/lib/typescript/src/utils.d.ts.map +0 -1
  192. package/src/utils.ts +0 -9
  193. /package/lib/commonjs/{types.js → types/types.js} +0 -0
  194. /package/lib/module/{types.js → types/types.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { Platform } from 'react-native';
3
+ import { Platform, PermissionsAndroid } from 'react-native';
4
4
  import {
5
5
  addToWhitelist,
6
6
  useFreeRasp,
@@ -18,10 +18,14 @@ const App = () => {
18
18
  const [suspiciousApps, setSuspiciousApps] = React.useState<
19
19
  SuspiciousAppInfo[]
20
20
  >([]);
21
+ const [allChecksStatus, setAllChecksStatus] = React.useState<
22
+ 'in progress' | 'completed'
23
+ >('in progress');
21
24
 
22
25
  useEffect(() => {
23
26
  (async () => {
24
27
  Platform.OS === 'android' && (await addItemsToMalwareWhitelist());
28
+ await requestLocationPermission();
25
29
  })();
26
30
  }, []);
27
31
 
@@ -50,6 +54,7 @@ const App = () => {
50
54
  },
51
55
  watcherMail: 'your_email_address@example.com',
52
56
  isProd: true,
57
+ killOnBypass: true,
53
58
  };
54
59
 
55
60
  const actions = {
@@ -216,6 +221,69 @@ const App = () => {
216
221
  )
217
222
  );
218
223
  },
224
+ // Android only
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
+ };
255
+
256
+ const raspExecutionStateActions = {
257
+ // Android & iOS
258
+ allChecksFinished: () => {
259
+ setAllChecksStatus('completed');
260
+ },
261
+ };
262
+
263
+ const requestLocationPermission = async () => {
264
+ if (Platform.OS !== 'android') {
265
+ return;
266
+ }
267
+ try {
268
+ const results = await PermissionsAndroid.requestMultiple([
269
+ PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
270
+ PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
271
+ ]);
272
+
273
+ const fineGranted =
274
+ results[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] ===
275
+ PermissionsAndroid.RESULTS.GRANTED;
276
+ const coarseGranted =
277
+ results[PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION] ===
278
+ PermissionsAndroid.RESULTS.GRANTED;
279
+
280
+ console.info('Location permissions:', {
281
+ fineGranted,
282
+ coarseGranted,
283
+ });
284
+ } catch (err) {
285
+ console.warn('Location permission request error:', err);
286
+ }
219
287
  };
220
288
 
221
289
  const addItemsToMalwareWhitelist = async () => {
@@ -237,9 +305,15 @@ const App = () => {
237
305
  );
238
306
  };
239
307
 
240
- useFreeRasp(config, actions);
308
+ useFreeRasp(config, actions, raspExecutionStateActions);
241
309
 
242
- return <DemoApp checks={appChecks} suspiciousApps={suspiciousApps} />;
310
+ return (
311
+ <DemoApp
312
+ checks={appChecks}
313
+ suspiciousApps={suspiciousApps}
314
+ allChecksFinishedStatus={allChecksStatus}
315
+ />
316
+ );
243
317
  };
244
318
 
245
319
  export default App;
@@ -12,6 +12,7 @@ import {
12
12
  TextInput,
13
13
  View,
14
14
  Modal,
15
+ ActivityIndicator,
15
16
  } from 'react-native';
16
17
  import { Colors } from './styles';
17
18
  import { MalwareModal } from './MalwareModal';
@@ -33,7 +34,8 @@ export const DemoApp: React.FC<{
33
34
  status: string;
34
35
  }[];
35
36
  suspiciousApps: SuspiciousAppInfo[];
36
- }> = ({ checks, suspiciousApps }) => {
37
+ allChecksFinishedStatus: 'in progress' | 'completed';
38
+ }> = ({ checks, suspiciousApps, allChecksFinishedStatus }) => {
37
39
  const [hasScreenCaptureBlocked, setHasScreenCaptureBlocked] =
38
40
  React.useState(false);
39
41
  const [externalIdValue, setExternalIdValue] = React.useState('');
@@ -148,6 +150,45 @@ export const DemoApp: React.FC<{
148
150
  </View>
149
151
  </Modal>
150
152
  </HStack>
153
+ <Text style={styles.titleText}>RASP Execution State:</Text>
154
+ <Box
155
+ style={[
156
+ styles.box,
157
+ allChecksFinishedStatus === 'completed'
158
+ ? styles.boxCheckOk
159
+ : styles.boxProgress,
160
+ ]}>
161
+ <HStack
162
+ style={{
163
+ justifyContent: 'space-between',
164
+ alignItems: 'center',
165
+ }}>
166
+ <Text
167
+ style={{
168
+ color:
169
+ allChecksFinishedStatus === 'completed'
170
+ ? 'green'
171
+ : Colors.progressDark,
172
+ fontWeight: 'bold',
173
+ alignSelf: 'center',
174
+ }}>
175
+ All Checks Finished
176
+ </Text>
177
+ {allChecksFinishedStatus === 'completed' ? (
178
+ <Image
179
+ source={CheckmarkCircle}
180
+ style={[
181
+ styles.checkIcon,
182
+ {
183
+ tintColor: Colors.checkOkDark,
184
+ },
185
+ ]}
186
+ />
187
+ ) : (
188
+ <ActivityIndicator size={30} color={Colors.progressDark} />
189
+ )}
190
+ </HStack>
191
+ </Box>
151
192
  <Text style={styles.titleText}>freeRASP checks:</Text>
152
193
  {checks.map((check: any, idx: number) => (
153
194
  <Box
@@ -245,6 +286,10 @@ const styles = StyleSheet.create({
245
286
  borderColor: Colors.checkOkDark,
246
287
  backgroundColor: Colors.checkOkLight,
247
288
  },
289
+ boxProgress: {
290
+ borderColor: Colors.progressDark,
291
+ backgroundColor: Colors.progressLight,
292
+ },
248
293
  box: {
249
294
  borderWidth: 1,
250
295
  paddingHorizontal: 30,
@@ -92,6 +92,10 @@ export const MalwareItem: React.FC<{ app: SuspiciousAppInfo }> = ({ app }) => {
92
92
  </Text>
93
93
  <Text style={styles.listItemTitle}>Detection reason:</Text>
94
94
  <Text style={styles.listItem}>{app.reason}</Text>
95
+ <Text style={styles.listItemTitle}>Granted permissions:</Text>
96
+ <Text style={styles.listItem}>
97
+ {app.permissions?.join(', ') ?? 'Not specified'}
98
+ </Text>
95
99
  <HStack style={styles.buttonGroup}>
96
100
  <Button
97
101
  title={'Add to whitelist'}
@@ -21,4 +21,7 @@ export const androidChecks = [
21
21
  { name: 'Malware', status: 'ok' },
22
22
  { name: 'ADB Enabled', status: 'ok' },
23
23
  { name: 'Multi Instance', status: 'ok' },
24
+ { name: 'Time Spoofing', status: 'ok' },
25
+ { name: 'Location Spoofing', status: 'ok' },
26
+ { name: 'Unsecure Wifi', status: 'ok' },
24
27
  ];
@@ -5,4 +5,6 @@ export const Colors = {
5
5
  checkOkDark: 'green',
6
6
  checkNokDark: 'rgb(200, 0, 0)',
7
7
  grey: 'rgb(120, 120, 120)',
8
+ progressLight: 'rgba(173, 216, 230, 1)', // light blue
9
+ progressDark: 'rgb(30, 144, 255)', // dodger blue
8
10
  };
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
14
14
  s.platforms = { :ios => "11.0" }
15
15
  s.source = { :git => "https://github.com/talsec/freerasp-react-native.git", :tag => "#{s.version}" }
16
16
 
17
- s.source_files = 'ios/*.{h,m,mm,swift}', 'ios/TalsecRuntime.xcframework'
17
+ s.source_files = 'ios/**/*.{h,m,mm,swift}', 'ios/TalsecRuntime.xcframework'
18
18
  s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
19
19
  s.ios.vendored_frameworks = "ios/TalsecRuntime.xcframework"
20
20
 
@@ -11,6 +11,10 @@ RCT_EXTERN_METHOD(getThreatChannelData:(RCTPromiseResolveBlock)resolve
11
11
  withRejecter:(RCTPromiseRejectBlock)reject)
12
12
  RCT_EXTERN_METHOD(getThreatIdentifiers:(RCTPromiseResolveBlock)resolve
13
13
  withRejecter:(RCTPromiseRejectBlock)reject)
14
+ RCT_EXTERN_METHOD(getRaspExecutionStateChannelData:(RCTPromiseResolveBlock)resolve
15
+ withRejecter:(RCTPromiseRejectBlock)reject)
16
+ RCT_EXTERN_METHOD(getRaspExecutionStateIdentifiers:(RCTPromiseResolveBlock)resolve
17
+ withRejecter:(RCTPromiseRejectBlock)reject)
14
18
  RCT_EXTERN_METHOD(blockScreenCapture:(BOOL)enable
15
19
  withResolver:(RCTPromiseResolveBlock)resolve
16
20
  withRejecter:(RCTPromiseRejectBlock)reject)
@@ -6,9 +6,6 @@ class FreeraspReactNative: RCTEventEmitter {
6
6
 
7
7
  public static var shared:FreeraspReactNative?
8
8
 
9
- let threatChannelKey = String(Int.random(in: 100_000..<999_999_999)) // key of the argument map under which threats are expected
10
- let threatChannelName = String(Int.random(in: 100_000..<999_999_999)) // name of the channel over which threat callbacks are sent
11
-
12
9
  override init() {
13
10
  super.init()
14
11
  FreeraspReactNative.shared = self
@@ -74,33 +71,33 @@ class FreeraspReactNative: RCTEventEmitter {
74
71
  UserDefaults.standard.set(externalId, forKey: "app.talsec.externalid")
75
72
  resolve("OK - Store external ID")
76
73
  }
77
-
78
- private func getProtectedWindow(completion: @escaping (UIWindow?) -> Void) {
79
- DispatchQueue.main.async {
80
- if #available(iOS 13.0, *) {
81
- if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
82
- if let window = windowScene.windows.first {
83
- completion(window)
84
- } else {
85
- completion(nil)
86
- }
87
- } else {
88
- completion(nil)
89
- }
90
- }
91
- }
92
- }
93
74
 
94
75
  /**
95
76
  * Method to setup the message passing between native and React Native
96
77
  */
97
78
  @objc(getThreatChannelData:withRejecter:)
98
79
  private func getThreatChannelData(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
99
- resolve([threatChannelName, threatChannelKey])
80
+ resolve([EventIdentifiers.threatChannelName, EventIdentifiers.threatChannelKey])
81
+ }
82
+
83
+ /**
84
+ * Method to setup the message passing between native and React Native
85
+ */
86
+ @objc(getRaspExecutionStateChannelData:withRejecter:)
87
+ private func getRaspExecutionStateChannelData(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
88
+ resolve([EventIdentifiers.raspExecutionStateChannelName, EventIdentifiers.raspExecutionStateChannelKey])
100
89
  }
101
90
 
102
91
  func dispatchEvent(securityThreat: SecurityThreat) -> Void {
103
- FreeraspReactNative.shared!.sendEvent(withName: threatChannelName, body: [threatChannelKey: securityThreat.callbackIdentifier])
92
+ FreeraspReactNative.shared!.sendEvent(withName: EventIdentifiers.threatChannelName, body: [
93
+ EventIdentifiers.threatChannelKey: securityThreat.callbackIdentifier,
94
+ ])
95
+ }
96
+
97
+ func dispatchRaspExecutionStateEvent(event: RaspExecutionStates) -> Void {
98
+ FreeraspReactNative.shared!.sendEvent(withName: EventIdentifiers.raspExecutionStateChannelName, body: [
99
+ EventIdentifiers.raspExecutionStateChannelKey: event.callbackIdentifier,
100
+ ])
104
101
  }
105
102
 
106
103
  /**
@@ -108,7 +105,15 @@ class FreeraspReactNative: RCTEventEmitter {
108
105
  */
109
106
  @objc(getThreatIdentifiers:withRejecter:)
110
107
  private func getThreatIdentifiers(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
111
- resolve(getThreatIdentifiers())
108
+ resolve(freerasp_react_native.getThreatIdentifiers())
109
+ }
110
+
111
+ /**
112
+ * Method to get the random identifiers of callbacks
113
+ */
114
+ @objc(getRaspExecutionStateIdentifiers:withRejecter:)
115
+ private func getRaspExecutionStateIdentifiers(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
116
+ resolve(freerasp_react_native.getRaspExecutionStateIdentifiers())
112
117
  }
113
118
 
114
119
  /**
@@ -120,65 +125,15 @@ class FreeraspReactNative: RCTEventEmitter {
120
125
  abort()
121
126
  }
122
127
 
123
- private func getThreatIdentifiers() -> [Int] {
124
- return SecurityThreat.allCases
125
- .filter {
126
- threat in threat.rawValue != "passcodeChange"
127
- }
128
- .map {
129
- threat in threat.callbackIdentifier
130
- }
131
- }
132
-
133
128
  override func supportedEvents() -> [String]! {
134
- return [threatChannelName]
129
+ return [EventIdentifiers.threatChannelName, EventIdentifiers.raspExecutionStateChannelName]
135
130
  }
136
131
  }
137
132
 
138
- struct ThreatIdentifiers {
139
- static let threatIdentifierList: [Int] = (1...14).map { _ in Int.random(in: 100_000..<999_999_999) }
140
- }
141
133
 
142
- /// An extension to unify callback names with RN ones.
143
- extension SecurityThreat {
144
-
145
- var callbackIdentifier: Int {
146
- switch self {
147
- case .signature:
148
- return ThreatIdentifiers.threatIdentifierList[0]
149
- case .jailbreak:
150
- return ThreatIdentifiers.threatIdentifierList[1]
151
- case .debugger:
152
- return ThreatIdentifiers.threatIdentifierList[2]
153
- case .runtimeManipulation:
154
- return ThreatIdentifiers.threatIdentifierList[3]
155
- case .passcode:
156
- return ThreatIdentifiers.threatIdentifierList[4]
157
- case .passcodeChange:
158
- return ThreatIdentifiers.threatIdentifierList[5]
159
- case .simulator:
160
- return ThreatIdentifiers.threatIdentifierList[6]
161
- case .missingSecureEnclave:
162
- return ThreatIdentifiers.threatIdentifierList[7]
163
- case .systemVPN:
164
- return ThreatIdentifiers.threatIdentifierList[8]
165
- case .deviceChange:
166
- return ThreatIdentifiers.threatIdentifierList[9]
167
- case .deviceID:
168
- return ThreatIdentifiers.threatIdentifierList[10]
169
- case .unofficialStore:
170
- return ThreatIdentifiers.threatIdentifierList[11]
171
- case .screenshot:
172
- return ThreatIdentifiers.threatIdentifierList[12]
173
- case .screenRecording:
174
- return ThreatIdentifiers.threatIdentifierList[13]
175
- @unknown default:
176
- abort()
177
- }
178
- }
179
- }
180
134
 
181
- extension SecurityThreatCenter: SecurityThreatHandler {
135
+
136
+ extension SecurityThreatCenter: @retroactive SecurityThreatHandler, @retroactive RaspExecutionState {
182
137
 
183
138
  public func threatDetected(_ securityThreat: TalsecRuntime.SecurityThreat) {
184
139
  if (securityThreat.rawValue == "passcodeChange") {
@@ -186,4 +141,11 @@ extension SecurityThreatCenter: SecurityThreatHandler {
186
141
  }
187
142
  FreeraspReactNative.shared!.dispatchEvent(securityThreat: securityThreat)
188
143
  }
144
+
145
+ public func onAllChecksFinished() {
146
+
147
+ FreeraspReactNative.shared!.dispatchRaspExecutionStateEvent(event: RaspExecutionStates.allChecksFinished)
148
+ }
189
149
  }
150
+
151
+
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>TalsecRuntime.framework/TalsecRuntime</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>TalsecRuntime.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
+ <string>x86_64</string>
17
18
  </array>
18
19
  <key>SupportedPlatform</key>
19
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
20
23
  </dict>
21
24
  <dict>
22
25
  <key>BinaryPath</key>
23
26
  <string>TalsecRuntime.framework/TalsecRuntime</string>
24
27
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
26
29
  <key>LibraryPath</key>
27
30
  <string>TalsecRuntime.framework</string>
28
31
  <key>SupportedArchitectures</key>
29
32
  <array>
30
33
  <string>arm64</string>
31
- <string>x86_64</string>
32
34
  </array>
33
35
  <key>SupportedPlatform</key>
34
36
  <string>ios</string>
35
- <key>SupportedPlatformVariant</key>
36
- <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>