Skip to content

feat!: unify the public API with the other freeRASP plugins - #243

Merged
tompsota merged 6 commits into
chore/android-sdk-20.0.1from
feat/unified-api
Nov 13, 2026
Merged

tompsota merged 6 commits into
chore/android-sdk-20.0.1from
feat/unified-api

Conversation

@tompsota

@tompsota tompsota commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

What's new

Unifies the Flutter public API with the native SDKs and the other freeRASP plugins (React Native, Capacitor, Cordova) for the 9.0.0 major release. All changes are breaking and listed in the 9.0.0 changelog.

Config fields follow the native SDKs

Before After
AndroidConfig.signingCertHashes certificateHashes
AndroidConfig.supportedStores supportedAlternativeStores
IOSConfig.bundleIds appBundleIds (still List<String>)
IOSConfig.teamId appTeamId

The JSON keys from toJson/fromJson change with them. The Kotlin parser and the Swift Codable model read the new keys.

Threat names match the other plugins

ThreatCallback.onADBEnabled → onAdbEnabled, onUnsecureWiFi → onUnsecureWifi; Threat.deviceId → deviceID, Threat.unsecureWiFi → unsecureWifi.

One error type

Every Talsec method throws only TalsecException or a subclass:

  • new UnsupportedPlatformException (unsupported-platform) replaces UnimplementedError for Android-only methods and unsupported platforms
  • blockScreenCapture and isScreenCaptureBlocked no longer throw a generic Exception
  • start wraps platform errors in TalsecException
  • addToWhitelist and getAppIcon throw MalwareFailureException
  • ExternalIdFailureException and MalwareFailureException are now exported

The JS plugins use the same code values for their new TalsecError.

Methods already returned void or a meaningful bool, so return types are unchanged.

Notes

  • Stacked on release: freeRASP 9.0.0 (Android SDK 20.0.1) #241 (chore/android-sdk-20.0.1).
  • The *.g.dart serializers were edited only to rename the JSON keys. The current json_serializable emits Dart 3.8 syntax (null-aware elements), which the package's sdk: >=3.5.0 constraint doesn't allow, so regenerating with it would raise the minimum Dart version.

Testing

  • flutter analyze is clean; flutter test passes 87 tests (Android-only guards now expect UnsupportedPlatformException, including addToWhitelist/getAppIcon)
  • Example builds for Android (debug APK) and the iOS simulator
  • Example launched on the Android emulator (Pixel 4, API 33): Talsec starts with the renamed config, fast checks finish and malware detection reports suspicious apps
  • Not run on an iOS device or simulator

🤖 Generated with Claude Code

tompsota and others added 4 commits November 11, 2026 19:05
- config fields follow the native SDKs: AndroidConfig.certificateHashes,
  supportedAlternativeStores; IOSConfig.appBundleIds, appTeamId
- threat names match the other plugins: onAdbEnabled, onUnsecureWifi,
  Threat.deviceID, Threat.unsecureWifi
- every method throws only TalsecException or a subclass; new
  UnsupportedPlatformException replaces UnimplementedError, and the
  malware/external-id exceptions are now exported

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nown-code handling

- Talsec.private and the channel fields are private; tests use an
  internal createTalsecForTesting factory that freerasp.dart hides
- MalwareCallback takes List<SuspiciousAppInfo> suspiciousApps
- ThreatX.fromInt throws ArgumentError; Talsec terminates the app on an
  unknown threat or execution state code, like the JS plugins

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tompsota

Copy link
Copy Markdown
Member Author

Added in f61a674 (all breaking, listed in the changelog):

  • Talsec.private and the methodChannel / eventChannel / executionStateChannel fields are now private. Tests build an instance through an internal createTalsecForTesting factory, which package:freerasp/freerasp.dart hides.
  • MalwareCallback receives List<SuspiciousAppInfo> suspiciousApps (no nullable items). The Pigeon parameter is renamed the same way and the Dart/Kotlin bindings are regenerated.
  • ThreatX.fromInt throws ArgumentError like RaspExecutionStateX.fromInt, and its doc comment lists the current codes. Talsec terminates the app on an unknown code from either stream, as the JS plugins do; before, only unknown threat codes did.

Checked: flutter analyze clean, 88 tests pass, example debug APK builds. Not run on an emulator.

@internal is not exported by flutter/foundation in Flutter 3.24, the
minimum supported version used by CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tompsota
tompsota removed this pull request from stack #245 November 13, 2026 22:04
* refactor!: replace Pigeon with the threat event channel

