Skip to content

Commit 4eb646d

Browse files
committed
feat(Android): add vpn and dev mode detection
1 parent 1c39d39 commit 4eb646d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ dependencies {
8686
//noinspection GradleDynamicVersion
8787
implementation "com.facebook.react:react-native:$react_native_version"
8888
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
89-
implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:9.1.0"
89+
implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:9.6.0"
9090
}
9191

9292
if (isNewArchitectureEnabled()) {

android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ internal object FreeraspThreatHandler : ThreatListener.ThreatDetected, ThreatLis
4646
listener?.threatDetected(Threat.SecureHardwareNotAvailable)
4747
}
4848

49+
override fun onDeveloperModeDetected() {
50+
listener?.threatDetected(Threat.DevMode)
51+
}
52+
53+
override fun onSystemVPNDetected() {
54+
listener?.threatDetected(Threat.SystemVPN)
55+
}
56+
4957
internal interface TalsecReactNative {
5058
fun threatDetected(threatType: Threat)
5159
}

android/src/main/java/com/freeraspreactnative/Threat.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal sealed class Threat(val value: Int) {
2121
object DeviceBinding : Threat((10000..999999999).random())
2222
object UnofficialStore : Threat((10000..999999999).random())
2323
object ObfuscationIssues : Threat((10000..999999999).random())
24+
object SystemVPN : Threat((10000..999999999).random())
25+
object DevMode : Threat((10000..999999999).random())
2426

2527
companion object {
2628
internal fun getThreatValues(): WritableArray {
@@ -33,12 +35,13 @@ internal sealed class Threat(val value: Int) {
3335
Passcode.value,
3436
Simulator.value,
3537
SecureHardwareNotAvailable.value,
38+
SystemVPN.value,
3639
DeviceBinding.value,
3740
UnofficialStore.value,
38-
ObfuscationIssues.value
41+
ObfuscationIssues.value,
42+
DevMode.value
3943
)
4044
)
41-
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)