freerasp-react-native 3.7.2 → 3.8.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 (67) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +10 -0
  3. package/android/build.gradle +2 -1
  4. package/android/proguard-rules.pro +1 -0
  5. package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +8 -0
  6. package/android/src/main/java/com/freeraspreactnative/Threat.kt +5 -2
  7. package/example/index.d.ts +1 -0
  8. package/example/ios/FreeraspReactNativeExample.xcodeproj/project.pbxproj +15 -0
  9. package/example/package.json +8 -3
  10. package/example/src/App.tsx +18 -0
  11. package/example/src/checks.ts +10 -6
  12. package/example/yarn.lock +1167 -1770
  13. package/ios/FreeraspReactNative.swift +23 -18
  14. package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
  15. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  16. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  17. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +93 -93
  18. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  19. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  20. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  21. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
  22. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
  23. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  24. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  25. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  26. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +214 -77
  27. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -0
  28. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  29. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +1 -0
  30. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  31. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/cacert.pem +909 -464
  32. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  33. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  34. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
  35. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
  36. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  37. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  38. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  39. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +214 -77
  40. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -0
  41. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  42. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  43. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +214 -77
  44. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -0
  45. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  46. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -0
  47. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  48. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +35 -35
  49. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/cacert.pem +909 -464
  50. package/lib/commonjs/definitions.js +3 -1
  51. package/lib/commonjs/definitions.js.map +1 -1
  52. package/lib/commonjs/index.js +7 -1
  53. package/lib/commonjs/index.js.map +1 -1
  54. package/lib/module/definitions.js +3 -1
  55. package/lib/module/definitions.js.map +1 -1
  56. package/lib/module/index.js +7 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/typescript/plugin/src/index.d.ts +1 -1
  59. package/lib/typescript/plugin/src/index.d.ts.map +1 -1
  60. package/lib/typescript/src/definitions.d.ts +4 -0
  61. package/lib/typescript/src/definitions.d.ts.map +1 -1
  62. package/lib/typescript/src/index.d.ts +1 -1
  63. package/lib/typescript/src/index.d.ts.map +1 -1
  64. package/package.json +8 -17
  65. package/plugin/build/index.d.ts +1 -1
  66. package/src/definitions.ts +7 -0
  67. package/src/index.tsx +8 -2
