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 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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Autogenerated from Pigeon (v22.6.4), 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.MessageCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer

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

private 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) {
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) {
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) {
wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Autogenerated from Pigeon (v22.6.4), 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.MessageCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer

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

private 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) {
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) {
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) {
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
}
}
4 changes: 2 additions & 2 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,7 +26,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_security_toolkit: 73412e795f89286c565f7f91b76b2c4c610c953a
flutter_security_toolkit: 82972aec2bbed79dc6b22fac76aed57419e24c73
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
SecurityToolkit: 51927d4723e634bddb83a4d16e86940b344fa6a4

Expand Down
Loading