freerasp-react-native 4.5.2 → 5.1.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 (71) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +12 -10
  4. package/android/src/main/java/com/freeraspreactnative/events/RaspExecutionStateEvent.kt +3 -5
  5. package/android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt +23 -25
  6. package/android/src/main/java/com/freeraspreactnative/models/RNSuspiciousAppInfo.kt +1 -1
  7. package/android/src/main/java/com/freeraspreactnative/utils/Extensions.kt +22 -2
  8. package/freerasp-react-native.podspec +31 -8
  9. package/freerasp_spm.rb +88 -0
  10. package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
  11. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  12. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +42 -42
  13. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  14. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  15. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  16. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
  17. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
  18. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  19. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  20. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  21. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +345 -289
  22. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  23. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/_CodeSignature/CodeResources +15 -15
  24. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  25. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  26. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
  27. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
  28. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  29. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  30. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  31. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +279 -223
  32. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +279 -223
  33. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  34. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +17 -17
  35. package/ios/TalsecRuntimePackage/Package.swift +19 -0
  36. package/lib/commonjs/api/methods/native.js +2 -1
  37. package/lib/commonjs/api/methods/native.js.map +1 -1
  38. package/lib/commonjs/utils/config.js +31 -0
  39. package/lib/commonjs/utils/config.js.map +1 -0
  40. package/lib/commonjs/utils/malware.js +1 -1
  41. package/lib/commonjs/utils/malware.js.map +1 -1
  42. package/lib/module/api/methods/native.js +2 -1
  43. package/lib/module/api/methods/native.js.map +1 -1
  44. package/lib/module/utils/config.js +23 -0
  45. package/lib/module/utils/config.js.map +1 -0
  46. package/lib/module/utils/malware.js +1 -1
  47. package/lib/module/utils/malware.js.map +1 -1
  48. package/lib/typescript/plugin/src/index.d.ts.map +1 -1
  49. package/lib/typescript/plugin/src/iosSpm.d.ts +8 -0
  50. package/lib/typescript/plugin/src/iosSpm.d.ts.map +1 -0
  51. package/lib/typescript/plugin/src/iosSpmProperties.d.ts +3 -0
  52. package/lib/typescript/plugin/src/iosSpmProperties.d.ts.map +1 -0
  53. package/lib/typescript/plugin/src/pluginConfig.d.ts +8 -0
  54. package/lib/typescript/plugin/src/pluginConfig.d.ts.map +1 -1
  55. package/lib/typescript/src/api/methods/native.d.ts.map +1 -1
  56. package/lib/typescript/src/types/types.d.ts +16 -8
  57. package/lib/typescript/src/types/types.d.ts.map +1 -1
  58. package/lib/typescript/src/utils/config.d.ts +4 -0
  59. package/lib/typescript/src/utils/config.d.ts.map +1 -0
  60. package/package.json +2 -1
  61. package/plugin/build/index.js +38 -0
  62. package/plugin/build/iosSpm.d.ts +7 -0
  63. package/plugin/build/iosSpm.js +136 -0
  64. package/plugin/build/iosSpmProperties.d.ts +2 -0
  65. package/plugin/build/iosSpmProperties.js +29 -0
  66. package/plugin/build/pluginConfig.d.ts +8 -0
  67. package/plugin/tests/iosSpm.test.js +126 -0
  68. package/src/api/methods/native.ts +2 -1
  69. package/src/types/types.ts +25 -9
  70. package/src/utils/config.ts +42 -0
  71. package/src/utils/malware.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,70 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.1.0]
