freerasp-react-native 4.3.2 → 4.5.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.
- package/CHANGELOG.md +99 -1
- package/android/build.gradle +8 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +87 -43
- package/android/src/main/java/com/freeraspreactnative/PluginThreatHandler.kt +126 -0
- package/android/src/main/java/com/freeraspreactnative/dispatchers/ExecutionStateDispatcher.kt +53 -0
- package/android/src/main/java/com/freeraspreactnative/dispatchers/ThreatDispatcher.kt +75 -0
- package/android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt +3 -1
- package/android/src/main/java/com/freeraspreactnative/interfaces/PluginExecutionStateListener.kt +7 -0
- package/android/src/main/java/com/freeraspreactnative/interfaces/PluginThreatListener.kt +9 -0
- package/example/src/App.tsx +11 -1
- package/example/src/DemoApp.tsx +32 -0
- package/example/src/checks.ts +2 -1
- package/freerasp-react-native.podspec +5 -1
- package/ios/FreeraspReactNative.m +5 -0
- package/ios/FreeraspReactNative.swift +39 -10
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +82 -288
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +7 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +474 -547
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/PrivacyInfo.xcprivacy +8 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +14 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +475 -548
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +475 -548
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +6 -3
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/PrivacyInfo.xcprivacy +8 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +46 -35
- package/ios/dispatchers/ExecutionStateDispatcher.swift +35 -0
- package/ios/dispatchers/ThreatDispatcher.swift +36 -0
- package/ios/models/SecurityThreat.swift +2 -0
- package/ios/utils/EventIdentifiers.swift +2 -2
- package/lib/commonjs/api/listeners/raspExecutionState.js +28 -8
- package/lib/commonjs/api/listeners/raspExecutionState.js.map +1 -1
- package/lib/commonjs/api/listeners/threat.js +34 -10
- package/lib/commonjs/api/listeners/threat.js.map +1 -1
- package/lib/commonjs/api/methods/native.js +9 -1
- package/lib/commonjs/api/methods/native.js.map +1 -1
- package/lib/commonjs/api/methods/reactNative.js +13 -8
- package/lib/commonjs/api/methods/reactNative.js.map +1 -1
- package/lib/commonjs/channels/threat.js +1 -3
- package/lib/commonjs/channels/threat.js.map +1 -1
- package/lib/commonjs/models/threat.js +2 -1
- package/lib/commonjs/models/threat.js.map +1 -1
- package/lib/module/api/listeners/raspExecutionState.js +29 -9
- package/lib/module/api/listeners/raspExecutionState.js.map +1 -1
- package/lib/module/api/listeners/threat.js +35 -11
- package/lib/module/api/listeners/threat.js.map +1 -1
- package/lib/module/api/methods/native.js +6 -0
- package/lib/module/api/methods/native.js.map +1 -1
- package/lib/module/api/methods/reactNative.js +13 -7
- package/lib/module/api/methods/reactNative.js.map +1 -1
- package/lib/module/channels/threat.js +1 -3
- package/lib/module/channels/threat.js.map +1 -1
- package/lib/module/models/threat.js +2 -1
- package/lib/module/models/threat.js.map +1 -1
- package/lib/typescript/src/api/listeners/raspExecutionState.d.ts +1 -1
- package/lib/typescript/src/api/listeners/raspExecutionState.d.ts.map +1 -1
- package/lib/typescript/src/api/listeners/threat.d.ts +1 -1
- package/lib/typescript/src/api/listeners/threat.d.ts.map +1 -1
- package/lib/typescript/src/api/methods/native.d.ts +2 -0
- package/lib/typescript/src/api/methods/native.d.ts.map +1 -1
- package/lib/typescript/src/api/methods/reactNative.d.ts.map +1 -1
- package/lib/typescript/src/channels/threat.d.ts.map +1 -1
- package/lib/typescript/src/models/threat.d.ts +1 -0
- package/lib/typescript/src/models/threat.d.ts.map +1 -1
- package/lib/typescript/src/types/types.d.ts +1 -0
- package/lib/typescript/src/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/listeners/raspExecutionState.ts +39 -11
- package/src/api/listeners/threat.ts +41 -10
- package/src/api/methods/native.ts +8 -0
- package/src/api/methods/reactNative.ts +17 -8
- package/src/channels/threat.ts +1 -3
- package/src/models/threat.ts +3 -0
- package/src/types/types.ts +1 -0
- package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +0 -103
- package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
package/example/src/DemoApp.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
blockScreenCapture,
|
|
22
22
|
type SuspiciousAppInfo,
|
|
23
23
|
storeExternalId,
|
|
24
|
+
removeExternalId,
|
|
24
25
|
} from 'freerasp-react-native';
|
|
25
26
|
import {
|
|
26
27
|
ALERT_TYPE,
|
|
@@ -84,6 +85,24 @@ export const DemoApp: React.FC<{
|
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
const handleModalRemove = async () => {
|
|
89
|
+
setModalVisible(false);
|
|
90
|
+
try {
|
|
91
|
+
await removeExternalId();
|
|
92
|
+
Toast.show({
|
|
93
|
+
type: ALERT_TYPE.SUCCESS,
|
|
94
|
+
title: 'Success',
|
|
95
|
+
textBody: 'External ID removed',
|
|
96
|
+
});
|
|
97
|
+
} catch (error: any) {
|
|
98
|
+
Toast.show({
|
|
99
|
+
type: ALERT_TYPE.WARNING,
|
|
100
|
+
title: 'Warning',
|
|
101
|
+
textBody: 'External ID not removed',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
87
106
|
const handleModalDismiss = () => {
|
|
88
107
|
setModalVisible(false);
|
|
89
108
|
};
|
|
@@ -140,6 +159,11 @@ export const DemoApp: React.FC<{
|
|
|
140
159
|
onPress={handleModalSend}>
|
|
141
160
|
<Text style={styles.modalText}>Send</Text>
|
|
142
161
|
</TouchableOpacity>
|
|
162
|
+
<TouchableOpacity
|
|
163
|
+
style={styles.removeButton}
|
|
164
|
+
onPress={handleModalRemove}>
|
|
165
|
+
<Text style={styles.modalText}>Remove</Text>
|
|
166
|
+
</TouchableOpacity>
|
|
143
167
|
<TouchableOpacity
|
|
144
168
|
style={styles.dismissButton}
|
|
145
169
|
onPress={handleModalDismiss}>
|
|
@@ -346,6 +370,14 @@ const styles = StyleSheet.create({
|
|
|
346
370
|
marginRight: 10,
|
|
347
371
|
alignItems: 'center',
|
|
348
372
|
},
|
|
373
|
+
removeButton: {
|
|
374
|
+
backgroundColor: '#FF9800',
|
|
375
|
+
padding: 10,
|
|
376
|
+
borderRadius: 5,
|
|
377
|
+
flex: 1,
|
|
378
|
+
marginRight: 10,
|
|
379
|
+
alignItems: 'center',
|
|
380
|
+
},
|
|
349
381
|
dismissButton: {
|
|
350
382
|
backgroundColor: '#f44336',
|
|
351
383
|
padding: 10,
|
package/example/src/checks.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const commonChecks = [
|
|
|
11
11
|
{ name: 'Unofficial Store', status: 'ok' },
|
|
12
12
|
{ name: 'Screenshot', status: 'ok' },
|
|
13
13
|
{ name: 'Screen Recording', status: 'ok' },
|
|
14
|
+
{ name: 'Time Spoofing', status: 'ok' },
|
|
14
15
|
];
|
|
15
16
|
|
|
16
17
|
export const iosChecks = [{ name: 'Device ID', status: 'ok' }];
|
|
@@ -21,7 +22,7 @@ export const androidChecks = [
|
|
|
21
22
|
{ name: 'Malware', status: 'ok' },
|
|
22
23
|
{ name: 'ADB Enabled', status: 'ok' },
|
|
23
24
|
{ name: 'Multi Instance', status: 'ok' },
|
|
24
|
-
{ name: 'Time Spoofing', status: 'ok' },
|
|
25
25
|
{ name: 'Location Spoofing', status: 'ok' },
|
|
26
26
|
{ name: 'Unsecure Wifi', status: 'ok' },
|
|
27
|
+
{ name: 'Automation', status: 'ok' },
|
|
27
28
|
];
|
|
@@ -14,7 +14,11 @@ 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/models/*.{h,m,mm,swift}',
|
|
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'
|
|
18
22
|
s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
|
|
19
23
|
s.ios.vendored_frameworks = "ios/TalsecRuntime.xcframework"
|
|
20
24
|
|
|
@@ -15,6 +15,9 @@ RCT_EXTERN_METHOD(getRaspExecutionStateChannelData:(RCTPromiseResolveBlock)resol
|
|
|
15
15
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
16
16
|
RCT_EXTERN_METHOD(getRaspExecutionStateIdentifiers:(RCTPromiseResolveBlock)resolve
|
|
17
17
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
18
|
+
RCT_EXTERN_METHOD(removeListenerForEvent:(NSString *)eventName
|
|
19
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
20
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
18
21
|
RCT_EXTERN_METHOD(blockScreenCapture:(BOOL)enable
|
|
19
22
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
20
23
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
@@ -23,6 +26,8 @@ RCT_EXTERN_METHOD(isScreenCaptureBlocked:(RCTPromiseResolveBlock)resolve
|
|
|
23
26
|
RCT_EXTERN_METHOD(storeExternalId:(NSString *)externalId
|
|
24
27
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
25
28
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
29
|
+
RCT_EXTERN_METHOD(removeExternalId:(RCTPromiseResolveBlock)resolve
|
|
30
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
26
31
|
RCT_EXTERN_METHOD(onInvalidCallback)
|
|
27
32
|
|
|
28
33
|
+ (BOOL)requiresMainQueueSetup
|
|
@@ -11,6 +11,30 @@ class FreeraspReactNative: RCTEventEmitter {
|
|
|
11
11
|
FreeraspReactNative.shared = self
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
@objc(addListener:)
|
|
15
|
+
override func addListener(_ eventName: String!) {
|
|
16
|
+
super.addListener(eventName)
|
|
17
|
+
if eventName == EventIdentifiers.threatChannelName {
|
|
18
|
+
ThreatDispatcher.shared.listener = { [weak self] threat in
|
|
19
|
+
self?.dispatchThreatEvent(threat: threat)
|
|
20
|
+
}
|
|
21
|
+
} else if eventName == EventIdentifiers.raspExecutionStateChannelName {
|
|
22
|
+
ExecutionStateDispatcher.shared.listener = { [weak self] event in
|
|
23
|
+
self?.dispatchRaspExecutionStateEvent(event: event)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@objc(removeListenerForEvent:withResolver:withRejecter:)
|
|
29
|
+
func removeListenerForEvent(eventName: String, resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
30
|
+
if eventName == EventIdentifiers.threatChannelName {
|
|
31
|
+
ThreatDispatcher.shared.listener = nil
|
|
32
|
+
} else if eventName == EventIdentifiers.raspExecutionStateChannelName {
|
|
33
|
+
ExecutionStateDispatcher.shared.listener = nil
|
|
34
|
+
}
|
|
35
|
+
resolve("Listener unregistered")
|
|
36
|
+
}
|
|
37
|
+
|
|
14
38
|
@objc(talsecStart:withResolver:withRejecter:)
|
|
15
39
|
func talsecStart(options: NSDictionary, resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
16
40
|
do {
|
|
@@ -72,12 +96,18 @@ class FreeraspReactNative: RCTEventEmitter {
|
|
|
72
96
|
resolve("OK - Store external ID")
|
|
73
97
|
}
|
|
74
98
|
|
|
99
|
+
@objc(removeExternalId:withRejecter:)
|
|
100
|
+
private func removeExternalId(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
101
|
+
UserDefaults.standard.removeObject(forKey: "app.talsec.externalid")
|
|
102
|
+
resolve("OK - External ID removed")
|
|
103
|
+
}
|
|
104
|
+
|
|
75
105
|
/**
|
|
76
106
|
* Method to setup the message passing between native and React Native
|
|
77
107
|
*/
|
|
78
108
|
@objc(getThreatChannelData:withRejecter:)
|
|
79
109
|
private func getThreatChannelData(resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
80
|
-
resolve([EventIdentifiers.threatChannelName, EventIdentifiers.threatChannelKey])
|
|
110
|
+
resolve([EventIdentifiers.threatChannelName, EventIdentifiers.threatChannelKey, "0"])
|
|
81
111
|
}
|
|
82
112
|
|
|
83
113
|
/**
|
|
@@ -88,16 +118,16 @@ class FreeraspReactNative: RCTEventEmitter {
|
|
|
88
118
|
resolve([EventIdentifiers.raspExecutionStateChannelName, EventIdentifiers.raspExecutionStateChannelKey])
|
|
89
119
|
}
|
|
90
120
|
|
|
91
|
-
func
|
|
121
|
+
func dispatchThreatEvent(threat: SecurityThreat) {
|
|
92
122
|
FreeraspReactNative.shared!.sendEvent(withName: EventIdentifiers.threatChannelName, body: [
|
|
93
|
-
|
|
123
|
+
EventIdentifiers.threatChannelKey: threat.callbackIdentifier
|
|
94
124
|
])
|
|
95
125
|
}
|
|
96
126
|
|
|
97
|
-
func dispatchRaspExecutionStateEvent(event: RaspExecutionStates)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
func dispatchRaspExecutionStateEvent(event: RaspExecutionStates) {
|
|
128
|
+
FreeraspReactNative.shared!.sendEvent(withName: EventIdentifiers.raspExecutionStateChannelName, body: [
|
|
129
|
+
EventIdentifiers.raspExecutionStateChannelKey: event.callbackIdentifier,
|
|
130
|
+
])
|
|
101
131
|
}
|
|
102
132
|
|
|
103
133
|
/**
|
|
@@ -139,12 +169,11 @@ extension SecurityThreatCenter: @retroactive SecurityThreatHandler, @retroactive
|
|
|
139
169
|
if (securityThreat.rawValue == "passcodeChange") {
|
|
140
170
|
return
|
|
141
171
|
}
|
|
142
|
-
|
|
172
|
+
ThreatDispatcher.shared.dispatch(threat: securityThreat)
|
|
143
173
|
}
|
|
144
174
|
|
|
145
175
|
public func onAllChecksFinished() {
|
|
146
|
-
|
|
147
|
-
FreeraspReactNative.shared!.dispatchRaspExecutionStateEvent(event: RaspExecutionStates.allChecksFinished)
|
|
176
|
+
ExecutionStateDispatcher.shared.dispatch(event: RaspExecutionStates.allChecksFinished)
|
|
148
177
|
}
|
|
149
178
|
}
|
|
150
179
|
|
|
Binary file
|