freerasp-react-native 4.2.4 → 4.3.1

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 (182) hide show
  1. package/CHANGELOG.md +69 -4
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +45 -22
  4. package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +39 -19
  5. package/android/src/main/java/com/freeraspreactnative/events/BaseRaspEvent.kt +7 -0
  6. package/android/src/main/java/com/freeraspreactnative/events/RaspExecutionStateEvent.kt +20 -0
  7. package/android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt +67 -0
  8. package/android/src/main/java/com/freeraspreactnative/models/RNSuspiciousAppInfo.kt +1 -0
  9. package/android/src/main/java/com/freeraspreactnative/utils/Extensions.kt +1 -0
  10. package/android/src/main/java/com/freeraspreactnative/utils/RandomGenerator.kt +18 -0
  11. package/android/src/main/java/com/freeraspreactnative/utils/Utils.kt +2 -5
  12. package/example/android/app/src/main/AndroidManifest.xml +7 -0
  13. package/example/src/App.tsx +77 -3
  14. package/example/src/DemoApp.tsx +46 -1
  15. package/example/src/MalwareItem.tsx +4 -0
  16. package/example/src/checks.ts +3 -0
  17. package/example/src/styles.ts +2 -0
  18. package/freerasp-react-native.podspec +1 -1
  19. package/ios/FreeraspReactNative.m +4 -0
  20. package/ios/FreeraspReactNative.swift +37 -75
  21. package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
  22. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  23. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  24. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +144 -114
  25. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  26. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  27. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  28. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +380 -281
  29. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curlver.h +5 -6
  30. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/easy.h +4 -4
  31. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/header.h +1 -1
  32. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/mprintf.h +11 -4
  33. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +62 -22
  34. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +2 -2
  35. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/system.h +76 -164
  36. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
  37. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +5 -4
  38. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/websockets.h +17 -3
  39. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  40. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +181 -146
  41. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -0
  42. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +3 -0
  43. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  44. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  45. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  46. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +380 -281
  47. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curlver.h +5 -6
  48. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/easy.h +4 -4
  49. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/header.h +1 -1
  50. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/mprintf.h +11 -4
  51. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +62 -22
  52. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +2 -2
  53. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/system.h +76 -164
  54. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
  55. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +5 -4
  56. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/websockets.h +17 -3
  57. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  58. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +181 -146
  59. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -0
  60. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -0
  61. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +181 -146
  62. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -0
  63. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -0
  64. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  65. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +52 -41
  66. package/ios/models/RaspExecutionStates.swift +15 -0
  67. package/ios/models/SecurityThreat.swift +40 -0
  68. package/ios/utils/EventIdentifiers.swift +13 -0
  69. package/ios/utils/RandomGenerator.swift +12 -0
  70. package/ios/utils/Utils.swift +34 -0
  71. package/lib/commonjs/api/listeners/raspExecutionState.js +40 -0
  72. package/lib/commonjs/api/listeners/raspExecutionState.js.map +1 -0
  73. package/lib/commonjs/api/listeners/threat.js +102 -0
  74. package/lib/commonjs/api/listeners/threat.js.map +1 -0
  75. package/lib/commonjs/api/methods/native.js +43 -0
  76. package/lib/commonjs/api/methods/native.js.map +1 -0
  77. package/lib/commonjs/api/methods/reactNative.js +35 -0
  78. package/lib/commonjs/api/methods/reactNative.js.map +1 -0
  79. package/lib/commonjs/api/nativeModules.js +12 -0
  80. package/lib/commonjs/api/nativeModules.js.map +1 -0
  81. package/lib/commonjs/channels/raspExecutionState.js +36 -0
  82. package/lib/commonjs/channels/raspExecutionState.js.map +1 -0
  83. package/lib/commonjs/channels/threat.js +37 -0
  84. package/lib/commonjs/channels/threat.js.map +1 -0
  85. package/lib/commonjs/index.js +39 -188
  86. package/lib/commonjs/index.js.map +1 -1
  87. package/lib/commonjs/internal.js +6 -0
  88. package/lib/commonjs/internal.js.map +1 -0
  89. package/lib/commonjs/models/raspExecutionState.js +17 -0
  90. package/lib/commonjs/models/raspExecutionState.js.map +1 -0
  91. package/lib/commonjs/{threat.js → models/threat.js} +4 -1
  92. package/lib/commonjs/models/threat.js.map +1 -0
  93. package/lib/commonjs/types/types.js.map +1 -0
  94. package/lib/commonjs/utils/malware.js +28 -0
  95. package/lib/commonjs/utils/malware.js.map +1 -0
  96. package/lib/commonjs/utils/utils.js +21 -0
  97. package/lib/commonjs/utils/utils.js.map +1 -0
  98. package/lib/module/api/listeners/raspExecutionState.js +32 -0
  99. package/lib/module/api/listeners/raspExecutionState.js.map +1 -0
  100. package/lib/module/api/listeners/threat.js +94 -0
  101. package/lib/module/api/listeners/threat.js.map +1 -0
  102. package/lib/module/api/methods/native.js +30 -0
  103. package/lib/module/api/methods/native.js.map +1 -0
  104. package/lib/module/api/methods/reactNative.js +28 -0
  105. package/lib/module/api/methods/reactNative.js.map +1 -0
  106. package/lib/module/api/nativeModules.js +5 -0
  107. package/lib/module/api/nativeModules.js.map +1 -0
  108. package/lib/module/channels/raspExecutionState.js +27 -0
  109. package/lib/module/channels/raspExecutionState.js.map +1 -0
  110. package/lib/module/channels/threat.js +28 -0
  111. package/lib/module/channels/threat.js.map +1 -0
  112. package/lib/module/index.js +5 -172
  113. package/lib/module/index.js.map +1 -1
  114. package/lib/module/internal.js +3 -0
  115. package/lib/module/internal.js.map +1 -0
  116. package/lib/module/models/raspExecutionState.js +10 -0
  117. package/lib/module/models/raspExecutionState.js.map +1 -0
  118. package/lib/module/{threat.js → models/threat.js} +4 -1
  119. package/lib/module/models/threat.js.map +1 -0
  120. package/lib/module/types/types.js.map +1 -0
  121. package/lib/module/utils/malware.js +20 -0
  122. package/lib/module/utils/malware.js.map +1 -0
  123. package/lib/module/utils/utils.js +12 -0
  124. package/lib/module/utils/utils.js.map +1 -0
  125. package/lib/typescript/src/api/listeners/raspExecutionState.d.ts +4 -0
  126. package/lib/typescript/src/api/listeners/raspExecutionState.d.ts.map +1 -0
  127. package/lib/typescript/src/api/listeners/threat.d.ts +4 -0
  128. package/lib/typescript/src/api/listeners/threat.d.ts.map +1 -0
  129. package/lib/typescript/src/api/methods/native.d.ts +9 -0
  130. package/lib/typescript/src/api/methods/native.d.ts.map +1 -0
  131. package/lib/typescript/src/api/methods/reactNative.d.ts +3 -0
  132. package/lib/typescript/src/api/methods/reactNative.d.ts.map +1 -0
  133. package/lib/typescript/src/api/nativeModules.d.ts +2 -0
  134. package/lib/typescript/src/api/nativeModules.d.ts.map +1 -0
  135. package/lib/typescript/src/channels/raspExecutionState.d.ts +7 -0
  136. package/lib/typescript/src/channels/raspExecutionState.d.ts.map +1 -0
  137. package/lib/typescript/src/channels/threat.d.ts +8 -0
  138. package/lib/typescript/src/channels/threat.d.ts.map +1 -0
  139. package/lib/typescript/src/index.d.ts +5 -13
  140. package/lib/typescript/src/index.d.ts.map +1 -1
  141. package/lib/typescript/src/internal.d.ts +2 -0
  142. package/lib/typescript/src/internal.d.ts.map +1 -0
  143. package/lib/typescript/src/models/raspExecutionState.d.ts +7 -0
  144. package/lib/typescript/src/models/raspExecutionState.d.ts.map +1 -0
  145. package/lib/typescript/src/{threat.d.ts → models/threat.d.ts} +3 -0
  146. package/lib/typescript/src/models/threat.d.ts.map +1 -0
  147. package/lib/typescript/src/{types.d.ts → types/types.d.ts} +12 -1
  148. package/lib/typescript/src/types/types.d.ts.map +1 -0
  149. package/lib/typescript/src/utils/malware.d.ts +4 -0
  150. package/lib/typescript/src/utils/malware.d.ts.map +1 -0
  151. package/lib/typescript/src/{utils.d.ts → utils/utils.d.ts} +1 -0
  152. package/lib/typescript/src/utils/utils.d.ts.map +1 -0
  153. package/package.json +2 -2
  154. package/src/api/listeners/raspExecutionState.ts +42 -0
  155. package/src/api/listeners/threat.ts +101 -0
  156. package/src/api/methods/native.ts +39 -0
  157. package/src/api/methods/reactNative.ts +42 -0
  158. package/src/api/nativeModules.ts +3 -0
  159. package/src/channels/raspExecutionState.ts +35 -0
  160. package/src/channels/threat.ts +35 -0
  161. package/src/index.tsx +5 -209
  162. package/src/internal.ts +2 -0
  163. package/src/models/raspExecutionState.ts +13 -0
  164. package/src/{threat.ts → models/threat.ts} +6 -0
  165. package/src/{types.ts → types/types.ts} +12 -1
  166. package/src/utils/malware.ts +24 -0
  167. package/src/utils/utils.ts +14 -0
  168. package/android/src/main/java/com/freeraspreactnative/Threat.kt +0 -57
  169. package/lib/commonjs/threat.js.map +0 -1
  170. package/lib/commonjs/types.js.map +0 -1
  171. package/lib/commonjs/utils.js +0 -16
  172. package/lib/commonjs/utils.js.map +0 -1
  173. package/lib/module/threat.js.map +0 -1
  174. package/lib/module/types.js.map +0 -1
  175. package/lib/module/utils.js +0 -8
  176. package/lib/module/utils.js.map +0 -1
  177. package/lib/typescript/src/threat.d.ts.map +0 -1
  178. package/lib/typescript/src/types.d.ts.map +0 -1
  179. package/lib/typescript/src/utils.d.ts.map +0 -1
  180. package/src/utils.ts +0 -9
  181. /package/lib/commonjs/{types.js → types/types.js} +0 -0
  182. /package/lib/module/{types.js → types/types.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../src/channels/raspExecutionState.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gCAAgC,QAAa,QAAQ,MAAM,EAAE,CAUzE,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAa,QACxD;IAAC,MAAM;IAAE,MAAM;CAAC,CAQjB,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAa,QAAQ,IAAI,CAMrE,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const getThreatIdentifiers: () => Promise<number[]>;
2
+ export declare const getThreatChannelData: () => Promise<[
3
+ string,
4
+ string,
5
+ string
6
+ ]>;
7
+ export declare const prepareThreatMapping: () => Promise<void>;
8
+ //# sourceMappingURL=threat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/channels/threat.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,QAAa,QAAQ,MAAM,EAAE,CAS7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAC5C;IAAC,MAAM;IAAE,MAAM;IAAE,MAAM;CAAC,CAQzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAAQ,IAAI,CAMzD,CAAC"}
@@ -1,14 +1,6 @@
1
- import type { NativeEventEmitterActions, TalsecConfig } from './types';
2
- declare const FreeraspReactNative: any;
3
- export declare const setThreatListeners: <T extends NativeEventEmitterActions>(config: T & Record<Exclude<keyof T, keyof NativeEventEmitterActions>, []>) => Promise<void>;
4
- export declare const removeThreatListeners: () => void;
5
- export declare const talsecStart: (options: TalsecConfig) => Promise<string>;
6
- export declare const useFreeRasp: <T extends NativeEventEmitterActions>(config: TalsecConfig, actions: T & Record<Exclude<keyof T, keyof NativeEventEmitterActions>, []>) => void;
7
- export declare const addToWhitelist: (packageName: string) => Promise<boolean>;
8
- export declare const getAppIcon: (packageName: string) => Promise<string>;
9
- export declare const blockScreenCapture: (enable: boolean) => Promise<string>;
10
- export declare const isScreenCaptureBlocked: () => Promise<boolean>;
11
- export declare const storeExternalId: (data: string) => Promise<string>;
12
- export * from './types';
13
- export default FreeraspReactNative;
1
+ export * from './types/types';
2
+ export * from './api/methods/native';
3
+ export * from './api/methods/reactNative';
4
+ export * from './api/listeners/threat';
5
+ export * from './api/listeners/raspExecutionState';
14
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EAGzB,YAAY,EACb,MAAM,SAAS,CAAC;AAKjB,QAAA,MAAQ,mBAAmB,KAAkB,CAAC;AAyD9C,eAAO,MAAM,kBAAkB,gDACrB,CAAC,GAAG,OAAO,QAAQ,MAAM,CAAC,EAAE,MAAM,yBAAyB,CAAC,EAAE,EAAE,CAAC,kBAqE1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,IAExC,CAAC;AAEF,eAAO,MAAM,WAAW,YAAmB,YAAY,KAAG,QAAQ,MAAM,CAEvE,CAAC;AAEF,eAAO,MAAM,WAAW,gDACd,YAAY,WACX,CAAC,GAAG,OAAO,QAAQ,MAAM,CAAC,EAAE,MAAM,yBAAyB,CAAC,EAAE,EAAE,CAAC,SAqB3E,CAAC;AAEF,eAAO,MAAM,cAAc,gBAAuB,MAAM,KAAG,QAAQ,OAAO,CAKzE,CAAC;AAEF,eAAO,MAAM,UAAU,gBAAiB,MAAM,KAAG,QAAQ,MAAM,CAO9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,OAAO,KAAG,QAAQ,MAAM,CAElE,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,QAAQ,OAAO,CAExD,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,MAAM,KAAG,QAAQ,MAAM,CAE5D,CAAC;AAEF,cAAc,SAAS,CAAC;AACxB,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare class RaspExecutionState {
2
+ value: number;
3
+ static AllChecksFinished: RaspExecutionState;
4
+ constructor(value: number);
5
+ static getValues(): RaspExecutionState[];
6
+ }
7
+ //# sourceMappingURL=raspExecutionState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../src/models/raspExecutionState.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IAC7B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,iBAAiB,qBAA6B;gBAEzC,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,kBAAkB,EAAE;CAGzC"}
@@ -18,6 +18,9 @@ export declare class Threat {
18
18
  static Screenshot: Threat;
19
19
  static ScreenRecording: Threat;
20
20
  static MultiInstance: Threat;
21
+ static TimeSpoofing: Threat;
22
+ static LocationSpoofing: Threat;
23
+ static UnsecureWifi: Threat;
21
24
  constructor(value: number);
22
25
  static getValues(): Threat[];
23
26
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/models/threat.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,0BAA0B,SAAiB;IAClD,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,iBAAiB,SAAiB;IACzC,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,YAAY,SAAiB;gBAExB,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,MAAM,EAAE;CAwC7B"}
@@ -3,6 +3,7 @@ export type TalsecConfig = {
3
3
  iosConfig?: TalsecIosConfig;
4
4
  watcherMail: string;
5
5
  isProd?: boolean;
6
+ killOnBypass?: boolean;
6
7
  };
7
8
  export type TalsecAndroidConfig = {
8
9
  packageName: string;
@@ -23,6 +24,7 @@ export type TalsecMalwareConfig = {
23
24
  export type SuspiciousAppInfo = {
24
25
  packageInfo: PackageInfo;
25
26
  reason: string;
27
+ permissions?: string[];
26
28
  };
27
29
  export type PackageInfo = {
28
30
  packageName: string;
@@ -31,7 +33,7 @@ export type PackageInfo = {
31
33
  appIcon?: string;
32
34
  installerStore?: string;
33
35
  };
34
- export type NativeEventEmitterActions = {
36
+ export type ThreatEventActions = {
35
37
  privilegedAccess?: () => any;
36
38
  debug?: () => any;
37
39
  simulator?: () => any;
@@ -50,5 +52,14 @@ export type NativeEventEmitterActions = {
50
52
  screenshot?: () => any;
51
53
  screenRecording?: () => any;
52
54
  multiInstance?: () => any;
55
+ timeSpoofing?: () => any;
56
+ locationSpoofing?: () => any;
57
+ unsecureWifi?: () => any;
58
+ };
59
+ export type NativeEvent = {
60
+ [key: string]: number | string[] | undefined;
61
+ };
62
+ export type RaspExecutionStateEventActions = {
63
+ allChecksFinished?: () => any;
53
64
  };
54
65
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"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ousAppInfo[]>;
3
+ export declare const toSuspiciousAppInfo: (base64Value: string) => SuspiciousAppInfo;
4
+ //# sourceMappingURL=malware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"malware.d.ts","sourceRoot":"","sources":["../../../../src/utils/malware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGrE,eAAO,MAAM,gBAAgB,SACrB,MAAM,EAAE,KACb,QAAQ,iBAAiB,EAAE,CAQ7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAiB,MAAM,KAAG,iBAQzD,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export declare const getThreatCount: () => number;
2
+ export declare const getRaspExecutionStateCount: () => number;
2
3
  export declare const itemsHaveType: (data: any[], desidedType: string) => boolean;
3
4
  //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAO,MAEjC,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,MAE7C,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,GAAG,EAAE,eAAe,MAAM,YAE7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freerasp-react-native",
3
- "version": "4.2.4",
3
+ "version": "4.3.1",
4
4
  "description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -41,7 +41,7 @@
41
41
  "bugs": {
42
42
  "url": "https://github.com/talsec/Free-RASP-ReactNative/issues"
43
43
  },
44
- "homepage": "https://github.com/talsec/Free-RASP-ReactNative#readme",
44
+ "homepage": "https://docs.talsec.app/freerasp",
45
45
  "publishConfig": {
46
46
  "registry": "https://registry.npmjs.org/"
47
47
  },
@@ -0,0 +1,42 @@
1
+ import { NativeEventEmitter, type EmitterSubscription } from 'react-native';
2
+ import { FreeraspReactNative } from '../nativeModules';
3
+ import { onInvalidCallback } from '../methods/native';
4
+ import type {
5
+ NativeEvent,
6
+ RaspExecutionStateEventActions,
7
+ } from '../../types/types';
8
+ import {
9
+ getRaspExecutionStateChannelData,
10
+ prepareRaspExecutionStateMapping,
11
+ } from '../../channels/raspExecutionState';
12
+ import { RaspExecutionState } from '../../models/raspExecutionState';
13
+
14
+ const eventEmitter = new NativeEventEmitter(FreeraspReactNative);
15
+ let eventsListener: EmitterSubscription | undefined;
16
+
17
+ export const setRaspExecutionStateListener = async (
18
+ config: RaspExecutionStateEventActions
19
+ ) => {
20
+ const [channel, key] = await getRaspExecutionStateChannelData();
21
+ await prepareRaspExecutionStateMapping();
22
+
23
+ const listener = async (event: NativeEvent) => {
24
+ if (event[key] === undefined) {
25
+ onInvalidCallback();
26
+ }
27
+ switch (event[key]) {
28
+ case RaspExecutionState.AllChecksFinished.value:
29
+ config.allChecksFinished?.();
30
+ break;
31
+ default:
32
+ onInvalidCallback();
33
+ break;
34
+ }
35
+ };
36
+ eventsListener = eventEmitter.addListener(channel, listener);
37
+ };
38
+
39
+ export const removeRaspExecutionStateEventListener = (): void => {
40
+ eventsListener?.remove();
41
+ eventsListener = undefined;
42
+ };
@@ -0,0 +1,101 @@
1
+ import { NativeEventEmitter, type EmitterSubscription } from 'react-native';
2
+ import { FreeraspReactNative } from '../nativeModules';
3
+ import { onInvalidCallback } from '../methods/native';
4
+ import { Threat } from '../../models/threat';
5
+ import type { NativeEvent, ThreatEventActions } from '../../types/types';
6
+ import { parseMalwareData } from '../../utils/malware';
7
+ import {
8
+ getThreatChannelData,
9
+ prepareThreatMapping,
10
+ } from '../../channels/threat';
11
+
12
+ const eventEmitter = new NativeEventEmitter(FreeraspReactNative);
13
+ let eventsListener: EmitterSubscription | undefined;
14
+
15
+ export const setThreatListeners = async (config: ThreatEventActions) => {
16
+ const [channel, key, malwareKey] = await getThreatChannelData();
17
+ await prepareThreatMapping();
18
+
19
+ const listener = async (event: NativeEvent) => {
20
+ if (event[key] === undefined) {
21
+ onInvalidCallback();
22
+ }
23
+ switch (event[key]) {
24
+ case Threat.PrivilegedAccess.value:
25
+ config.privilegedAccess?.();
26
+ break;
27
+ case Threat.Debug.value:
28
+ config.debug?.();
29
+ break;
30
+ case Threat.Simulator.value:
31
+ config.simulator?.();
32
+ break;
33
+ case Threat.AppIntegrity.value:
34
+ config.appIntegrity?.();
35
+ break;
36
+ case Threat.UnofficialStore.value:
37
+ config.unofficialStore?.();
38
+ break;
39
+ case Threat.Hooks.value:
40
+ config.hooks?.();
41
+ break;
42
+ case Threat.DeviceBinding.value:
43
+ config.deviceBinding?.();
44
+ break;
45
+ case Threat.Passcode.value:
46
+ config.passcode?.();
47
+ break;
48
+ case Threat.SecureHardwareNotAvailable.value:
49
+ config.secureHardwareNotAvailable?.();
50
+ break;
51
+ case Threat.ObfuscationIssues.value:
52
+ config.obfuscationIssues?.();
53
+ break;
54
+ case Threat.DeviceID.value:
55
+ config.deviceID?.();
56
+ break;
57
+ case Threat.DevMode.value:
58
+ config.devMode?.();
59
+ break;
60
+ case Threat.SystemVPN.value:
61
+ config.systemVPN?.();
62
+ break;
63
+ case Threat.Malware.value:
64
+ const malwareData = event[malwareKey];
65
+ config.malware?.(
66
+ await parseMalwareData(Array.isArray(malwareData) ? malwareData : [])
67
+ );
68
+ break;
69
+ case Threat.ADBEnabled.value:
70
+ config.adbEnabled?.();
71
+ break;
72
+ case Threat.Screenshot.value:
73
+ config.screenshot?.();
74
+ break;
75
+ case Threat.ScreenRecording.value:
76
+ config.screenRecording?.();
77
+ break;
78
+ case Threat.MultiInstance.value:
79
+ config.multiInstance?.();
80
+ break;
81
+ case Threat.TimeSpoofing.value:
82
+ config.timeSpoofing?.();
83
+ break;
84
+ case Threat.LocationSpoofing.value:
85
+ config.locationSpoofing?.();
86
+ break;
87
+ case Threat.UnsecureWifi.value:
88
+ config.unsecureWifi?.();
89
+ break;
90
+ default:
91
+ onInvalidCallback();
92
+ break;
93
+ }
94
+ };
95
+ eventsListener = eventEmitter.addListener(channel, listener);
96
+ };
97
+
98
+ export const removeThreatListener = (): void => {
99
+ eventsListener?.remove();
100
+ eventsListener = undefined;
101
+ };
@@ -0,0 +1,39 @@
1
+ import { Platform } from 'react-native';
2
+ import { FreeraspReactNative } from '../nativeModules';
3
+ import type { TalsecConfig } from '../../types/types';
4
+
5
+ export const talsecStart = async (options: TalsecConfig): Promise<string> => {
6
+ return FreeraspReactNative.talsecStart(options);
7
+ };
8
+
9
+ export const addToWhitelist = async (packageName: string): Promise<boolean> => {
10
+ if (Platform.OS === 'ios') {
11
+ return Promise.reject('Malware detection not available on iOS');
12
+ }
13
+ return FreeraspReactNative.addToWhitelist(packageName);
14
+ };
15
+
16
+ export const blockScreenCapture = (enable: boolean): Promise<string> => {
17
+ return FreeraspReactNative.blockScreenCapture(enable);
18
+ };
19
+
20
+ export const isScreenCaptureBlocked = (): Promise<boolean> => {
21
+ return FreeraspReactNative.isScreenCaptureBlocked();
22
+ };
23
+
24
+ export const storeExternalId = (data: string): Promise<string> => {
25
+ return FreeraspReactNative.storeExternalId(data);
26
+ };
27
+
28
+ export const getAppIcon = (packageName: string): Promise<string> => {
29
+ if (Platform.OS === 'ios') {
30
+ return Promise.reject(
31
+ 'App icon retrieval for Malware detection not available on iOS'
32
+ );
33
+ }
34
+ return FreeraspReactNative.getAppIcon(packageName);
35
+ };
36
+
37
+ export const onInvalidCallback = (): void => {
38
+ FreeraspReactNative.onInvalidCallback();
39
+ };
@@ -0,0 +1,42 @@
1
+ import { talsecStart } from 'freerasp-react-native';
2
+ import { useEffect } from 'react';
3
+ import {
4
+ setRaspExecutionStateListener,
5
+ removeRaspExecutionStateEventListener,
6
+ } from '../listeners/raspExecutionState';
7
+ import { setThreatListeners, removeThreatListener } from '../listeners/threat';
8
+ import type {
9
+ ThreatEventActions,
10
+ TalsecConfig,
11
+ RaspExecutionStateEventActions,
12
+ } from '../../types/types';
13
+ import { onInvalidCallback } from './native';
14
+
15
+ export const useFreeRasp = (
16
+ config: TalsecConfig,
17
+ actions: ThreatEventActions,
18
+ raspExecutionStateActions?: RaspExecutionStateEventActions
19
+ ) => {
20
+ useEffect(() => {
21
+ (async () => {
22
+ await setThreatListeners(actions);
23
+ raspExecutionStateActions &&
24
+ (await setRaspExecutionStateListener(raspExecutionStateActions));
25
+ try {
26
+ let response = await talsecStart(config);
27
+ if (response !== 'freeRASP started') {
28
+ onInvalidCallback();
29
+ }
30
+ console.log(response);
31
+ } catch (e: any) {
32
+ console.error(`${e.code}: ${e.message}`);
33
+ }
34
+
35
+ return () => {
36
+ removeThreatListener();
37
+ removeRaspExecutionStateEventListener();
38
+ };
39
+ })();
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, []);
42
+ };
@@ -0,0 +1,3 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ export const { FreeraspReactNative } = NativeModules;
@@ -0,0 +1,35 @@
1
+ import { getRaspExecutionStateCount, itemsHaveType } from '../utils/utils';
2
+ import { FreeraspReactNative } from '../api/nativeModules';
3
+ import { onInvalidCallback } from '../api/methods/native';
4
+ import { RaspExecutionState } from '../models/raspExecutionState';
5
+
6
+ export const getRaspExecutionStateIdentifiers = async (): Promise<number[]> => {
7
+ const identifiers =
8
+ await FreeraspReactNative.getRaspExecutionStateIdentifiers();
9
+ if (
10
+ identifiers.length !== getRaspExecutionStateCount() ||
11
+ !itemsHaveType(identifiers, 'number')
12
+ ) {
13
+ onInvalidCallback();
14
+ }
15
+ return identifiers;
16
+ };
17
+
18
+ export const getRaspExecutionStateChannelData = async (): Promise<
19
+ [string, string]
20
+ > => {
21
+ const dataLength = 2;
22
+ const data = await FreeraspReactNative.getRaspExecutionStateChannelData();
23
+ if (data.length !== dataLength || !itemsHaveType(data, 'string')) {
24
+ onInvalidCallback();
25
+ }
26
+ return data;
27
+ };
28
+
29
+ export const prepareRaspExecutionStateMapping = async (): Promise<void> => {
30
+ const newValues = await getRaspExecutionStateIdentifiers();
31
+ const threats = RaspExecutionState.getValues();
32
+ threats.map((threat, index) => {
33
+ threat.value = newValues[index]!;
34
+ });
35
+ };
@@ -0,0 +1,35 @@
1
+ import { Platform } from 'react-native';
2
+ import { getThreatCount, itemsHaveType } from '../utils/utils';
3
+ import { FreeraspReactNative } from '../api/nativeModules';
4
+ import { Threat } from '../models/threat';
5
+ import { onInvalidCallback } from '../api/methods/native';
6
+
7
+ export const getThreatIdentifiers = async (): Promise<number[]> => {
8
+ const identifiers = await FreeraspReactNative.getThreatIdentifiers();
9
+ if (
10
+ identifiers.length !== getThreatCount() ||
11
+ !itemsHaveType(identifiers, 'number')
12
+ ) {
13
+ onInvalidCallback();
14
+ }
15
+ return identifiers;
16
+ };
17
+
18
+ export const getThreatChannelData = async (): Promise<
19
+ [string, string, string]
20
+ > => {
21
+ const dataLength = Platform.OS === 'ios' ? 2 : 3;
22
+ const data = await FreeraspReactNative.getThreatChannelData();
23
+ if (data.length !== dataLength || !itemsHaveType(data, 'string')) {
24
+ onInvalidCallback();
25
+ }
26
+ return data;
27
+ };
28
+
29
+ export const prepareThreatMapping = async (): Promise<void> => {
30
+ const newValues = await getThreatIdentifiers();
31
+ const threats = Threat.getValues();
32
+ threats.map((threat, index) => {
33
+ threat.value = newValues[index]!;
34
+ });
35
+ };