From de23623d054a978b7db1a147ded0dcd6e8c19efb Mon Sep 17 00:00:00 2001 From: Geek-Squared Date: Tue, 17 Mar 2026 19:43:27 +0200 Subject: [PATCH 1/2] 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? From 7121d38f289a0ef3a2015cf2242568d81142a51a Mon Sep 17 00:00:00 2001 From: Geek-Squared Date: Tue, 21 Jul 2026 10:42:37 +0200 Subject: [PATCH 2/2] fix(ios): stop .npmignore from stripping .jbroot probe files from xcframework The `**/.*` rule matched the zero-byte .jbroot/libRHProbe.dat files sealed by TalsecRuntime.xcframework's code signature. When pnpm/npm packs this git dependency into node_modules it honors .npmignore and dropped those files, breaking signature validation on iOS with 'a sealed resource is missing or invalid'. Re-include the .jbroot directory so the seal stays intact. Co-Authored-By: Claude Opus 4.8 --- .npmignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.npmignore b/.npmignore index e073398..d2519ca 100644 --- a/.npmignore +++ b/.npmignore @@ -86,3 +86,10 @@ tsconfig.json ci-template.ejs deploy.sh ejs-config* + +# Keep Talsec .jbroot probe files inside TalsecRuntime.xcframework. +# They are zero-byte files sealed by the framework's code signature; the +# `**/.*` rule above otherwise strips them and breaks signature validation +# ("a sealed resource is missing or invalid") on iOS. +!**/.jbroot +!**/.jbroot/**