@@ -5,10 +5,9 @@ import TalsecRuntime
5
5
  class FreeraspReactNative: RCTEventEmitter {
6
6
 
7
7
  public static var shared:FreeraspReactNative?
8
-
8
+
9
9
  let threatChannelKey = String(Int.random(in: 100_000..<999_999_999)) // key of the argument map under which threats are expected
10
10
  let threatChannelName = String(Int.random(in: 100_000..<999_999_999)) // name of the channel over which threat callbacks are sent
11
- let threatIdentifierList = (1...12).map { _ in Int.random(in: 100_000..<999_999_999) }
12
11
 
13
12
  override init() {
14
13
  super.init()
@@ -45,7 +44,7 @@ class FreeraspReactNative: RCTEventEmitter {
45
44
  let config = TalsecConfig(appBundleIds: [appBundleIds], appTeamId: appTeamId, watcherMailAddress: watcherMailAddress, isProd: isProd)
46
45
  Talsec.start(config: config)
47
46
  }
48
-
47
+
49
48
  /**
50
49
  * Method to setup the message passing between native and React Native
51
50
  */
@@ -53,11 +52,11 @@ class FreeraspReactNative: RCTEventEmitter {
53
52
  private func getThreatChannelData(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
54
53
  resolve([threatChannelName, threatChannelKey])
55
54
  }
56
-
55
+
57
56
  func dispatchEvent(securityThreat: SecurityThreat) -> Void {
58
57
  FreeraspReactNative.shared!.sendEvent(withName: threatChannelName, body: [threatChannelKey: securityThreat.callbackIdentifier])
59
58
  }
60
-
59
+
61
60
  /**
62
61
  * Method to get the random identifiers of callbacks
63
62
  */
@@ -65,7 +64,7 @@ class FreeraspReactNative: RCTEventEmitter {
65
64
  private func getThreatIdentifiers(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
66
65
  resolve(getThreatIdentifiers())
67
66
  }
68
-
67
+
69
68
  /**
70
69
  * We never send an invalid callback over our channel.
71
70
  * Therefore, if this happens, we want to kill the app.
@@ -74,7 +73,7 @@ class FreeraspReactNative: RCTEventEmitter {
74
73
  private func onInvalidCallback() -> Void {
75
74
  abort()
76
75
  }
77
-
76
+
78
77
  private func getThreatIdentifiers() -> [Int] {
79
78
  return SecurityThreat.allCases
80
79
  .filter {
@@ -90,33 +89,39 @@ class FreeraspReactNative: RCTEventEmitter {
90
89
  }
91
90
  }
92
91
 
92
+ struct ThreatIdentifiers {
93
+ static let threatIdentifierList: [Int] = (1...12).map { _ in Int.random(in: 100_000..<999_999_999) }
94
+ }
95
+
93
96
  /// An extension to unify callback names with RN ones.
94
97
  extension SecurityThreat {
95
98
 
96
99
  var callbackIdentifier: Int {
97
100
  switch self {
98
101
  case .signature:
99
- return FreeraspReactNative.shared!.threatIdentifierList[0]
102
+ return ThreatIdentifiers.threatIdentifierList[0]
100
103
  case .jailbreak:
101
- return FreeraspReactNative.shared!.threatIdentifierList[1]
104
+ return ThreatIdentifiers.threatIdentifierList[1]
102
105
  case .debugger:
103
- return FreeraspReactNative.shared!.threatIdentifierList[2]
106
+ return ThreatIdentifiers.threatIdentifierList[2]
104
107
  case .runtimeManipulation:
105
- return FreeraspReactNative.shared!.threatIdentifierList[3]
108
+ return ThreatIdentifiers.threatIdentifierList[3]
106
109
  case .passcode:
107
- return FreeraspReactNative.shared!.threatIdentifierList[4]
110
+ return ThreatIdentifiers.threatIdentifierList[4]
108
111
  case .passcodeChange:
109
- return FreeraspReactNative.shared!.threatIdentifierList[5]
112
+ return ThreatIdentifiers.threatIdentifierList[5]
110
113
  case .simulator:
111
- return FreeraspReactNative.shared!.threatIdentifierList[6]
114
+ return ThreatIdentifiers.threatIdentifierList[6]
112
115
  case .missingSecureEnclave:
113
- return FreeraspReactNative.shared!.threatIdentifierList[7]
116
+ return ThreatIdentifiers.threatIdentifierList[7]
117
+ case .systemVPN:
118
+ return ThreatIdentifiers.threatIdentifierList[8]
114
119
  case .deviceChange:
115
- return FreeraspReactNative.shared!.threatIdentifierList[8]
120
+ return ThreatIdentifiers.threatIdentifierList[9]
116
121
  case .deviceID:
117
- return FreeraspReactNative.shared!.threatIdentifierList[9]
122
+ return ThreatIdentifiers.threatIdentifierList[10]
118
123
  case .unofficialStore:
119
- return FreeraspReactNative.shared!.threatIdentifierList[10]
124
+ return ThreatIdentifiers.threatIdentifierList[11]
120
125
  @unknown default:
121
126
  abort()
122
127
  }
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_x86_64-simulator</string>
9
+ <string>ios-arm64</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>TalsecRuntime.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>x86_64</string>
16
15
  </array>
17
16
  <key>SupportedPlatform</key>
18
17
  <string>ios</string>
19
- <key>SupportedPlatformVariant</key>
20
- <string>simulator</string>
21
18
  </dict>
22
19
  <dict>
23
20
  <key>LibraryIdentifier</key>
24
- <string>ios-arm64</string>
21
+ <string>ios-arm64_x86_64-simulator</string>
25
22
  <key>LibraryPath</key>
26
23
  <string>TalsecRuntime.framework</string>
27
24
  <key>SupportedArchitectures</key>
28
25
  <array>
29
26
  <string>arm64</string>
27
+ <string>x86_64</string>
30
28
  </array>
31
29
  <key>SupportedPlatform</key>
32
30
  <string>ios</string>
31
+ <key>SupportedPlatformVariant</key>
32
+ <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>