diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..9320004 --- /dev/null +++ b/Package.swift @@ -0,0 +1,44 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CapacitorFreerasp", + platforms: [.iOS(.v13)], + products: [ + .library( + name: "CapacitorFreerasp", + targets: ["FreeraspPlugin"] + ), + ], + dependencies: [ + .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", "6.0.0"..<"9.0.0"), + ], + targets: [ + .binaryTarget( + name: "TalsecRuntime", + path: "ios/Plugin/TalsecRuntime.xcframework" + ), + .target( + name: "FreeraspPlugin", + dependencies: [ + .product(name: "Capacitor", package: "capacitor-swift-pm"), + .product(name: "Cordova", package: "capacitor-swift-pm"), + "TalsecRuntime", + ], + path: "ios/Plugin", + exclude: ["TalsecRuntime.xcframework"], + sources: [ + "FreeraspPlugin.swift", + "models/SecurityThreat.swift", + "models/RaspExecutionStates.swift", + "utils/Utils.swift", + "utils/RandomGenerator.swift", + "utils/EventIdentifiers.swift", + "dispatchers/ThreatDispatcher.swift", + "dispatchers/ExecutionStateDispatcher.swift", + ] + ), + ] +) \ No newline at end of file diff --git a/ios/Plugin/FreeraspPlugin.swift b/ios/Plugin/FreeraspPlugin.swift index 3af500a..505f15a 100644 --- a/ios/Plugin/FreeraspPlugin.swift +++ b/ios/Plugin/FreeraspPlugin.swift @@ -3,7 +3,23 @@ import Capacitor import TalsecRuntime @objc(FreeraspPlugin) -public class FreeraspPlugin: CAPPlugin { +public class FreeraspPlugin: CAPPlugin, CAPBridgedPlugin { + + public let identifier = "FreeraspPlugin" + public let jsName = "Freerasp" + public let pluginMethods: [CAPPluginMethod] = [ + CAPPluginMethod(name: "talsecStart", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "getThreatChannelData", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "getThreatIdentifiers", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "getRaspExecutionStateChannelData", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "getRaspExecutionStateIdentifiers", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "onInvalidCallback", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "storeExternalId", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "removeExternalId", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "blockScreenCapture", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "isScreenCaptureBlocked", returnType: CAPPluginReturnPromise), + CAPPluginMethod(name: "removeListenerForEvent", returnType: CAPPluginReturnPromise), + ] public static var shared: FreeraspPlugin?