Malware and ongoing call detections are sent over the existing threat
EventChannel as {type, ...} maps next to the plain threat codes, so one
subscription delivers every detection in order. PackageInfo,
SuspiciousAppInfo and CallState become hand-written Dart types with the
same names; ThreatCallback no longer extends the generated
TalsecPigeonApi. The pigeon dev dependency and generated code are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: import @internal and @immutable from package:meta

flutter/foundation does not export @internal in Flutter 3.24, the minimum
supported version used by CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@tompsota
tompsota merged commit 4ab7748 into chore/android-sdk-20.0.1 Nov 13, 2026
@tompsota
tompsota deleted the feat/unified-api branch November 13, 2026 22:05
tompsota added a commit that referenced this pull request Nov 13, 2026
* release: freeRASP 8.4.0 (Android SDK 20.0.1)

Bump the Android SDK to 20.0.1 (app.talsec.rasp:TalsecRasp-Community-Flutter)
and expose its new features:

- ongoing call detection: ThreatCallback.onOngoingCall with CallState,
  Talsec.startOngoingCallDetection/stopOngoingCallDetection
- screen control blocking: blockScreenControl/isScreenControlBlocked
- overlay windows hiding: blockOverlayWindows/isOverlayWindowsBlocked
- onCriticalChecksFinished/onPostponedChecksFinished execution states

onAllChecksFinished is now driven by the SDK's onFastChecksFinished, which
fires where the removed onAllChecksFinished used to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: reword the Maven coordinates changelog entry

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat!: rename allChecksFinished to fastChecksFinished

The execution state that fires when the fast (standard) checks complete is
renamed on all platforms to match the Android SDK's onFastChecksFinished. On
iOS it is driven by the SDK's onAllChecksFinished. This is a breaking change,
so the package major version is bumped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: drop Breaking markers from Android SDK changes absorbed by the plugin

The plugin hides these native API changes from its users, so they move from
the Android Breaking Changes section to Changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: drop Android changelog entries already listed in the plugin section

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(android): move plugin to the app.talsec.rasp.flutter namespace (#242)

* refactor(android): move plugin to the app.talsec.rasp namespace

Align the Android package of the plugin with the Android SDK's app.talsec.rasp,
adding the platform as the last segment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(android): update package names to app.talsec.rasp

Completes the move of the plugin sources: package declarations, imports,
Gradle namespace and build configuration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* example: show ongoing call alongside the other threats

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* example: show the ongoing call state (Not detected, Started, Ongoing, Stopped)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(android): start Talsec in background mode

Talsec.start now uses TalsecMode.BACKGROUND, as the React Native plugin
already does, so the SDK initializes off the calling thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): note that freeRASP starts in background mode on Android

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat!: unify the public API with the other freeRASP plugins (#243)

* feat!: unify the public API with the other freeRASP plugins

- config fields follow the native SDKs: AndroidConfig.certificateHashes,
  supportedAlternativeStores; IOSConfig.appBundleIds, appTeamId
- threat names match the other plugins: onAdbEnabled, onUnsecureWifi,
  Threat.deviceID, Threat.unsecureWifi
- every method throws only TalsecException or a subclass; new
  UnsupportedPlatformException replaces UnimplementedError, and the
  malware/external-id exceptions are now exported

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(ios): use the renamed config keys in RunnerTests

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor!: hide Talsec internals, tighten malware callback, unify unknown-code handling

- Talsec.private and the channel fields are private; tests use an
  internal createTalsecForTesting factory that freerasp.dart hides
- MalwareCallback takes List<SuspiciousAppInfo> suspiciousApps
- ThreatX.fromInt throws ArgumentError; Talsec terminates the app on an
  unknown threat or execution state code, like the JS plugins

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: use @VisibleForTesting for the test factory

@internal is not exported by flutter/foundation in Flutter 3.24, the
minimum supported version used by CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor!: replace Pigeon with the threat event channel (#244)

* refactor!: replace Pigeon with the threat event channel

Malware and ongoing call detections are sent over the existing threat
EventChannel as {type, ...} maps next to the plain threat codes, so one
subscription delivers every detection in order. PackageInfo,
SuspiciousAppInfo and CallState become hand-written Dart types with the
same names; ThreatCallback no longer extends the generated
TalsecPigeonApi. The pigeon dev dependency and generated code are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: import @internal and @immutable from package:meta

flutter/foundation does not export @internal in Flutter 3.24, the minimum
supported version used by CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant