Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "stable"
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ migrate_working_dir/
**/doc/api/
.dart_tool/
build/

# FVM Version Cache
.fvm/

# Android
.cxx
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ and ios. Please refer to readme to participate in native development
Please use the latest Flutter Version. Use the provided example project to test
or bug report any existing or new features.

Use Pigeon to update interfaces between flutter and native libraries:
`dart run pigeon --input lib/src/pigeon.dart`

## Submitting changes

Before submitting your changes as a pull request, please make sure to format
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
namespace = "com.example.flutter_security_toolkit"
}

compileSdk = 34
compileSdk = 35

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Autogenerated from Pigeon (v26.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")


import android.util.Log
import io.flutter.plugin.common.BasicMessageChannel
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MessageCodec
import io.flutter.plugin.common.StandardMethodCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
private object ThreatCenterApiPigeonUtils {

fun wrapResult(result: Any?): List<Any?> {
return listOf(result)
}

fun wrapError(exception: Throwable): List<Any?> {
return if (exception is FlutterError) {
listOf(
exception.code,
exception.message,
exception.details
)
} else {
listOf(
exception.javaClass.simpleName,
exception.toString(),
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
)
}
}
}

/**
* Error class for passing custom error details to Flutter via a thrown PlatformException.
* @property code The error code.
* @property message The error message.
* @property details The error details. Must be a datatype supported by the api codec.
*/
class FlutterError (
val code: String,
override val message: String? = null,
val details: Any? = null
) : Throwable()
private open class ThreatCenterApiPigeonCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return super.readValueOfType(type, buffer)
}
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
super.writeValue(stream, value)
}
}

/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface ThreatCenterApi {
fun areRootPrivilegesDetected(): Boolean
fun areHooksDetected(): Boolean
fun isSimulatorDetected(): Boolean

companion object {
/** The codec used by ThreatCenterApi. */
val codec: MessageCodec<Any?> by lazy {
ThreatCenterApiPigeonCodec()
}
/** Sets up an instance of `ThreatCenterApi` to handle messages through the `binaryMessenger`. */
@JvmOverloads
fun setUp(binaryMessenger: BinaryMessenger, api: ThreatCenterApi?, messageChannelSuffix: String = "") {
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_security_toolkit.ThreatCenterApi.areRootPrivilegesDetected$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
val wrapped: List<Any?> = try {
listOf(api.areRootPrivilegesDetected())
} catch (exception: Throwable) {
ThreatCenterApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_security_toolkit.ThreatCenterApi.areHooksDetected$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
val wrapped: List<Any?> = try {
listOf(api.areHooksDetected())
} catch (exception: Throwable) {
ThreatCenterApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_security_toolkit.ThreatCenterApi.isSimulatorDetected$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
val wrapped: List<Any?> = try {
listOf(api.isSimulatorDetected())
} catch (exception: Throwable) {
ThreatCenterApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

package com.exxeta.security_toolkit

import ThreatCenterApi
import com.exxeta.securitytoolkit.ThreatDetectionCenter
import io.flutter.embedding.engine.plugins.FlutterPlugin

class ThreatCenterApiImpl : FlutterPlugin, ThreatCenterApi {
private lateinit var threatDetectionCenter: ThreatDetectionCenter

override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
threatDetectionCenter = ThreatDetectionCenter(binding.applicationContext)
ThreatCenterApi.setUp(binding.binaryMessenger, this)
}

override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
ThreatCenterApi.setUp(binding.binaryMessenger, null)
}

// MARK: - ThreatCenterApi

override fun areRootPrivilegesDetected(): Boolean {
return threatDetectionCenter.areRootPrivilegesDetected
}

override fun areHooksDetected(): Boolean {
return threatDetectionCenter.areHooksDetected
}

override fun isSimulatorDetected(): Boolean {
return threatDetectionCenter.isSimulatorDetected
}
}
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
4 changes: 4 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.flutter_security_toolkit_example"
Expand Down
4 changes: 3 additions & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version "8.7.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

Expand Down
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Flutter (1.0.0)
- flutter_security_toolkit (1.0.1):
- flutter_security_toolkit (1.0.2):
- Flutter
- SecurityToolkit (~> 1.0)
- integration_test (0.0.1):
Expand All @@ -26,8 +26,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_security_toolkit: 73412e795f89286c565f7f91b76b2c4c610c953a
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
flutter_security_toolkit: 5c7cdc15de3e06faac5827d79d8d14e0c258d76a
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
SecurityToolkit: 51927d4723e634bddb83a4d16e86940b344fa6a4

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
Expand Down
Loading