From de23623d054a978b7db1a147ded0dcd6e8c19efb Mon Sep 17 00:00:00 2001 From: Geek-Squared Date: Tue, 17 Mar 2026 19:43:27 +0200 Subject: [PATCH] feat(ios): add Swift Package Manager support for Capacitor 6-8 --- Package.swift | 44 +++++++++++++++++++++++++++++++++ ios/Plugin/FreeraspPlugin.swift | 18 +++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Package.swift 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?