9
+
10
+ - Android SDK version: 18.3.0
11
+ - iOS SDK version: 7.1.0
12
+
13
+ ### React Native
14
+
15
+ #### Fixed
16
+
17
+ - Fixed identifier retrieval after React Native context reinitialization ([#152](https://github.com/talsec/Free-RASP-ReactNative/issues/152)).
18
+
19
+ #### Added
20
+
21
+ - Added Swift Package Manager delivery of `TalsecRuntime`, enabled by default for Expo projects and available as an opt-in for bare React Native 0.75 or newer projects.
22
+ - Added the Expo config plugin option `ios.useSpm`; set it to `false` to use the vendored XCFramework fallback.
23
+
24
+ ### iOS
25
+
26
+ #### Added
27
+
28
+ - Added support for postponed checks, therefore, due to slower execution, some subchecks are run after initial startup checks.
29
+ - Improved hook detection.
30
+
31
+ #### Fixed
32
+
33
+ - Fixed issue with app's color scheme initialization.
34
+ - Fixed bad memory access in jaibreak check.
35
+
36
+ ## [5.0.0] - 2026-05-15
37
+
38
+ - Android SDK version: 18.3.0
39
+ - iOS SDK version: 6.14.4
40
+
41
+ ### Breaking
42
+
43
+ - `SuspiciousAppInfo.reason` (String) renamed to `reasons` (string[])
44
+ - Value `"blacklist"` in `reasons` renamed to `"blocklist"`
45
+ - Removed `MalwareConfig` and `AndroidConfig.malwareConfig`
46
+
47
+ ### React Native
48
+
49
+ #### Removed
50
+
51
+ - `TalsecMalwareConfig` type and `TalsecAndroidConfig.malwareConfig` field
52
+
53
+ ### Android
54
+
55
+ #### Added
56
+
57
+ - New API class `SuspiciousAppDetectionConfig` that can be used to configure malware detection
58
+ - New API for malware detection configuration in `TalsecConfig`, see `TalsecConfig.Builder#suspiciousAppDetection`
59
+
60
+ #### Fixed
61
+
62
+ - Fixed `VerifyError` caused by `JaCoCo` bytecode instrumentation
63
+ - Fixed a potential cause of crash in the multi-instance detector
64
+ - Fixed Java interoperability of `ScreenProtector` methods
65
+ - Fixed Kotlin classpath conflicts in SDK dependency resolution (Kotlin 2.0.0)
66
+
67
+ #### Changed
68
+
69
+ - Fine-tuned location spoofing detection
70
+ - Modified malware incident log structure for better aggregation
71
+
8
72
  ## [4.5.2] - 2026-03-24
9
73
 
10
74
  - Android SDK version: 18.0.4
@@ -105,7 +105,7 @@ dependencies {
105
105
  implementation "com.facebook.react:react-native:$react_native_version"
106
106
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
107
107
  implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
108
- implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:18.0.4"
108
+ implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:18.3.0"
109
109
  }
110
110
 
111
111
  if (isNewArchitectureEnabled()) {
@@ -33,6 +33,7 @@ import com.freeraspreactnative.utils.getMapThrowing
33
33
  import com.freeraspreactnative.utils.getNestedArraySafe
34
34
  import com.freeraspreactnative.utils.getStringThrowing
35
35
  import com.freeraspreactnative.utils.toEncodedWritableArray
36
+ import com.freeraspreactnative.utils.toSuspiciousAppDetectionConfig
36
37
 
37
38
  class FreeraspReactNativeModule(private val reactContext: ReactApplicationContext) :
38
39
  ReactContextBaseJavaModule(reactContext) {
@@ -107,8 +108,8 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex
107
108
 
108
109
  // Trigger lazy initialization of the freeRASP events
109
110
  private fun initializeEventKeys() {
110
- ThreatEvent.ALL_EVENTS
111
- RaspExecutionStateEvent.ALL_EVENTS
111
+ ThreatEvent.ALL_EVENT_IDENTIFIERS
112
+ RaspExecutionStateEvent.ALL_EVENT_IDENTIFIERS
112
113
  }
113
114
 
114
115
  /**
@@ -116,7 +117,9 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex
116
117
  */
117
118
  @ReactMethod
118
119
  fun getThreatIdentifiers(promise: Promise) {
119
- promise.resolve(ThreatEvent.ALL_EVENTS)
120
+ promise.resolve(
121
+ Arguments.fromList(ThreatEvent.ALL_EVENT_IDENTIFIERS)
122
+ )
120
123
  }
121
124
 
122
125
  /**
@@ -124,7 +127,9 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex
124
127
  */
125
128
  @ReactMethod
126
129
  fun getRaspExecutionStateIdentifiers(promise: Promise) {
127
- promise.resolve(RaspExecutionStateEvent.ALL_EVENTS)
130
+ promise.resolve(
131
+ Arguments.fromList(RaspExecutionStateEvent.ALL_EVENT_IDENTIFIERS)
132
+ )
128
133
  }
129
134
 
130
135
  /**
@@ -298,12 +303,9 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex
298
303
  .killOnBypass(config.getBooleanSafe("killOnBypass", false))
299
304
  .supportedAlternativeStores(androidConfig.getArraySafe("supportedAlternativeStores"))
300
305
 
301
- if (androidConfig.hasKey("malwareConfig")) {
302
- val malwareConfig = androidConfig.getMapThrowing("malwareConfig")
303
- talsecBuilder.whitelistedInstallationSources(malwareConfig.getArraySafe("whitelistedInstallationSources"))
304
- talsecBuilder.blacklistedHashes(malwareConfig.getArraySafe("blacklistedHashes"))
305
- talsecBuilder.blacklistedPackageNames(malwareConfig.getArraySafe("blacklistedPackageNames"))
306
- talsecBuilder.suspiciousPermissions(malwareConfig.getNestedArraySafe("suspiciousPermissions"))
306
+ if (androidConfig.hasKey("suspiciousAppDetectionConfig")) {
307
+ val suspiciousAppConfig = androidConfig.getMapThrowing("suspiciousAppDetectionConfig")
308
+ talsecBuilder.suspiciousAppDetection(suspiciousAppConfig.toSuspiciousAppDetectionConfig())
307
309
  }
308
310
 
309
311
  return talsecBuilder.build()
@@ -1,6 +1,5 @@
1
1
  package com.freeraspreactnative.events
2
2
 
3
- import com.facebook.react.bridge.Arguments
4
3
  import com.freeraspreactnative.utils.RandomGenerator
5
4
 
6
5
  internal sealed class RaspExecutionStateEvent(override val value: Int) : BaseRaspEvent {
@@ -12,9 +11,8 @@ internal sealed class RaspExecutionStateEvent(override val value: Int) : BaseRas
12
11
  companion object Companion {
13
12
  internal val CHANNEL_NAME = RandomGenerator.next().toString()
14
13
  internal val CHANNEL_KEY = RandomGenerator.next().toString()
15
- internal val ALL_EVENTS = Arguments.fromList(
16
- listOf(
17
- AllChecksFinished
18
- ).map { it.value })
14
+ internal val ALL_EVENT_IDENTIFIERS = listOf(
15
+ AllChecksFinished
16
+ ).map { it.value }
19
17
  }
20
18
  }
@@ -1,6 +1,5 @@
1
1
  package com.freeraspreactnative.events
2
2
 
3
- import com.facebook.react.bridge.Arguments
4
3
  import com.freeraspreactnative.utils.RandomGenerator
5
4
 
6
5
  /**
@@ -41,29 +40,28 @@ internal sealed class ThreatEvent(override val value: Int) : BaseRaspEvent {
41
40
  internal val CHANNEL_KEY = RandomGenerator.next().toString()
42
41
  internal val MALWARE_CHANNEL_KEY = RandomGenerator.next().toString()
43
42
 
44
- internal val ALL_EVENTS = Arguments.fromList(
45
- listOf(
46
- AppIntegrity,
47
- PrivilegedAccess,
48
- Debug,
49
- Hooks,
50
- Passcode,
51
- Simulator,
52
- SecureHardwareNotAvailable,
53
- SystemVPN,
54
- DeviceBinding,
55
- UnofficialStore,
56
- ObfuscationIssues,
57
- DevMode,
58
- Malware,
59
- ADBEnabled,
60
- Screenshot,
61
- ScreenRecording,
62
- MultiInstance,
63
- TimeSpoofing,
64
- LocationSpoofing,
65
- UnsecureWifi,
66
- Automation
67
- ).map { it.value })
43
+ internal val ALL_EVENT_IDENTIFIERS = listOf(
44
+ AppIntegrity,
45
+ PrivilegedAccess,
46
+ Debug,
47
+ Hooks,
48
+ Passcode,
49
+ Simulator,
50
+ SecureHardwareNotAvailable,
51
+ SystemVPN,
52
+ DeviceBinding,
53
+ UnofficialStore,
54
+ ObfuscationIssues,
55
+ DevMode,
56
+ Malware,
57
+ ADBEnabled,
58
+ Screenshot,
59
+ ScreenRecording,
60
+ MultiInstance,
61
+ TimeSpoofing,
62
+ LocationSpoofing,
63
+ UnsecureWifi,
64
+ Automation
65
+ ).map { it.value }
68
66
  }
69
67
  }
@@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable
9
9
  @Serializable
10
10
  data class RNSuspiciousAppInfo(
11
11
  val packageInfo: RNPackageInfo,
12
- val reason: String,
12
+ val reasons: Set<String>,
13
13
  val permissions: Set<String>?
14
14
  )
15
15
 
@@ -3,6 +3,10 @@ package com.freeraspreactnative.utils
3
3
  import android.content.pm.PackageInfo
4
4
  import android.util.Base64
5
5
  import android.util.Log
6
+ import com.aheaditec.talsec_security.security.api.MalwareScanScope
7
+ import com.aheaditec.talsec_security.security.api.ReasonMode
8
+ import com.aheaditec.talsec_security.security.api.ScopeType
9
+ import com.aheaditec.talsec_security.security.api.SuspiciousAppDetectionConfig
6
10
  import com.aheaditec.talsec_security.security.api.SuspiciousAppInfo
7
11
  import com.facebook.react.bridge.Arguments
8
12
  import com.facebook.react.bridge.ReactContext
@@ -32,7 +36,7 @@ internal fun ReadableMap.getBooleanSafe(key: String, defaultValue: Boolean = tru
32
36
  return defaultValue
33
37
  }
34
38
 
35
- private inline fun <reified T> ReadableArray.toPrimitiveArray(): Array<T> {
39
+ internal inline fun <reified T> ReadableArray.toPrimitiveArray(): Array<T> {
36
40
  val output = mutableListOf<T>()
37
41
 
38
42
  for (i in 0 until this.size()) {
@@ -74,7 +78,7 @@ internal fun ReadableMap.getNestedArraySafe(key: String): Array<Array<String>> {
74
78
  internal fun SuspiciousAppInfo.toRNSuspiciousAppInfo(context: ReactContext): RNSuspiciousAppInfo {
75
79
  return RNSuspiciousAppInfo(
76
80
  packageInfo = this.packageInfo.toRNPackageInfo(context),
77
- reason = this.reason,
81
+ reasons = this.reasons,
78
82
  permissions = this.permissions
79
83
  )
80
84
  }
@@ -92,6 +96,22 @@ internal fun PackageInfo.toRNPackageInfo(context: ReactContext): RNPackageInfo {
92
96
  )
93
97
  }
94
98
 
99
+ internal fun ReadableMap.toScanScope(): MalwareScanScope {
100
+ val scopeType = ScopeType.valueOf(getStringThrowing("scopeType"))
101
+ val trustedInstallSources = getArraySafe("trustedInstallSources").toList().ifEmpty { null }
102
+ return MalwareScanScope(scopeType, trustedInstallSources)
103
+ }
104
+
105
+ internal fun ReadableMap.toSuspiciousAppDetectionConfig(): SuspiciousAppDetectionConfig {
106
+ val packageNames = getArraySafe("packageNames").toSet().ifEmpty { null }
107
+ val hashes = getArraySafe("hashes").toSet().ifEmpty { null }
108
+ val requestedPermissions = getNestedArraySafe("requestedPermissions").map { it.toSet() }.toSet().ifEmpty { null }
109
+ val grantedPermissions = getNestedArraySafe("grantedPermissions").map { it.toSet() }.toSet().ifEmpty { null }
110
+ val scanScope = getMapThrowing("scanScope").toScanScope()
111
+ val reasonMode = ReasonMode.valueOf(getStringThrowing("reasonMode"))
112
+ return SuspiciousAppDetectionConfig(packageNames, hashes, requestedPermissions, grantedPermissions, scanScope, reasonMode)
113
+ }
114
+
95
115
  /**
96
116
  * Convert the Talsec's SuspiciousAppInfo to base64-encoded json array,
97
117
  * which can be then sent to React Native
@@ -3,6 +3,8 @@ require "json"
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
5
 
6
+ talsec_spm_path = File.expand_path('ios/TalsecRuntimePackage', __dir__)
7
+
6
8
  Pod::Spec.new do |s|
7
9
  s.name = "freerasp-react-native"
8
10
  s.version = package["version"]
@@ -14,14 +16,35 @@ Pod::Spec.new do |s|
14
16
  s.platforms = { :ios => "11.0" }
15
17
  s.source = { :git => "https://github.com/talsec/freerasp-react-native.git", :tag => "#{s.version}" }
16
18
 
17
- s.source_files = 'ios/models/*.{h,m,mm,swift}',
18
- 'ios/utils/*.{h,m,mm,swift}',
19
- 'ios/dispatchers/*.{h,m,mm,swift}',
20
- 'ios/*.{h,m,mm,swift}',
21
- 'ios/TalsecRuntime.xcframework'
22
- s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
23
- s.ios.vendored_frameworks = "ios/TalsecRuntime.xcframework"
24
-
19
+ spm_requested = ENV['FREERASP_USE_SPM'] == '1'
20
+ use_spm = spm_requested && respond_to?(:spm_dependency, true)
21
+
22
+ if spm_requested && !respond_to?(:spm_dependency, true)
23
+ Pod::UI.warn '[freeRASP][SPM] React Native does not provide spm_dependency; using the vendored TalsecRuntime framework.'
24
+ end
25
+
26
+ source_globs = [
27
+ 'ios/models/*.{h,m,mm,swift}',
28
+ 'ios/utils/*.{h,m,mm,swift}',
29
+ 'ios/dispatchers/*.{h,m,mm,swift}',
30
+ 'ios/*.{h,m,mm,swift}',
31
+ ]
32
+
33
+ if use_spm
34
+ s.ios.deployment_target = '13.0'
35
+ spm_dependency(s,
36
+ url: talsec_spm_path,
37
+ requirement: {},
38
+ products: ['TalsecRuntime']
39
+ )
40
+ else
41
+ source_globs << 'ios/TalsecRuntime.xcframework'
42
+ s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
43
+ s.ios.vendored_frameworks = 'ios/TalsecRuntime.xcframework'
44
+ end
45
+
46
+ s.source_files = source_globs
47
+
25
48
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
26
49
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
27
50
  if respond_to?(:install_modules_dependencies, true)
@@ -0,0 +1,88 @@
1
+ # Links and embeds the local TalsecRuntime Swift package.
2
+
3
+ def freerasp_embed_talsec_spm!(installer,
4
+ package_path: File.expand_path('ios/TalsecRuntimePackage', __dir__),
5
+ product: 'TalsecRuntime')
6
+
7
+ package_path = File.expand_path(package_path)
8
+ local_pkg_class = Xcodeproj::Project::Object::XCLocalSwiftPackageReference
9
+ remote_pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
10
+ ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
11
+
12
+ spm_active = ENV['FREERASP_USE_SPM'] == '1' &&
13
+ respond_to?(:spm_dependency, true)
14
+
15
+ if spm_active && !File.file?(File.join(package_path, 'Package.swift'))
16
+ raise Pod::Informative, "[freeRASP][SPM] Package.swift not found at #{package_path}"
17
+ end
18
+
19
+ projects_and_targets = {}
20
+ pods_project = installer.pods_project
21
+ projects_and_targets[pods_project] = pods_project.targets.select do |target|
22
+ target.name == 'freerasp-react-native'
23
+ end
24
+
25
+ installer.aggregate_targets.each do |aggregate_target|
26
+ project = aggregate_target.user_project
27
+ next if project.nil?
28
+
29
+ app_targets = aggregate_target.user_targets.select do |t|
30
+ t.respond_to?(:product_type) && t.product_type == 'com.apple.product-type.application'
31
+ end
32
+ projects_and_targets[project] ||= []
33
+ projects_and_targets[project].concat(app_targets)
34
+ end
35
+
36
+ new_object = lambda do |project, klass|
37
+ uuid = project.generate_uuid
38
+ uuid = project.generate_uuid while project.objects_by_uuid.key?(uuid)
39
+ object = klass.new(project, uuid)
40
+ object.initialize_defaults
41
+ object
42
+ end
43
+
44
+ projects_and_targets.each do |project, targets|
45
+ targets.uniq!
46
+
47
+ # Remove existing references before recreating them.
48
+ owned_packages = []
49
+ targets.each do |target|
50
+ target.package_product_dependencies.select do |reference|
51
+ reference.class == ref_class && reference.product_name == product
52
+ end.each do |reference|
53
+ owned_packages << reference.package unless reference.package.nil?
54
+ reference.remove_from_project
55
+ end
56
+ end
57
+ project.root_object.package_references.each do |package|
58
+ reference_path =
59
+ if package.class == local_pkg_class
60
+ package.relative_path
61
+ elsif package.class == remote_pkg_class
62
+ package.repositoryURL
63
+ end
64
+ next if reference_path.nil?
65
+
66
+ owned_packages << package if File.basename(reference_path) == 'TalsecRuntimePackage'
67
+ end
68
+ owned_packages.uniq.each do |package|
69
+ package.remove_from_project
70
+ end
71
+
72
+ if spm_active
73
+ pkg = new_object.call(project, local_pkg_class)
74
+ pkg.relative_path = package_path
75
+ project.root_object.package_references << pkg
76
+
77
+ targets.each do |target|
78
+ Pod::UI.puts "[freeRASP][SPM] Linking #{product} to target #{target.name}"
79
+ dep = new_object.call(project, ref_class)
80
+ dep.package = pkg
81
+ dep.product_name = product
82
+ target.package_product_dependencies << dep
83
+ end
84
+ end
85
+
86
+ project.save
87
+ end
88
+ end
@@ -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_x86_64-simulator</string>
11
+ <string>ios-arm64</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>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>TalsecRuntime.framework/TalsecRuntime</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>TalsecRuntime.framework</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>